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

    Rate Limit by Attempts Per Time

    Scheduled Pinned Locked Moved General pfSense Questions
    9 Posts 4 Posters 1.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.
    • J
      Jake Biker
      last edited by

      Hi All,

      Sorry maybe I should post this in traffic shapers..

      I have a secure SSH gateway that is very adequately protected by times per second rate limiting in RHEL Firewalld.

      Is there any way to do this in PFSense? Rather than on the node?

      S 1 Reply Last reply Reply Quote 0
      • S
        SteveITS Galactic Empire @Jake Biker
        last edited by

        @Jake-Biker There are a handful of settings which should do what you're looking for. See this page:
        https://docs.netgate.com/pfsense/en/latest/firewall/configure.html#maximum-state-entries-this-rule-can-create

        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
        Upvote 👍 helpful posts!

        1 Reply Last reply Reply Quote 2
        • J
          Jake Biker
          last edited by

          Thanks all - It doesn't seem to reset - what am I doing wrong?

          Regards

          Jake

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            Like after the number of connections set it doesn't allow more?

            What exactly did you set?

            1 Reply Last reply Reply Quote 0
            • M
              michmoor LAYER 8 Rebel Alliance
              last edited by

              Is there a generally accepted value(s) when it comes to max state entries or max state for fully established? These options can protect the firewall during a ddos event but is there any guidance to what a threshold should be? I have a busy webfarm for a client so I’m curious if this is worth looking deeper into

              Firewall: NetGate,Palo Alto-VM,Juniper SRX
              Routing: Juniper, Arista, Cisco
              Switching: Juniper, Arista, Cisco
              Wireless: Unifi, Aruba IAP
              JNCIP,CCNP Enterprise

              S 1 Reply Last reply Reply Quote 0
              • S
                SteveITS Galactic Empire @michmoor
                last edited by

                @michmoor I’d (wild) guess it would vary widely depending on the server capacity and web site. One server might handle thousands of simultaneous static page requests while another could only handle dozens to hundreds of PHP pages. Also pfSense might be set with one rule for each web server, or one combined rule. Also, what should the (valid) visitor see, a slow site or connection failure?

                Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                Upvote 👍 helpful posts!

                J 1 Reply Last reply Reply Quote 0
                • J
                  Jake Biker @SteveITS
                  last edited by Jake Biker

                  @SteveITS

                  I am using

                  Max Connections = 2 (To Allow two connections only from each host through the rule - some of our guys like two SSH Windows open)
                  Max.Src.Conn.Rate = 4
                  Max.Src.Conn.Rates = 30
                  State Timout = 30

                  And its not working as I expected - I am hoping for 4 attempts to connect every 30 seconds - sure enough after the forth it locks, but the state stays locked against that host and doesn't reset.

                  I've obviously misread / misconfigured - any suggestions please?
                  I actually have to reset the FW to let the rule pass again ...doh

                  Most grateful

                  Jake

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    Hosts that exceed the limit are added to the virusprot table. You can remove them from that table manually.

                    Hosts in that table are expired after 1 hour. You can see that in the cronjob called for it. You could change that.

                    Steve

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      Jake Biker @stephenw10
                      last edited by

                      @stephenw10

                      OK I see ...

                      This is slightly different from the rate limit I use in UFW or Firewalld ...

                      In which the state auto resets.

                      One assumes that as long as the limit of 4 in 30 seconds isn't exceeded the host isn't written and therefore will never require deletion with the Chron Job.

                      I suppose maybe set the limit a little higher to resolve accidents - but leave the 1 hour Chron job -

                      I did think of using my usual Fail2Ban - but I think this will work well as the SSH is protected with MFA any robot will immediately be blocked after hitting it so fast, and the times taken after lock to unlock will make any brute force practically beyond impossible - the MFA would stop em when they don't have the second device which is push notification so --- impossible. virtually.

                      Thanks for your input

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