Firewall - new block rule does not influence active connections.



  • 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.


  • Rebel Alliance Global Moderator

    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.



  • 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.



  • 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.


  • Rebel Alliance Global Moderator

    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.


  • Moderator

    @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...



  • @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.



  • 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.