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 18.1k 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.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator
      last edited by

      Here is the thing.. By default pfsense blocks all inbound traffic to wan..  So unless you create a rule to allow it - its going to be blocked..  Do you have firewall off?

      He clearly has a rule that is any any to "public net"  My my guess that is what is being hit for him.

      I have ssh enabled on my lan, I hit it every day to be honest..  But from public its denied.. I see hits to it all the time, see previous pic..  If its not being blocked you got something wrong in your rules..  Please post your floating rules and wan rules..

      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.8, 24.11

      1 Reply Last reply Reply Quote 0
      • BBcan177B
        BBcan177 Moderator
        last edited by

        An interesting article by Fireeye about recent SSH brute force attacks. Almost makes you want to open ssh on the WAN  ;D

        https://www.fireeye.com/blog/threat-research/2015/02/anatomy_of_a_brutef.html

        "Experience is something you don't get until just after you need it."

        Website: http://pfBlockerNG.com
        Twitter: @BBcan177  #pfBlockerNG
        Reddit: https://www.reddit.com/r/pfBlockerNG/new/

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

          If you want to have fun with ssh, run a honeypot and see the IPs from china light you up like a xmas tree ;)

          To be honest anyone that would run a ssh server that allows passwords is asking for trouble, whenever I bring up something that has ssh enabled - first thing I do is enable public key and turn off password auth.

          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.8, 24.11

          1 Reply Last reply Reply Quote 0
          • DerelictD
            Derelict LAYER 8 Netgate
            last edited by

            block IPv4 TCP/UDP  *  22 (SSH)  WAN address  22 (SSH)  *  none

            Don't use a source port.  Source ports are random.  That rule will never match.

            Those block ssh rules do nothing because you never pass ssh below them.

            What do PUBLIC address and PUBLIC net expand to?  You are probably passing the TCP/22 traffic with that last pass any to PUBLIC net rule.

            This would be a lot easier to diagnose without all the obfuscation of IP addresses.

            ![Screen Shot 2015-02-09 at 9.09.23 PM.png](/public/imported_attachments/1/Screen Shot 2015-02-09 at 9.09.23 PM.png)
            ![Screen Shot 2015-02-09 at 9.09.23 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2015-02-09 at 9.09.23 PM.png_thumb)

            Chattanooga, Tennessee, USA
            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
            Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

              So, I did mention it in the original post, but the "Public" net is the one that is advertised by us via BGP.  Consider it a DMZ of hosts - 64.141.y.x.  To permit routing to those hosts via the two WAN interfaces, do I not need to implicitly allow traffic to them, to avoid the default block rule???

              1 Reply Last reply Reply Quote 0
              • DerelictD
                Derelict LAYER 8 Netgate
                last edited by

                Yes.

                Please post all applicable interfaces, subnets, and rules.  Trying to help you with everything obfuscated is nearly impossible.  PM if you must. They're just IP addresses.

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

                  You would need to allow the services you want to run on those IP.. that sure and the hell wouldn't be a any any ;)

                  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.8, 24.11

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

                    So if I am serving Internet to multiple commercial/industrial customers on that network, shouldn't I be passing everything to them and letting them control their own firewalling?  I will take new screenshots of all rules and post them in a minute…

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

                      Okay, soooo….

                      Shaw WAN (WAN1) - 64.141.127.248/29
                      Telus WAN (WAN2) - 204.191.241.0/29
                      Public (~DMZ) - 64.141.125.0/24 - advertised on both WANs via BGP

                      Shaw WAN Rules:

                      Telus WAN Rules:

                      Pubic Interface Rules:

                      All of these are for VoIP devices - companies host POTS lines here and we connect them to VoIP adapters and transport to their remote facilities via our microwave network.

                      Also, there are no rules in the floating tab.

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

                        @johnpoz:

                        To be honest anyone that would run a ssh server that allows passwords is asking for trouble, whenever I bring up something that has ssh enabled - first thing I do is enable public key and turn off password auth.

                        I'm all for more security.  What do you mean?  Do you use a hardware credential?  On these two systems I am the only one that ever uses SSH for access (but limited access).

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

                          public key auth - look it up.  Takes 2 seconds to implement.

                          So your routing traffic to this segment behind pfsense.  So pfsense has an IP in this network, and it listens on ssh because you enable ssh.  So block ssh to that interface IP.

                          So this segment
                          Public (~DMZ) - 64.141.125.0/24

                          Pfsense is what 64.141.125.1 ??  Block traffic to pfsense IP from the public internet - I agree your customers need to do their own firewall if not using your services for that.

                          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.8, 24.11

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

                            That's what I had done originally - I had rules to block SSH to the interface's real IP and the CARP IP.  I will add them again right now.

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

                              And you mention you see stuff in the logs for attempted auth.. And what IP are they authing too?

                              If that is the IP I can validate if ssh is open to the public.

                              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.8, 24.11

                              1 Reply Last reply Reply Quote 0
                              • T
                                tha_toadman
                                last edited by

                                That's what I had done originally…

                                I did the same. My rules don't seem to work after I enable the SSH server via the checkbox.

                                Floating:
                                block    IPv4 TCP/UDP * 22 (SSH) WAN address 22 (SSH) * none

                                WAN:
                                block    IPv4 TCP/UDP * 22 (SSH) WAN address 22 (SSH) * none

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

                                  I just added the rules again and changed the port back to default 22.  You can try to SSH to 64.141.125.250, .251 or .254 (CARP).

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    tha_toadman
                                    last edited by

                                    I just added the rules again and changed the port back to default 22.  You can try to SSH to 64.141.125.250, .251 or .254 (CARP).

                                    They are all open. Sounds like your rules aren't working either.

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

                                      Source is not going to be 22  source could be ANY, and ssh is not UDP..

                                      And yes that is open!! on the 250, 251 and 254

                                      login as:

                                      Password for admin@router1.morad:

                                      251 shows
                                      steve.morad

                                      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.8, 24.11

                                      1 Reply Last reply Reply Quote 0
                                      • T
                                        tha_toadman
                                        last edited by

                                        Ah, yep. Good point. I'll make the change and try again.

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

                                          dude you should not have to put in any rules.. There is a default DENY!!  Are you allowing traffic in like the OP?

                                          if your going to block it has to be above your allow rule - post your rules.

                                          If you have an allow for that segment, then above it put in a block to those specific addresses.

                                          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.8, 24.11

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

                                            For me, I pretty much never put in a source port.  As others have said, they are usually random, so no point.  And also, I put them right at the top - since they are handled from the top down, start with the most specific and go from there.

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