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

    Squid error - access denied

    Scheduled Pinned Locked Moved pfSense Packages
    22 Posts 8 Posters 18.2k 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.
    • G
      gbelanger
      last edited by

      Here is my solution to this :

      in /usr/local/pkg/squid.inc at line 80

      function squid_is_valid_acl($acl) {
              global $valid_acls;
              if(!is_array($valid_acls))
                      return;
              //if(!is_array($acl))
              //return;
              return in_array($acl, $valid_acls);
      }

      Comment out the lines in red (as shown). The squid_is_valid_acl is called by array_filter, which compares each items (in this case, strings) with an array (in this case $valid_acls). So, returning prematurely when $acl is NOT an array means that this function will not allow the creation of the proper allow rules.

      After making this change, just edit something in the squid configuration from the web interface and save, this will re-generate the squid.conf file properly.

      Hope this helps!

      Guillaume

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

        That fix looks right, I commited the actual removal of the logic vs commenting out of it :)  Re-install the squid package and you should see the updated code.  Thanks

        pfSense core developer
        blog - http://www.ucsecurity.com/
        twitter - billmarquette

        1 Reply Last reply Reply Quote 0
        • G
          gbelanger
          last edited by

          There seems to be a problem when trying to set an empty Allowed Subnets fields (in the Access Control tab) :

          The following input errors were detected:

          • '' is not a valid CIDR range

          I find that changing line 222 (thats line 222 after the new fix) to this :

          
          if (!empty($subnet) && !is_subnet($subnet))
          
          

          Fixes the issue. Its now possible to leave the Allow Subnets field empty and just use the 'Allow users on interface' checkbox.

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

            Thanks…this fix is now commited (line 220 btw ;))

            --Bill

            pfSense core developer
            blog - http://www.ucsecurity.com/
            twitter - billmarquette

            1 Reply Last reply Reply Quote 0
            • T
              trendchiller
              last edited by

              Just found another error with access control…

              Squid uses the access allow / deny rules in the given order...

              so it should read:

              http_access allow unrestricted_hosts
              http_access deny blacklist
              http_access allow localnet
              http_access allow allowed_subnets
              http_access deny all

              in squid.cfg and not

              http_access allow localnet
              http_access deny blacklist
              http_access allow unrestricted_hosts
              http_access allow allowed_subnets
              http_access deny all

              so be so kind to put the line unrestricted hosts first row to fix the problem.
              the second line should then be the blacklist…
              and after that the networks should be mentioned...

              This config runs fine at my system  ;D

              BTW: unrestricted mac should be the line under unrestricted hosts...

              Thanks a lot !

              Martin

              1 Reply Last reply Reply Quote 0
              • T
                trendchiller
                last edited by

                I think it seems to be in lines 586-598 where squid.conf creation has to be reordered…

                1. allow unrestricted_hosts
                2. allow unrestricted_macs
                3. allow whitelist
                4. deny blacklist
                5. allow localnet
                6. allow allowed_subnets
                7. deny all

                so filtering can be done for all hosts and macs, but the unrestricted

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

                  Try it now please.

                  –Bill

                  pfSense core developer
                  blog - http://www.ucsecurity.com/
                  twitter - billmarquette

                  1 Reply Last reply Reply Quote 0
                  • T
                    trendchiller
                    last edited by

                    man, you're really fast  ;)

                    thanks a lot !

                    it's working now as it should !!!

                    1 Reply Last reply Reply Quote 0
                    • G
                      gbelanger
                      last edited by

                      Thats what you did?

                      // Unrestricted hosts take precendence over blacklist
                      if (squid_is_valid_acl('unrestricted_hosts'))
                          $conf .= "http_access allow unrestricted_hosts\n";

                      ?
                      Bill, what about the official package maintainer? Is he temporarily unreachable or is this a stale project? Cause I'd like to add a feature or two =)

                      Guillaume

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

                        @gbelanger:

                        Thats what you did?

                        // Unrestricted hosts take precendence over blacklist
                        if (squid_is_valid_acl('unrestricted_hosts'))
                            $conf .= "http_access allow unrestricted_hosts\n";

                        ?

                        Yep, that and unrestricted_macs…at least now the behavior matches the comments.

                        @gbelanger:

                        Bill, what about the official package maintainer? Is he temporarily unreachable or is this a stale project? Cause I'd like to add a feature or two =)

                        Guillaume

                        Fernando is still around, but has been working on essentially a rewrite of the code (from what I understand) that isn't compatible with our 1.0 release.  If you have updates to the code, I'm more than willing to commit them although I'll caution that I don't completely understand what was written myself, so probably can't answer too many questions.

                        –Bill

                        pfSense core developer
                        blog - http://www.ucsecurity.com/
                        twitter - billmarquette

                        1 Reply Last reply Reply Quote 0
                        • R
                          raggamuffin
                          last edited by

                          Thanks to the code update, Squid is now working for me. I'm still having a problem that I mentioned in an earlier post, though - there doesn't seem to be any logging (the 'package logs' page says that no loggable packages are installed). Am I missing something obvious, or is that where the logs should appear? (And yes, 'enable logging' is ticked on the Squid control panel).

                          1 Reply Last reply Reply Quote 0
                          • G
                            gbelanger
                            last edited by

                            I believe the squid log goes directly into /var/squid/log/access.log. So far, I havent found a good way to access this from the GUI.

                            I'm guessing the squid package rewrite will handle this. Maybe you can just hit

                            [#] tail -n50 /var/squid/log/access.log

                            from the command interface in the meantime? =P

                            That works for me, except the very large lines escape the DIV layer, that should be set to scoll.

                            -G

                            1 Reply Last reply Reply Quote 0
                            • H
                              hoba
                              last edited by

                              hint: diagnostics>edit file or diagnostics>command, download file? ;-)

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