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

    Firewall - new block rule does not influence active connections.

    Scheduled Pinned Locked Moved Firewalling
    8 Posts 6 Posters 3.2k 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.
    • R
      ruibalmeida
      last edited by

      Hello to all,

      When I create a new block rule it only influences new connections from there on, the active connections are not instantly blocked.

      Is this by design ? or am I missing something?

      If it is by design is it in the road map to alter this behavior?

      Thanks

      Kindest Regards.

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

        Why would they change the design?  Yes if there is a state then new firewall rules do not effect those states.  Every firewall I have ever worked with works this way.

        It is quite common that when you add a rule not to mess with current states, you can always kills the states that are open that would not be allowed with your new rule, or you can always just reset all the states if you want.

        To do what you want without causing a disruption in all traffic you would need a script to look at the rule and then figure out what states would be removed with that firewall rule and kill them.  That is highly unlikely.

        Its up to you as the admin of the firewall to remove the states that are active that you no longer desire, etc.

        Go to Diagnostics/ States

        From there you can filter and kill the specific states you no longer want active, any new connections will use your new firewall rule.  Or from that area you can all reset all states.

        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
        • R
          ruibalmeida
          last edited by

          Thanks for your reply.

          I understand that you can manually kill states or reset all.

          I am just comparing PFSENSE behavior with other firewalls like asa or palo alto.

          When you apply a rule it applies to active connections immediately.

          And for my use case it is important. Block malware hosts on wan.

          Thanks,

          Kindest regards.

          1 Reply Last reply Reply Quote 0
          • KOMK
            KOM
            last edited by

            pf's way is better because it is more flexible.  Killing all states when I add a rule would get my ass kicked in the real world.  With pf, you can manually kill all states if that's what you need, or you can use the filter to selectively kill only those states that apply to the rule you're working with and leave everyone else alone.

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

              palo alto.. So your comparing FREE pfsense to the feature set of a palo alto? ;)

              What models are you working with.. Whats a PA-3020 cost like 14K.. Not counting your subscription costs.

              What your asking sure could be done, but there has to be something that evaluates your rule, compared to all states and only kills the appropriate.

              You could put in a bounty for such a feature..  Simple solution is how the soho routers do it, add a new rule - RESET ALL states..

              It really is pretty simple to just filter the state table for what you want to kill.  To be honest, this way you will know what IPs on your network had/have a connection to something bad that your wanting to kill.  So you could then investigate those machines to see if they were exploited, etc. etc..

              edit:  I am with KOM this way is better if you ask me.  Does the palo alto give you option to kill or not kill active states that this rule applies too?  its quite possible you might want to add a rule that blocks xyz..  But don't have any issues with xyz that are currently active still working.  Maybe you want to kill those states at 5pm, when you notified your users that all connections would be killed, etc.

              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

                @johnpoz:

                What your asking sure could be done, but there has to be something that evaluates your rule, compared to all states and only kills the appropriate.

                You could put in a bounty for such a feature..  Simple solution is how the soho routers do it, add a new rule - RESET ALL states..

                As an FYI, this can be done in pfBlockerNG… After each Cron run, when "States removal" is enabled, it will check all open states and verify if they are listed in any Blocklist and remove/report them... So if a new Blacklisted IP is added and an exisiting state was previously created, those States are removed...

                "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
                • C
                  cmb
                  last edited by

                  @ruibalmeida:

                  I am just comparing PFSENSE behavior with other firewalls like asa

                  ASA at least has the same behavior in that regard (though they recently added an option to kill in that case). Most commercial firewalls behave the same as pf in that regard.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Harvy66
                    last edited by

                    Processing firewall rules is O(n) and checking for existing connections is O(1). Among the other benefits, it's faster to do it this way.

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