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

    Squid + SquidGuard not reliable

    Scheduled Pinned Locked Moved Cache/Proxy
    22 Posts 6 Posters 2.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.
    • M
      MrIT
      last edited by

      Hello everyone,

      we are running a Netgate 7100 with the latest 22.05 version of pfSense+ at our school. We are deploying multiple wifi networks (faculty, students, guests). Our Netgate device manages their respective VLAN networks. During the school day, approx. 500 devices are connected accross all wifi networks.

      To ensure unappropriate content is blocked, we are using Squid and Squidguard, which Squid running in transparent mode on all wifi networks (we also deploy WPAD but not all devices seem to support it properly).

      In the past weeks, I notices the following things:

      • Although Squid is running, transparent mode does not seem to work. When I manually set the proxy, all traffic is handled properly by Squid. It seems that pfSense seens to loose some kind of redirect rule for the transparent mode?
      • Today I notices that SquidGuard seemed to hung up. The GUI showed that it is running, but every device received a CONNECTION_RESET error when navigating to any website. After clicking "Apply" SquidGuard worked fine (a restart of Squid did not work).

      Did anyone else notices this kind of behavior? In the first half of the year we were running the same setup (but with 22.01) and we haven't had any issues at all.

      Regards
      Marcel

      perikoP 1 Reply Last reply Reply Quote 0
      • perikoP
        periko @MrIT
        last edited by

        @mrit hello, have u check Squid/SG logs?

        Did u change SG settings? by default it handles 16 simultaneous connections, with the amount of users, there u can have a issue.

        Important to watch your logs first...

        Regards!!!

        Necesitan Soporte de Pfsense en México?/Need Pfsense Support in Mexico?
        www.bajaopensolutions.com
        https://www.facebook.com/BajaOpenSolutions
        Quieres aprender PfSense, visita mi canal de youtube:
        https://www.youtube.com/c/PedroMorenoBOS

        C M 2 Replies Last reply Reply Quote 0
        • C
          CZvacko @periko
          last edited by CZvacko

          @periko Right, need adjust SquidGuard - Service options - Rewrite process (all 3 values)

          1 Reply Last reply Reply Quote 0
          • M
            MrIT @periko
            last edited by

            @periko I will try to increase the number of simultaneos connections.

            But I think, I will spawn another pfSense instance as a virtual machine with much more power than our Netgate 7100 applicance.

            JonathanLeeJ M 2 Replies Last reply Reply Quote 1
            • JonathanLeeJ
              JonathanLee @MrIT
              last edited by JonathanLee

              @mrit there is settings on Squidguard and Squid you need to increase.

              Screen Shot 2022-10-11 at 11.08.37 PM.png
              (Image: Squid Proxy Location)

              Screen Shot 2022-10-11 at 11.11.13 PM.png
              (Image: Squidguard location)

              Make sure to upvote

              1 Reply Last reply Reply Quote 0
              • B
                blucenasilva
                last edited by

                Bom dia, na empresa que trabalho tenho cenário parecido com o seu, na verdade se você utilizar squid + squidguard e pretende restringir https em modo transparent com wpad apontando automaticamente o endereço e porta do proxy funciona muito bem com computadores mais smartphones e tablets android e iphones e ipads que usam ios não usam proxy portanto seu trafego https vai passar por fora do proxy e as regras de bloqueio não funcionaram.

                Neste cenário o ideal é não usar proxy transparente e fazer com que os dispositivos funcionem nos roteadores wifi com apontamento do proxy, quem tentar passar por fora dele não conseguirá navegar.

                Outro ponto é que as vezes dessa forma alguns serviços que usam https podem não funcionar adequadamente sendo necessário testar outros cenários para uma solução definitiva do problema.

                JonathanLeeJ 1 Reply Last reply Reply Quote 0
                • M
                  michmoor LAYER 8 Rebel Alliance @MrIT
                  last edited by

                  @mrit I still want to know what the logs show

                  Firewall: NetGate,Palo Alto-VM,Juniper SRX
                  Routing: Juniper, Arista, Cisco
                  Switching: Juniper, Arista, Cisco
                  Wireless: Unifi, Aruba IAP
                  JNCIP,CCNP Enterprise

                  M 1 Reply Last reply Reply Quote 0
                  • JonathanLeeJ
                    JonathanLee @blucenasilva
                    last edited by

                    @blucenasilva said in Squid + SquidGuard not reliable:

                    Bom dia, na empresa que trabalho tenho cenário parecido com o seu, na verdade se você utilizar squid + squidguard e pretende restringir https em modo transparent com wpad apontando automaticamente o endereço e porta do proxy funciona muito bem com computadores mais smartphones e tablets android e iphones e ipads que usam ios não usam proxy portanto seu trafego https vai passar por fora do proxy e as regras de bloqueio não funcionaram.

                    Neste cenário o ideal é não usar proxy transparente e fazer com que os dispositivos funcionem nos roteadores wifi com apontamento do proxy, quem tentar passar por fora dele não conseguirá navegar.

                    Outro ponto é que as vezes dessa forma alguns serviços que usam https podem não funcionar adequadamente sendo necessário testar outros cenários para uma solução definitiva do problema.
                    Translate:
                    automatically the address and port of the proxy works very well with computers plus android smartphones and tablets and iphones and ipads that use ios do not use a proxy so your https traffic will pass outside the proxy and the blocking rules will not work.

                    In this scenario, the ideal is not to use a transparent proxy and make the devices work on wifi routers with proxy pointing, anyone who tries to bypass it will not be able to navigate.

                    Another point is that sometimes, in this way, some services that use https may not work properly, and it is necessary to test other scenarios for a definitive solution to the problem.

                    WPAD use resolves all non proxy systems, it will automatically assign the proxy, also use of NAT will fix any issues with bypassing traffic. NTP nat use to the proxy is a good example. I will add screenshots later

                    Make sure to upvote

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      michmoor LAYER 8 Rebel Alliance @JonathanLee
                      last edited by

                      @jonathanlee Anyone got a working WPAD script? I would like to toy around with this and see how scalable it is.

                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                      Routing: Juniper, Arista, Cisco
                      Switching: Juniper, Arista, Cisco
                      Wireless: Unifi, Aruba IAP
                      JNCIP,CCNP Enterprise

                      JonathanLeeJ 2 Replies Last reply Reply Quote 0
                      • M
                        MrIT @michmoor
                        last edited by

                        Sorry for the late update: So I just created a virtual machine (Hyper-V, 6 Cores, 4 GB RAM) which purpose is to host Squid+SquidGuard. Turns out: I haven't had any issues at all with the transparent proxy.

                        I also tweaked some settings, but I have no clue if that helps with our performance (performance seems to be fine now):

                        • Squid -> SSL Certificate Deamon Children -> 10
                        • SquidGuard -> Rewrite process children -> 32
                        • SquidGuard -> Rewrite process children startup -> 16
                        • SquidGuard -> Rewrite process children idle -> 4

                        @michmoor Sorry, I cannot provide any logs because it seems to work fine now and Squid/SquidGuard was removed from the original pfSense (bare metal) instance.

                        @michmore I configure WPAD using DHCP, which seems to work with Windows and iOS users (Android does not seem to be able to use DHCP for WPAD*).

                        825f859b-7edc-40da-8d48-cf57e56dd880-image.png

                        The address points to a local web service in our DMZ. This is my WPAD:

                        function FindProxyForURL(url,host) {
                            # Important so protocols like FTP do not connect through Squid
                            if(!url.startsWith("http:") && !url.startsWith("https:")) {
                                return "DIRECT";
                            }
                        
                            # This is used so apps like Spotify work which seem to make
                            # outgoing connections on port 443, but TCP (no HTTPS)
                            if(shExpMatch(url, "*://" + host + ":*")) {
                                return "DIRECT";
                            }
                        
                            var resolved_ip = dnsResolve(host);
                        
                            # If resolved IP address is local, connect directly
                            if(isPlainHostName(host) || isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") || isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") || isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") || isInNet(resolved_ip, "127.0.0.0", "255.255.255.0")) {
                                 return "DIRECT";
                            }
                        
                            # Connect through Squid (or directly if Squid is not available)
                            return "PROXY 10.XX.XX.XX:3128;DIRECT";
                        }
                        

                        Regards

                        (*) I cannot verify this as of now. That's a memory from few months ago when I configured and tested WPAD.

                        1 Reply Last reply Reply Quote 1
                        • B
                          blucenasilva
                          last edited by

                          @jonathanlee

                          GNU nano 5.9 /usr/local/www/wpad.dat
                          function FindProxyForURL(url,host)
                          {
                          return "PROXY 192.168.240.1:3128";
                          }

                          1 Reply Last reply Reply Quote 1
                          • M
                            MrIT
                            last edited by

                            Just found out today: You can test WPAD when using Microsoft Edge (I suppose Chrome works as well?!) on Windows. If deployed and configured successfully, the you can open developer tools and switch to the "Network" tab. On all requests you'll see the proxy's IP adress as remote address for any website.

                            1 Reply Last reply Reply Quote 0
                            • JonathanLeeJ
                              JonathanLee @michmoor
                              last edited by

                              @michmoor I have one i will share when I get home it's simple.

                              Make sure to upvote

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                michmoor LAYER 8 Rebel Alliance @JonathanLee
                                last edited by

                                @jonathanlee said in Squid + SquidGuard not reliable:

                                @michmoor I have one i will share when I get home it's simple.

                                Thanks!
                                Do you use a separate web server?

                                Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                Routing: Juniper, Arista, Cisco
                                Switching: Juniper, Arista, Cisco
                                Wireless: Unifi, Aruba IAP
                                JNCIP,CCNP Enterprise

                                JonathanLeeJ 1 Reply Last reply Reply Quote 0
                                • JonathanLeeJ
                                  JonathanLee @michmoor
                                  last edited by

                                  @michmoor no my WPAD script is inside the firewall. I followed the Netgate website for reference.

                                  Make sure to upvote

                                  1 Reply Last reply Reply Quote 0
                                  • JonathanLeeJ
                                    JonathanLee @michmoor
                                    last edited by JonathanLee

                                    @michmoor

                                    d22b6636-d327-4e55-a952-70b193be53b2-image.png

                                    (Image: files named wpad.da, wpad.dat, and proxy.pac are locally stored they are all part of wpad and contain the same script)

                                    b49df71d-618c-42c1-ba34-8bddbbf2c716-image.png

                                    (Image: Create and save text files as wpad.da, wpad.dat and proxy.pac)

                                    ec3e625b-a58c-4e01-a88a-4d55770d3b91-image.png

                                    (Image: Save all the WPAD files into path usr local www, this is so when any time port 80 is accessed it tells the system to use proxy)

                                    b3e4b1fc-2c66-4427-985a-1ea590bb9087-image.png

                                    (Image: All files should contain the following inside the text files wpad.da wpad.dat and proxy.pac this is the script)

                                    5eaa776e-568e-48e4-8eb8-7c93c94ec14c-image.png

                                    (Image: You must also add a DNS resolver for the name of the firewall mine is home arpa to link in the ip address of the firewall mine is 192 168
                                    1 1)

                                    a1a1ad37-3163-42f1-801d-8b69ce4ac03d-image.png
                                    (Image: DNS resolve after adding)

                                    ad3cd0de-c402-4141-95a3-94518c649885-image.png

                                    (Image: You must also create an ACL for the wpad anything that hits port 80 will auto configure to the port of the proxy. For me I have a lan group that is all of my devices on my lan Lan_group * any destination the firewall)

                                    537e6d5a-e79c-4325-9b52-c88130c3b851-image.png
                                    (Image: ACL "Access Control Close line up")

                                    022054d0-4af6-4561-8c46-22e65e5c1467-image.png
                                    (NAT)

                                    97ce06fc-38d4-43cb-88c3-b29630301196-image.png
                                    (ACL with port specific and mail server specific rules)
                                    5cec6acd-632c-4284-9e01-6b6074a21b28-image.png
                                    (Image: Alias used for mail acl)

                                    (Last three images explained: Manual NAT mine firewall approves mail and Xbox ports they are IP address specific; my mail ports also are blocked from accessing anything but the current dns resolved mail lists. remember recently when the FBI website had their mail server hacked and it was redirecting this is my idea of what a firewall could do to stop that type of hack)

                                    So if you really want to go crazy you can make manual entries for the NAT to be port specific also. Or just leave it auto configure.

                                    d7cbb98b-2568-4b7c-bb46-3121c812f233-image.png

                                    (Image: Squidguard Rules, make sure you add the loopback into the group acl and let it have access to redirectors as it redirects ports and needs to be able to do its job without Squidguard mistaking it.)

                                    5c76ce16-9e5a-4f43-a2e5-4834b285bc89-image.png

                                    (Image: Squid proxy SSL certificate issue, mark you do not validate if you want to use the Clam AV splash screens and you use an SSL certificate that was created with Squid and not the firewall.) This creates problems as the SSL is checked like a normal website so it will normally block the splash screen for some reason)

                                    601b8e0f-b1b8-4cf3-aff8-c2364889ba75-image.png

                                    (Image: Squid Proxy My Custom options, add your custom splice only rules I have Xbox, Amazon, Iphone) This means it will not SSL intercept only look at the get requests and headers for specific websites or devices, Amazon tablet if you have it to SSL intercept it will only work with the Silk browers for example, it needs splice to work with all the applications)

                                    d7e53063-6c50-4821-91dc-8e0455c85971-image.png

                                    (Image: Make a locally stored no bump text file for really picky websites, as well as ethical needs like banks and private messages. We are only looking for viruses and websites we do not use normally. By need only. Must use regex)

                                    856725e8-689a-455f-a3c9-231d2daf7459-image.png

                                    (Image: Now you can see Everything is working now and blocking viruses from Google cloud, SSL intercept and Splice at the same time)

                                    d0a037f8-ed5e-46fe-9493-b76d5e05d944-image.png

                                    (Image: Squid Proxy make sure you add the loopback into what can access the proxy, as the loopback needs to access clam av)

                                    a659e07f-e237-4ff4-a2fd-64ec53e33971-image.png
                                    (Image: Now my firewall runs the show, it protects everything the way it should. Notice the common name is my name, meaning the certificate for this ssl intercept is processed by the firewall)

                                    c192e5a3-39aa-43fe-8fa3-4f34f4386735-image.png
                                    (Image: Squid guard running like a champ and it can do url filtering on everything and virus checking on the URLS we do not normally see. notice https blocks)

                                    2eb9763b-1c83-4d84-bd6e-c9d54f63e5e0-image.png
                                    (Image: NAT port forwarding, make sure you use port forwarding for DNS and NTP so the firewall cannot be bypassed with a different DNS)

                                    687a0eb1-58e4-460d-9896-bb22ba92366c-image.png
                                    (Image: SSL Intercept and Splice working. So, when you need to bump SSL it works when you need to splice it does that. Best of both worlds.)

                                    PfSense and this community support team can make it work, just don't give up. Keep reading into it, you can even use the TAC support if you want to make a support ticket

                                    Make sure to upvote

                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      michmoor LAYER 8 Rebel Alliance @JonathanLee
                                      last edited by

                                      @jonathanlee wow....Bravo..You got a great functioning Proxy there. Incredible. 1.For custom options, where did you get the syntax?
                                      2.Where did you get the sites that should be spliced(ignored)?
                                      3. Your certificate is loaded on client devices but what do you do with IoT?

                                      Seriously you did a great job here.

                                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                      Routing: Juniper, Arista, Cisco
                                      Switching: Juniper, Arista, Cisco
                                      Wireless: Unifi, Aruba IAP
                                      JNCIP,CCNP Enterprise

                                      JonathanLeeJ 1 Reply Last reply Reply Quote 0
                                      • JonathanLeeJ
                                        JonathanLee @michmoor
                                        last edited by JonathanLee

                                        @michmoor

                                        1. The custom options are from the Squid website and the regex is used. Some was nice enough to share their no bump file with me, so I made my own with all my own websites that I need to not bump. I think Squid content accelerator software runs a large amount of the internet. I would love to learn more about it. let me know if you have any tips for me.
                                        2. Every device I own have a certificate installed on them for this to work. Xbox does not have a certificate only uses WPAD that was the most confusing one for me. I only wanted to filter http get requests to block specific web URLS with that and it works.

                                        Make sure to upvote

                                        M 1 Reply Last reply Reply Quote 0
                                        • M
                                          michmoor LAYER 8 Rebel Alliance @JonathanLee
                                          last edited by

                                          @jonathanlee I really would like to keep in touch with you. This was a great write up you gave here. The documentation is a bit sparse in getting the interception to work but your screenshots are solid.

                                          Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                          Routing: Juniper, Arista, Cisco
                                          Switching: Juniper, Arista, Cisco
                                          Wireless: Unifi, Aruba IAP
                                          JNCIP,CCNP Enterprise

                                          JonathanLeeJ 2 Replies Last reply Reply Quote 1
                                          • JonathanLeeJ
                                            JonathanLee @michmoor
                                            last edited by

                                            @michmoor thanks, it's amazing, I wish I understood more about the code. I did purchase an official version of the Netgate firewall. So, this was not the free version.

                                            Make sure to upvote

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