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

    Why do no floating rules match?

    Scheduled Pinned Locked Moved Firewalling
    26 Posts 5 Posters 2.3k Views 5 Watching
    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 Offline
      Rockojfonzo @johnpoz
      last edited by

      @johnpoz Sorry, been a busy day.
      tcpdump results are more or less the same as in 1st post:

      [2.7.2-RELEASE][admin@fw]/root: tcpdump -ni igc2 port 50454
      tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
      listening on igc2, link-type EN10MB (Ethernet), snapshot length 262144 bytes
      20:21:17.215574 IP6 2abc:1234:1234:30::2ac4.50454 > 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454: UDP, length 96
      20:21:17.215589 IP6 2abc:1234:1234:30::2ac4.50454 > 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454: UDP, length 96
      20:21:17.233468 IP6 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454 > 2abc:1234:1234:30::2ac4.50454: UDP, length 96
      20:21:17.233699 IP6 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454 > 2abc:1234:1234:30::2ac4.50454: UDP, length 96
      20:21:17.233761 IP6 2abc:1234:1234:30::2ac4.50454 > 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454: UDP, length 96
      20:21:17.233878 IP6 2abc:1234:1234:30::2ac4.50454 > 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454: UDP, length 96
      20:21:27.255462 IP6 2abd:11:5678:5678::e228:6dff:feb9:4ae8.50454 > 2abc:1234:1234:30::2ac4.50454: UDP, length 32
      ^C
      7 packets captured
      621 packets received by filter
      0 packets dropped by kernel
      

      It's a wireguard tunnel I want to limit. No fancy in-tunnel filtering, simply the whole stream would do for me.

      johnpozJ 1 Reply Last reply Reply Quote 0
      • R Offline
        Rockojfonzo @patient0
        last edited by

        @patient0 Hi Thomas, so much effort you put in here. Thank you!

        Yes, log is enabled:
        [2.7.2-RELEASE][admin@fw]/root: more /tmp/rules.debug |grep match
        match log inet6 proto udp from any port 50454 to any ridentifier 1741292534 label "USER_RULE" label "id:1741292534"

        BTW, I also tried matching SMB out on LAN port: Same result, no match possible:

        [2.7.2-RELEASE][admin@fw.]/root: more /tmp/rules.debug | grep match
        match log  on {  igc1  } inet proto tcp  from any port 139 to any ridentifier 1741294762 flags S/SA label "USER_RULE" label "id:1741294762"
        match log  on {  igc1  } inet proto tcp  from any port 445 to any ridentifier 1741295003 flags S/SA label "USER_RULE" label "id:1741295003"
        

        Traffic:

        [2.7.2-RELEASE][admin@fw]/root: tcpdump -ni igc1 port 445 or port 139
        tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
        listening on igc1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
        21:06:49.795443 IP 192.168.11.6.43750 > 192.168.100.100.445: Flags [F.], seq 3855556357, ack 853146708, win 229, options [nop,nop,TS val 1399014346 ecr 112590208], length 0
        21:06:49.795459 IP 192.168.11.6.43752 > 192.168.100.100.445: Flags [S], seq 334166509, win 29200, options [mss 1460,sackOK,TS val 1399014346 ecr 0,nop,wscale 7], length 0
        21:06:49.814822 IP 192.168.100.100.445 > 192.168.11.6.43752: Flags [S.], seq 3542171948, ack 334166510, win 28960, options [mss 1460,sackOK,TS val 112593711 ecr 1399014346,nop,wscale 7], length 0
        21:06:49.814986 IP 192.168.11.6.43752 > 192.168.100.100.445: Flags [.], ack 1, win 229, options [nop,nop,TS val 1399014365 ecr 112593711], length 0
        21:06:49.833525 IP 192.168.100.100.445 > 192.168.11.6.43750: Flags [F.], seq 1, ack 1, win 227, options [nop,nop,TS val 112593711 ecr 1399014346], length 0
        21:06:49.833684 IP 192.168.11.6.43750 > 192.168.100.100.445: Flags [.], ack 2, win 229, options [nop,nop,TS val 1399014384 ecr 112593711], length 0
        

        Zero / Zero
        :-(
        Bildschirmfoto 2025-03-06 um 22.08.36.png

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

          @Rockojfonzo said in Why do no floating rules match?:

          It's a wireguard tunnel I want to limit.

          So the traffic coming from pfsense.. And would be allowed the hidden rule that allows pfsense to go anywhere.. Which would explain why your not seeing any triggers. That is the 2 endpoints of your tunnel I take it

          https://docs.netgate.com/pfsense/en/latest/firewall/pf-ruleset.html

          # let out anything from the firewall host itself and decrypted IPsec traffic
          pass out  inet all keep state allow-opts ridentifier 1000015165 label "let out anything IPv4 from firewall host itself"
          pass out  inet6 all keep state allow-opts ridentifier 1000015166 label "let out anything IPv6 from firewall host itself"
          

          As to your smb rules - where are those rules? In floating? The only stuff I could that could possible match is that 100.100.445 to 11.6.43752 syn,ack [S.]

          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 25.07.1 | Lab VMs 2.8.1, 25.07.1

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            Rockojfonzo @johnpoz
            last edited by

            @johnpoz Ah, ok, I thought, because I can see it in tcpdump I could also match it with a rule. Bummer.

            Yes, that rules are again the only ones in floating, direction "any" for testing purposes.
            I'd also think they should be matching 100.100.445 to 11.6.43752 syn,ack [S.]
            But again no luck.

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

              @Rockojfonzo where are those 2 networks at exactly connected to pfsense?

              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 25.07.1 | Lab VMs 2.8.1, 25.07.1

              R 1 Reply Last reply Reply Quote 0
              • R Offline
                Rockojfonzo @johnpoz
                last edited by Rockojfonzo

                @johnpoz 192.168.100.0 is the remote side of the Wireguard tunnel (tun_wg0 so to say), 192.168.11.0 is on LAN (igc1)

                I can match to destination 192.168.100.100:445 on LAN (which is "in" on LAN, out to Wireguard), but I need to limit (and therefore match) the packets that go out on LAN.

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

                  @Rockojfonzo I for sure do not know enough about how/where the firewall ties into the wireguard interface, etc.

                  Might be better to bring this up in the wireguard section.. On how to set limiters on this.. This seems like more related to that than actual firewall where packets enter and leave a physical interface or vlan.

                  Same could be related to say an ipsec or openvpn tunnel.. I have never tried tried or wanted to set a limit on such a connection. I have put some firewall rules on the openvpn interface - but never tried to match traffic so I could limit, etc. Maybe its just not possible, or need to do it a different way then match in a firewall rule?

                  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 25.07.1 | Lab VMs 2.8.1, 25.07.1

                  1 Reply Last reply Reply Quote 0
                  • patient0P Offline
                    patient0 @Rockojfonzo
                    last edited by

                    @Rockojfonzo No worries, wouldn't do if I'm not interested. And I can't let go :) ... a SysAdmin thing, no sure.

                    After replacing the UPD simple-server with a Wireguard tunnel I observe the same as you, nothing gets logged.

                    Even if I enable logging for the default 'Wireguard' interface - in the firewall rules - allow-all-ip6 generic rule. The rules works and I can ping the pfSense from outside with it but it does not get logged. Not sure if that's a bug a limitation.

                    I guess @johnpoz suggestion makes sense to ask it in the wireguard section.

                    R 1 Reply Last reply Reply Quote 0
                    • R Offline
                      Rockojfonzo @patient0
                      last edited by

                      @patient0 Yeah, I read a lot about traffic shaping and VPN in the last days. That's why I didn't dream about doing something in the tunnel. But at least on the WAN interface or the (to my understanding) "de-VPNed" packets on the LAN interface should be "loggable".

                      However, thank you guys for all your energy and insights. I'll head over to the wireguard section and nag people there. ;-)
                      AND I will set up a similar thing on a pristine sophos xg that sits here and waits for installation. Let's see if it's worth the money. >:-)

                      1 Reply Last reply Reply Quote 0
                      • R Rockojfonzo referenced this topic on
                      • R Offline
                        Rockojfonzo
                        last edited by

                        Last notice on this: I built a setup with a Sophos XGS which doesn't support wireguard but IPsec. There I could track traffic (but only on non-floating rules!) without any problems, matching on addresses and/or ports.
                        So it seems to be only wireguard-related.

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