Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Blocking SSH - Firewall Rule Troubles - SOLVED

    Scheduled Pinned Locked Moved Firewalling
    59 Posts 6 Posters 17.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      acherman
      last edited by

      Looks like that 66.163.70.2 is the router on our Shaw WAN - the address that I hit there is 64.141.127.249.

      1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator
        last edited by

        Ok I put in a rule on your shaw wan to block ssh to your .250, 251, 254

        And I it looks blocked now.

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

        1 Reply Last reply Reply Quote 0
        • johnpozJ
          johnpoz LAYER 8 Global Moderator
          last edited by

          Ok I added logging to the rule, and you can see blocked from my attempt to all 3 of them

          Your going to want to go through these connections and block services to pfsense interfaces.  So for example I was able to remote in.. that should clearly be something you only allow when you want it.. And put in specific rule for ;)

          blockedinlogs.png
          blockedinlogs.png_thumb

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • A
            acherman
            last edited by

            Okay, so I had rules just like to start with (see first post).  Weird.  So, which address were you able to get in on?

            1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator
              last edited by

              I could ssh to all 3 of the ips.  And https is open on all three as well.

              Ssh is blocked now.. your going to want to block ports your gui is listening on.. https, I didn't check http.. And any thing else you might have running.. dns for example

              C:>dig @64.141.125.254

              ; <<>> DiG 9.9.5-W1 <<>> @64.141.125.254
              ; (1 server found)
              ;; global options: +cmd
              ;; Got answer:
              ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12950
              ;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

              ;; OPT PSEUDOSECTION:
              ; EDNS: version: 0, flags:; udp: 4096
              ;; QUESTION SECTION:
              ;.                              IN      NS

              ;; ANSWER SECTION:
              .                      87258  IN      NS      b.root-servers.net.
              .                      87258  IN      NS      l.root-servers.net.
              .                      87258  IN      NS      f.root-servers.net.
              .                      87258  IN      NS      i.root-servers.net.
              .                      87258  IN      NS      e.root-servers.net.
              .                      87258  IN      NS      d.root-servers.net.
              .                      87258  IN      NS      a.root-servers.net.
              .                      87258  IN      NS      g.root-servers.net.
              .                      87258  IN      NS      j.root-servers.net.
              .                      87258  IN      NS      h.root-servers.net.
              .                      87258  IN      NS      m.root-servers.net.
              .                      87258  IN      NS      k.root-servers.net.
              .                      87258  IN      NS      c.root-servers.net.

              ;; Query time: 110 msec
              ;; SERVER: 64.141.125.254#53(64.141.125.254)
              ;; WHEN: Tue Feb 10 16:10:40 Central Standard Time 2015
              ;; MSG SIZE  rcvd: 239

              DUDE!!!! you have a recursive dns listening on the public net!!  That is normally not good!!  Bock that as well!!!

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.7.2, 24.11

              1 Reply Last reply Reply Quote 0
              • A
                acherman
                last edited by

                Damnit!!!  >:(

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator
                  last edited by

                  This why you normally don't do a any any rule on your wan ;)

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                  1 Reply Last reply Reply Quote 0
                  • A
                    acherman
                    last edited by

                    You lost me with the recursive DNS part.

                    Also, so, without the any any rule, how would I pass all routed traffic to the the commercial hosts on that net?

                    1 Reply Last reply Reply Quote 0
                    • johnpozJ
                      johnpoz LAYER 8 Global Moderator
                      last edited by

                      Recursive – I can ask you for any domain on the planet..

                      ; <<>> DiG 9.9.5-W1 <<>> @64.141.125.254 www.google.com               
                      ; (1 server found)                                                     
                      ;; global options: +cmd                                               
                      ;; Got answer:                                                         
                      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37163             
                      ;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1

                      ;; OPT PSEUDOSECTION:                                                 
                      ; EDNS: version: 0, flags:; udp: 4096                                 
                      ;; QUESTION SECTION:                                                   
                      ;www.google.com.                        IN      A

                      ;; ANSWER SECTION:                                                     
                      www.google.com.        135    IN      A      207.34.103.20         
                      www.google.com.        135    IN      A      207.34.103.54         
                      www.google.com.        135    IN      A      207.34.103.29         
                      www.google.com.        135    IN      A      207.34.103.30         
                      www.google.com.        135    IN      A      207.34.103.59         
                      www.google.com.        135    IN      A      207.34.103.39         
                      www.google.com.        135    IN      A      207.34.103.50         
                      www.google.com.        135    IN      A      207.34.103.40         
                      www.google.com.        135    IN      A      207.34.103.35         
                      www.google.com.        135    IN      A      207.34.103.55         
                      www.google.com.        135    IN      A      207.34.103.45         
                      www.google.com.        135    IN      A      207.34.103.34         
                      www.google.com.        135    IN      A      207.34.103.49         
                      www.google.com.        135    IN      A      207.34.103.44         
                      www.google.com.        135    IN      A      207.34.103.24         
                      www.google.com.        135    IN      A      207.34.103.25

                      ;; Query time: 69 msec                                                 
                      ;; SERVER: 64.141.125.254#53(64.141.125.254)                           
                      ;; WHEN: Tue Feb 10 16:18:15 Central Standard Time 2015               
                      ;; MSG SIZE  rcvd: 299

                      You then go look it up for me..  This is can be used for HUGE amplification attacks.. Do you not read the news? ;)

                      Normally with a transit network, so pfsense interface is not exposed to the any any rule with a downstream router.  My point to the any any, is doing so normally exposes stuff that might not of thought of..  Like your web gui to your firewall, ssh, dns, etc.

                      If you want to continue to use the any any - then create a specific block rule containing all the stuff you don't want to expose for pfsense interface in that segment, and then make sure its applied on the appropriate interfaces where that traffic comes in.

                      Or make the any any specific to the IPs the customer is using and not true any any.. so like 64.141.125.1 to 249 for example..

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                      1 Reply Last reply Reply Quote 0
                      • A
                        acherman
                        last edited by

                        For blocking the services to all of my router interfaces, can I just change the alias you made to include the WAN addresses as well?  And any others that I need?

                        1 Reply Last reply Reply Quote 0
                        • A
                          acherman
                          last edited by

                          Sure I read the news, but I get all caught up with all the Kardashian stuff.  It's super duper fascinating.

                          Okay, so I'm working on creating rules right now.  For the recursive, just block DNS on the WAN interfaces?

                          And thanks again.  You're a huge life saver here.  I really appreciate your time and help.

                          1 Reply Last reply Reply Quote 0
                          • johnpozJ
                            johnpoz LAYER 8 Global Moderator
                            last edited by

                            Sure you can create an alias to include IPs and ports..  But you could also just change the any any rule you have to not be the full network, make it say 64.141.125.1 to .249.. Now this allows all there stuff to be open..  But the default deny would block access to the IPs you would use on pfsense for say carp, etc. etc.

                            That is the way I would do it so I was sure not to miss a service or bring up a new services and forget to update the blocking rule..  Always better to have deny deny and anything that is allowed have to have a rule, then to allow a rule that is any any, and now new services are open when they you didn't want them to be.

                            An intelligent man is sometimes forced to be drunk to spend time with his fools
                            If you get confused: Listen to the Music Play
                            Please don't Chat/PM me for help, unless mod related
                            SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                            1 Reply Last reply Reply Quote 0
                            • D
                              doktornotor Banned
                              last edited by

                              Regardless of any FW rules - do you need DNS listening on WAN? If not, then just do not bind it to WAN interfaces.

                              1 Reply Last reply Reply Quote 0
                              • A
                                acherman
                                last edited by

                                Okay, I think your way sounds much better (obviously).  How can I make the rule for a range like that?  I'm looking…

                                And no, we don't need to listen for DNS on the WAN - only outbound requests.  Although, I don't have DNS Resolver turned on.  Or am I missing it somewhere else?

                                1 Reply Last reply Reply Quote 0
                                • A
                                  acherman
                                  last edited by

                                  Alrighty then, I created an alias for those Public IPs that need full access (64.141.125.21-.249), and changed the permit any any rule to the alias as the destination.

                                  1 Reply Last reply Reply Quote 0
                                  • johnpozJ
                                    johnpoz LAYER 8 Global Moderator
                                    last edited by

                                    And and a quick test shows can not get to the web gui, and can not query dns.  Much better setup

                                    C:>dig @64.141.125.254

                                    ; <<>> DiG 9.10-P2 <<>> @64.141.125.254
                                    ; (1 server found)
                                    ;; global options: +cmd
                                    ;; connection timed out; no servers could be reached

                                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                                    If you get confused: Listen to the Music Play
                                    Please don't Chat/PM me for help, unless mod related
                                    SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      acherman
                                      last edited by

                                      Thanks for your help.  You rock!!!

                                      1 Reply Last reply Reply Quote 0
                                      • johnpozJ
                                        johnpoz LAYER 8 Global Moderator
                                        last edited by

                                        Here to help dude, sometimes I get cranky and rambunctious with some of my wording..  But just here to help people enjoy their pfsense setup as much as I do.  Never take anything I say personal, quite often its the beer or bourbon talking as well ;) heheeh

                                        It can get frustrating sometime with same questions over and over and over again with people unwilling to do their own learning and reading.  Nice to have a problem other than people with ftp and unbound questions ;)

                                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                                        If you get confused: Listen to the Music Play
                                        Please don't Chat/PM me for help, unless mod related
                                        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post
                                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.