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

    Firewall rules ignored or overridden?

    Scheduled Pinned Locked Moved Firewalling
    46 Posts 4 Posters 12.3k 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 Offline
      Harvy66
      last edited by

      There only two reason states get closed short of a reboot or someone killing them via PFSense management or custom package. Time out or a packet that tells the connection to end, RST or FIN. It seems the timeout is not the case. I could guess at what the issue is, but I wouldn't want to be wrong.

      1 Reply Last reply Reply Quote 0
      • D Offline
        deadbolt_forum
        last edited by

        After pouring over the logs I can now confirm that it is not just one MUA client or host that is exhibiting this issue.

        Device 1:  OS X 10.12.1 using Thunderbird 45.4.0 for the mail client connecting to several IMAP servers including gmail.
        Device 2:  iOS 10.1.1 using the native Mail application for the client connecting to several IMAP servers including gmail.

        The host OS's are different, the mail clients are different, and the mail servers are different.  The only common denominator for these blocked packets are the pfsense firewall.

        I'm not sure how the packet capture is providing insight into why pfsense is blocking these packets.  I see TCP 993 connections being opened and closed.  But only pfsense knows why it decided to drop some of the packets.  Unfortunately pfsense only logs that the "Default deny rule IPv6" (or IPv4) rule was applied.  That doesn't make it clear why the explicit pass rules for TCP 993 aren't being applied and I'm not sure what I'm looking for in the packet captures to tell me that.  Perhaps there is more aggressive logging that can be enabled?

        As for blaming something outside of pfsense, it seems unlikely now that I have two different devices with the same issue.  If we are saying the issue is not pfsense, then that means that two separate mail servers such as google's gmail and microsoft's office365 both have the same protocol flaw showing up in their TCP sessions.  Or that both Thunderbird and iOS Mail with two different code bases have the same flaw.  Similarly that could mean both OS X and iOS having the same networking flaw, however I will grant that this last theory might be possible since OS X and iOS do share some code.  It is far more likely though that the one firewall filtering all of the traffic for these two stacks has some aggressive setting or edge case bug that is dropping packets.

        Any suggestions are appreciated.

        1 Reply Last reply Reply Quote 0
        • DerelictD Offline
          Derelict LAYER 8 Netgate
          last edited by

          No, only the client and server know why the connection is closed. All the firewall cares about is that the two parties on either side decided to close the connection.

          pfSense is only logging the firewall exceptions because the client and server decided to close the connection then one of them decided to try to pass more traffic over the closed state.

          Packet capture. Who is closing the connection?

          Chattanooga, Tennessee, USA
          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
          Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

            " I see TCP 993 connections being opened and closed."

            Post up this sniff..  As Derelict stated if client or server is sending fin??  Did the other ack with a fin as well.. Fin does not mean the connection has to be closed, it is just stating hey I am done, are you done too?

            You really need to see the sniff of the conversation to figure out what is going on.  If you have conversation being closed and then still trying to talk on it that is a problem.  Because yes when the firewall see's that devices closed their conversation he will remove the state, and until his sees a new conversation with syn, those packets would be out of state and dropped.

            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, 25.07.1

            1 Reply Last reply Reply Quote 0
            • D Offline
              deadbolt_forum
              last edited by

              Okay, I've made some progress but the issue is still not resolved.

              From the pfsense terminal:
              telnet imap.gmail.com 993;  //Successful connection
              telnet imap-mail.outlook.com 993;  //Successful connection
              telnet imap.mail.yahoo.com 993;  //Successful connection
              telent imap.comcast.net 993;  //Successful connection
              telnet imap.aol.com 993;  //Successful connection

              From any workstation:
              telnet imap.gmail.com 993;  //Successful connection
              telnet imap-mail.outlook.com 993;  //Connection fails
              telnet imap.mail.yahoo.com 993;  //Connection fails
              telent imap.comcast.net 993;  //Successful connection
              telnet imap.aol.com 993;  //Connection fails

              For IMAP servers that fail, a packet capture on the LAN shows the following:
              1. Initial Syn packet from the workstation
              2. Followed by a tcp retransmission to the same IMAP server 1sec later
              3. Every 1sec another retransmission occurs

              It looks like pfsense silently drops a packet so the connection never succeeds.  The strange thing is that this doesn't occur for all IMAP servers.

              1 Reply Last reply Reply Quote 0
              • DerelictD Offline
                Derelict LAYER 8 Netgate
                last edited by

                What magical packages like pfblocker, snort, suricata, squid, and squidguard are you running?

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

                  So your saying the packet never goes out the wan?  But you see it on the lan of 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, 25.07.1

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    deadbolt_forum
                    last edited by

                    No relevant packages installed.  Just Status_Traffic_Totals for bandwidth stats.

                    I just performed a packet capture from the WAN interface and I am seeing tcp retransmissions from the IMAP server to m public IP.  It looks like only the SYN packet makes it out.  After that the SYN/ACK gets dropped so both sides keep retransmitting.  The workstation sends SYNs and the IMAP server sends SYN/ACKs.

                    Also, pfsense logs the blocked packet sometimes.  When it does, it is listed as:
                    The rule that triggered this action is:
                    @5(1000000103) block drop in log inet all label "Default deny rule IPv4"

                    My LAN Firewall rule to pass IPv4+6 TCP out to port 993 should implicitly let this traffic back in.  It is letting the SYN out but the implied pass for the SYN/ACK back in is not being respected.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      deadbolt_forum
                      last edited by

                      Note that I did have packages installed in the past however I have since removed them and they reported that the removal was successful.  So unless package removal is totally broken, then there should be no package filtering.  This should be purely a pfsense filtering issue.

                      1 Reply Last reply Reply Quote 0
                      • DerelictD Offline
                        Derelict LAYER 8 Netgate
                        last edited by

                        Get the IP address of the server and while all that is going on, what states do you have in Diagnostics > States?. You can filter on the IMAP server IP address there. That will catch both WAN and LAN states.

                        No, packages removed should be OK.

                        Chattanooga, Tennessee, USA
                        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                        Do Not Chat For Help! NO_WAN_EGRESS(TM)

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          deadbolt_forum
                          last edited by

                          See image.

                          1.png
                          1.png_thumb

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

                            If pfsense does not see the syn,ack back the state would never go into established and would time out in by default 30 seconds.  Then packets after that would be dropped by the default rule because there would be no state.

                            It could be less than 30 sec if you messed with the setting on the firewall..

                            "After that the SYN/ACK gets dropped so both sides keep retransmitting."

                            Gets dropped where?  Your saying you see this syn,ack on your wan sniff??

                            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, 25.07.1

                            1 Reply Last reply Reply Quote 0
                            • DerelictD Offline
                              Derelict LAYER 8 Netgate
                              last edited by

                              Well, there are your firewall states. All looks fine. I didn't look far enough over - you guys and your large screen captures… So what are the exact blocked packets you are seeing on WAN?

                              This all just works. Not sure what you did to break it.

                              If you feel like it do a Diagnostics > Command Prompt and execute cat /tmp/rules.debug and paste the results in a PM.

                              Chattanooga, Tennessee, USA
                              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                              Do Not Chat For Help! NO_WAN_EGRESS(TM)

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                deadbolt_forum
                                last edited by

                                I'm looking through rules.debug and near the top I see entries that concern me.  Specifically the following:
                                #Snort tables
                                table <snort2c>table <virusprot>As I mentioned previously, I initially installed some ports but subsequently removed them and success was reported.  Would successful removal of the relevant ports also remove these artifacts or are these inactive entries in the ruleset which have accumulated from the previous ports but which now have no effect?</virusprot></snort2c>

                                1 Reply Last reply Reply Quote 0
                                • DerelictD Offline
                                  Derelict LAYER 8 Netgate
                                  last edited by

                                  Those are always there. I don't think that's it.

                                  From the PM'd pcap it looks like IPv6 is working and IPv4 is broken. That is probably the difference between the different IMAP servers.

                                  Chattanooga, Tennessee, USA
                                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                  1 Reply Last reply Reply Quote 0
                                  • DerelictD Offline
                                    Derelict LAYER 8 Netgate
                                    last edited by

                                    Yeah. the presence of AAAA records corresponds to the servers you report as working. The ones that fail do not have AAAA records.

                                    So un-do whatever you did for IPv4 and make it look like IPv6 and you should be GTG. :)

                                    Chattanooga, Tennessee, USA
                                    A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                    DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                    Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      deadbolt_forum
                                      last edited by

                                      Not so easy.

                                      Floating Rules:
                                      All rules here are pass or match and unrelated.

                                      WAN Rules:
                                      All rules here are pass except for pfsense's block RFC1918 and block bogons.

                                      LAN Rules:
                                      All rules here are pass except for NETBIOS on my network.
                                      Also, the rule allowing traffic bound for 993 is an IPv4+6 rule so if it is passing v6 traffic then presumably it is passing v4 traffic as well.

                                      Unless there are some other hidden rules then that is everything.

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

                                        Yeah looks like you have ipv6 working, but don't see the start of that conversation.  But looks like all your ipv4 is borked..

                                        Where exactly did you sniff this??  Looks like syn,ack is sent from public to a private.. But no answer??

                                        torfc1918.png
                                        torfc1918.png_thumb

                                        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, 25.07.1

                                        1 Reply Last reply Reply Quote 0
                                        • DerelictD Offline
                                          Derelict LAYER 8 Netgate
                                          last edited by

                                          Not sure what to tell you, man. You screwed the pooch somewhere along the way.

                                          Send your /tmp/rules.debug

                                          Chattanooga, Tennessee, USA
                                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

                                            That is a microsoft IP..  Clearly its sending a syn,ack to private IP address. So that was on the LAN of pfsense??  Where was this sniff taken?

                                            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, 25.07.1

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