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

    Safari in Iphone is bypassing FIrewall rule

    Scheduled Pinned Locked Moved DHCP and DNS
    23 Posts 5 Posters 1.4k 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.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator @Gertjan
      last edited by

      @Gertjan said in Safari in Iphone is bypassing FIrewall rule:

      Never saw it doing this

      Turn on private relay, and see what happens ;)

      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
      • U
        Uglybrian
        last edited by

        Screenshot from 2025-01-29 06-50-08.png

        M 1 Reply Last reply Reply Quote 0
        • M
          mozmail @bmeeks
          last edited by

          @bmeeks Thank you very much for taking time to explain it.

          my FW rules.

          Allow - rule1
          protocol: TCP
          source : LAN net
          Destination: IP URL Table (https://adamnetworks.dev/pub/fwaliases/raw/master/ips/whatsapp.txt) this list have all the list of IPs from the Meta website for accessing whatsAPP (https://developers.facebook.com/docs/whatsapp/guides/network-requirements/)
          From (Port): 443/5222
          To (Port): 443/5222

          Allow- rule2
          protocol: UDP
          source : LAN net
          Destination: Network or FQDN: 31.0.0.0 / 8(Facebook_IPv4_STUN)
          From (Port): STUN (3478)
          To (Port): STUN (3478)

          Allow-rule3
          protocol: TCP/UDP
          Source: LAN Net
          Destination: DNS IP(8.8.8.8)
          From (Port): 443/5222
          To (Port): 443/5222

          Deny rule1
          Any any any any

          @bmeeks said in Safari in Iphone is bypassing FIrewall rule:

          Have you tested when 8.8.8.8 is unblocked that your Andoid devices are still restricted to only WhatsApp? I'm thinking they will have free reign on the web as well if 8.8.8.8 is available for DNS lookups and TCP port 443 is open

          yes we tested it couple of times - when the DNS IP is allowed in android phone only whatsApp works other browsers is not working no other application is working - I think because in the allow rule the Destination IPs I am allowing is only whatsapp related IPs + DNS IP so even though some aplication get it resolved they cant passtraffic because that IP is not in allow list ? thats my understanding

          1 Reply Last reply Reply Quote 0
          • M
            mozmail @johnpoz
            last edited by

            @johnpoz plz see my new post reply I added my FW rule, which I am allowing only the destination IP address only related IP address which is provided by Facebook https://developers.facebook.com/docs/whatsapp/guides/network-requirements/.

            I am denying all other IP address destinations.

            GertjanG 1 Reply Last reply Reply Quote 0
            • M
              mozmail @Uglybrian
              last edited by

              @Uglybrian so if I add new deny rule of adding all the doh address mentioned in the pic, will the safari accessing the internet will be blocked ?

              bmeeksB 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @mozmail
                last edited by

                @mozmail said in Safari in Iphone is bypassing FIrewall rule:

                IP address which is provided by Facebook https://developers.facebook.com/docs/whatsapp/guides/network-requirements/.

                Totally not up to date.
                And facebook switched to IPv6... also missing.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                johnpozJ 1 Reply Last reply Reply Quote 0
                • bmeeksB
                  bmeeks @mozmail
                  last edited by bmeeks

                  @mozmail said in Safari in Iphone is bypassing FIrewall rule:

                  @Uglybrian so if I add new deny rule of adding all the doh address mentioned in the pic, will the safari accessing the internet will be blocked ?

                  Well, maybe, but possibly not. As others mentioned, the IP addresses of the DoH servers can change. And some of the services are tied to CDNs that you have to enable to let other stuff work. Apple would be one for instance. If you block everything Apple, then iPhones can't get updates and certain Apple iOS stuff will not work. But allowing the Apple IP subnet blocks then lets the DoH traffic to Apple's servers get through.

                  I guess my ultimate question here would be "why do you want to restrict them to only WhatsApp?" As you are discovering, such specific filtering in today's Internet environment with so many CDNs and Anycast DNS services is becoming very difficult and heading towards impossible as DoH and QUIC become widespread 🙂.

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

                    @Gertjan said in Safari in Iphone is bypassing FIrewall rule:

                    And facebook switched to IPv6... also missing.

                    Missing how.. Just because they enabled IPv6 doesn't mean any of those fqdn changed. And changed implies IPv4 is no longer available - which is just not true. You mean they enabled IPv6

                    If OP is running IPv6 then sure that would have to be taken into account when blocking IPs/Ports as well.. But if he isn't then means nothing if they have it enabled or not.

                    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
                    • U
                      Uglybrian
                      last edited by Uglybrian

                      Private relay on Apple is a setting per each individual Wi-Fi network you connect to. For instance, for my home network wi-Fi settings I have private Wi-Fi addresses off and limit IP address tracking off. With these settings, my iPhone uses my local DNS,able to still get mail, messages, and filtering through PF blocker. On other Wi-Fi networks I joined private relay is turn on.

                      You can tell the people on campus with iPhone that if they want to use The campus Wi-Fi network these are the settings you need to employ with our network. Turn off private Wi-Fi addresses and limit IP tracking. This will not affect other Wi-Fi networks they use.

                      PF blocker has a DNBL safe search that you can utilize to block Apple iCloud private relay. There are also of course IP block list for Doh.
                      I use one from github/crypt0rr/public-doh-servers.

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        mozmail @bmeeks
                        last edited by

                        @bmeeks FW_PFSense_Rule.png PFSense_rule.png

                        After moving the DHCP server from the distribution switch to the pfSense box for my LAN network, we noticed that Safari traffic is completely blocked on all devices., WhatsApp voice and video calls work perfectly on both iPhone and Android.

                        The problem arises when users try to send or receive images via WhatsApp on iPhones. It takes more than an hour to send or download a picture, even though they can see the picture notification immediately. Strangely, other features like screen sharing during video calls work just fine.

                        I have attached the current pfSense LAN firewall rule for reference. Any ideas on what could be causing this or how to fix it?

                        Note: When I checked the WhatsApp URL IP list initially, it had 5 IP ranges dedicated to Apple, so I created a separate allow list named Icloude to see which one gets hit.

                        1 Reply Last reply Reply Quote 0
                        • M
                          mozmail @Uglybrian
                          last edited by

                          @Uglybrian

                          @Uglybrian said in Safari in Iphone is bypassing FIrewall rule:

                          You can tell the people on campus with iPhone that if they want to use The campus Wi-Fi network these are the settings you need to employ with our network. Turn off private Wi-Fi addresses and limit IP tracking. This will not affect other Wi-Fi networks they use

                          how to confirm that they turned off private wifi addresses and limit IP tracking ?

                          I can able to block the safari traffic after moving the DHCP server from the switch to the Netgate PFsense box. now only whatsapp works in iPhone and Android phones - but new issue is that Iphone uses when ever they try to send/receive pics it takes couple of hours - tested voice video call it works without any delay

                          1 Reply Last reply Reply Quote 0
                          • M
                            mozmail @bmeeks
                            last edited by

                            @bmeeks

                            @bmeeks said in Safari in Iphone is bypassing FIrewall rule:

                            I guess my ultimate question here would be "why do you want to restrict them to only WhatsApp?" As you are discovering, such specific filtering in today's Internet environment with so many CDNs and Anycast DNS services is becoming very difficult and heading towards impossible as DoH and QUIC become widespread

                            n Palo Alto and Cisco devices, it's easy to block traffic on an application-specific basis. I’m trying to achieve the same with a pfSense box. For example, on flights, only messaging apps are allowed, and all other internet traffic is blocked—so this use case and implementation already exist in the market. I’m now looking for a way to implement similar application-based blocking using pfSense. Any suggestions on how to do this?

                            I’ve almost managed to get application-based blocking working on the pfSense box

                            bmeeksB 1 Reply Last reply Reply Quote 0
                            • bmeeksB
                              bmeeks @mozmail
                              last edited by bmeeks

                              @mozmail said in Safari in Iphone is bypassing FIrewall rule:

                              @bmeeks

                              @bmeeks said in Safari in Iphone is bypassing FIrewall rule:

                              I guess my ultimate question here would be "why do you want to restrict them to only WhatsApp?" As you are discovering, such specific filtering in today's Internet environment with so many CDNs and Anycast DNS services is becoming very difficult and heading towards impossible as DoH and QUIC become widespread

                              n Palo Alto and Cisco devices, it's easy to block traffic on an application-specific basis. I’m trying to achieve the same with a pfSense box. For example, on flights, only messaging apps are allowed, and all other internet traffic is blocked—so this use case and implementation already exist in the market. I’m now looking for a way to implement similar application-based blocking using pfSense. Any suggestions on how to do this?

                              I’ve almost managed to get application-based blocking working on the pfSense box

                              Those Palo Alto and Cisco devices have specific application detection technology built into them. That's also why they cost a ton of money to own and license 🙂. You pay for the priviledge of using that technology and for the labor and time of Palo Alto and Cisco security analysts to keep up with all the application technology changes and issue regular updates to keep the app detection/filtering working. pfSense does not natively offer application layer filtering, but it's also open source and free -- so there is that advantage.

                              You can do this application detection and filtering on a limited basis, providing your are able and willing to write some of your own rules, with the Snort package on pfSense using its AppID feature.

                              M 1 Reply Last reply Reply Quote 1
                              • M
                                mozmail @bmeeks
                                last edited by

                                @bmeeks I agree, due to budget we are going with PFsense and that's why checking the best to do with it, I got it working for now. with my above rule list and extra, I added to block the traffic to DNS IP 1.1.1.1 for port 853, from what I see Safari is using DNS over TLS port 853, with that blocked safari is blocked

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