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

    Making missing state rule reject instead of block

    Scheduled Pinned Locked Moved Firewalling
    18 Posts 8 Posters 3.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.
    • H
      Harvy66
      last edited by

      @obroni:

      Otherwise how does the application differentiate between a loss of connectivity, where it should keep trying with the existing session and in the case where the state is lost and it should re-establish a connection from scratch.

      PFSense has a 24 hour timeout by default for established connections. It will only close a state if this idle timeout is reached or it sees a proper FIN or RST packet to indicate that it needs to close the state.

      More than likely it's not PFSense killing the connection early, but possibly some of these packets are getting lost and one of the devices closes the connection and the other device doesn't get the packets notifying the connection was killed.

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

        If you create your own reject rule at the bottom vs the default deny.  If the rule is out of state that block/reject would trigger before the default deny so you should be able to send a RST.

        The problem is that is a bad idea on wan for sure.  Because every single packet that did not match an allow rule would be causing firewall to send RST.

        You could I guess make the reject rule on the bottom only trigger on your specific IP or set of flags, etc.

        But sending RST for the default deny would be a really bad idea..

        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
        • K
          kpa
          last edited by

          @johnpoz:

          But sending RST for the default deny would be a really bad idea..

          Umm, this is certainly a valid and widely used configuration and it does exactly that for TCP connections and an unreachable ICMP message for UDP on a block rule including the default deny:

          
          ...
          set block-policy return
          ...
          
          

          From pf.conf(5):

          
          set block-policy
                     The block-policy option sets the default behaviour for the packet
                     block action:
          
                     drop      Packet is silently dropped.
                     return    A TCP RST is returned for blocked TCP packets, an ICMP
                               UNREACHABLE is returned for blocked UDP packets, and all
                               other packets are silently dropped.
          
                     For example:
          
                           set block-policy return
          
          

          Care to elaborate what you had in mind?

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Valid, perhaps, but I'm not sure about "widely used". Certainly not something I'd ever suggest anyone set.

            Any option that causes you to send out data when you receive a request is a potential DDoS reflection abuse target.

            Someone could spoof the source and you'd end up sending data toward an attacker's target.

            Even if it's not more data than was sent to you, it still hides the source of the traffic.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

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

              ^ yeah with jimp here, it for sure is not Widely Used..  Most firewalls drop..  Now if internal firewall, you might want to RST stuff.  but on the public internet no not a good idea.

              Now I have setup reject for a couple of things.  I like traceroute to work ;)  So linux traceroute uses specific udp ports, for those I have setup reject.  So When I do a traceroute through my pfsense on ipv6 I see the pfsense hop.  And if you trace to my public ipv4 those ports are also set for reject so I see an an answer.

              But rejecting every port that I don't have open would not be a good idea..

              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
              • H
                Harvy66
                last edited by

                @jimp:

                Someone could spoof the source and you'd end up sending data toward an attacker attackee.

                Reflection attack

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

                  While yes reflection attack is possible when you send a RST.. Unless there is amplification in the attack its not very attractive method of attack.

                  Its more of performance and bandwidth thing for your own firewall.  Do you want it doing the extra work of sending RST for every single packet it sees that it does not allow in?  There can be quite a bit of noise on the public internet.

                  So your bandwidth was already used once in seeing the noise, if your not letting it in - its NOISE.. So why increase the volume of the noise by sending RST.. Which is extra work for your firewall and extra bandwidth (how ever small) that you really do not need to send.  Now it can be handy depending on the use case - for example my traceroute example.  If you just drop those packets then with a udp traceroute you wont see that hop.  And maybe you want to see that hop or end target so the extra work and packets you might send with noise to those ports might be worth it to you.

                  You can argue that hey if someone sends me traffic to port that is closed, vs them sending retrans of those packets and having to wait for their application to say hey nobody answered, might be nice to just let them know on the first packet that port is closed, etc.  Internet is not really all candy canes and suger plums ;)  While in the perfect world hey lets all be nice and tell the sender hey buddy port is closed RST.  But why should you make the asshat looking for open smtp servers by probing random IPs on 25 for smtp.. Let him freaking timeout vs telling him right away you don't run one, etc.

                  Which is why you might want to turn that on internally..  On my internal networks that have limited outbound ports open, I send them rejects on ports they are trying to go out that I block.  Because hey its my devices doing it, etc.  So sure let them know vs letting them retrans, 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.7.2, 24.11

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    @Harvy66:

                    @jimp:

                    Someone could spoof the source and you'd end up sending data toward an attacker attackee.

                    Reflection attack

                    Fixed, thx.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • N
                      Nullity
                      last edited by

                      @johnpoz:

                      Which is why you might want to turn that on internally..  On my internal networks that have limited outbound ports open, I send them rejects on ports they are trying to go out that I block.  Because hey its my devices doing it, etc.  So sure let them know vs letting them retrans, etc.

                      I use REJECT on my LAN interface as well and it seems to have no problems, but I also have a whitelist firewalling setup like you.

                      Please correct any obvious misinformation in my posts.
                      -Not a professional; an arrogant ignoramous.

                      1 Reply Last reply Reply Quote 0
                      • O
                        obroni
                        last edited by

                        Hi, Thanks for all the replies, this is on an internal firewall between a DMZ and LAN so I believe RST's should be a safe option here.

                        From what I understand from some of the posts here, is that a normal reject rule should indeed pickup out of state packets. When I get a chance to take everything down again, I will take some tcpdumps and try and see if I can see any RST's being generated.

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