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

    Custom SquidGuard Error Pages - How to???

    Scheduled Pinned Locked Moved pfSense Packages
    27 Posts 10 Posters 102.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.
    • N
      nutt318
      last edited by

      Anyone having issues of it SquidGuard not redirecting properly?

      For example I have Squid + SquidGuard + LightSquid installed and I cant get the error removed when blocking ads

      I've added 'sgerror.php?url=blank_img' into the redirect info but im still getting the black text in ad spots that say 'ERROR - The requested URL could not be retrieved' along with the url of the ad and saying access denied.

      Anyways, just wondering if there is a way to show a blank img for these ad block errors.

      Thanks.

      1 Reply Last reply Reply Quote 0
      • S
        saxonbeta
        last edited by

        Thanks every one for this how to. I read this thread and I manage to customized the squidguard error page.  nutt318, I also modified the sqidguard.conf file to put a blank image instead of ads. Here is part of my squidguard.conf file

        dest blk_BL_adv {
        	domainlist blk_BL_adv/domains
        	urllist blk_BL_adv/urls
        	redirect http://[PFSENSE_IP]/sgerror.php?url=blank_img
        }
        

        This modification works great for me ;D

        1 Reply Last reply Reply Quote 0
        • N
          nutt318
          last edited by

          Hey Saxonbeta,

          Where did you find the squidguard.conf file at? I've been looking at haven't found it anywhere.

          Thanks

          1 Reply Last reply Reply Quote 0
          • S
            saxonbeta
            last edited by

            It should be in /usr/local/etc/squidGuard/squidGuard.conf. If your are going to directly modified this file, first make all modifications you need to the proxy filter configurations, press SAVE and APPLY and then modify the squidGuard.conf.

            To restart the proxy filter service and load your new configuration go to STATUS>Services, and restart Squid.

            Cheers…

            1 Reply Last reply Reply Quote 0
            • N
              nutt318
              last edited by

              Ok, I've added your code to the squidGuard.conf file and restarted squidGard service. However I'm guessing there is something else I need to do within the configuration page for Squid. Is that correct?

              1 Reply Last reply Reply Quote 0
              • N
                nutt318
                last edited by

                Well now for some reason my squidGuard.conf file looks like this.

                Not sure what happend.

                # ============================================================
                # SquidGuard configuration file
                # This file generated automaticly with SquidGuard configurator
                # (C)2006 Serg Dvoriancev
                # email: dv_serg@mail.ru
                # ============================================================
                
                logdir /var/squidGuard/log
                dbhome /var/db/squidGuard
                
                #
                rew safesearch {
                    s@(google\..*/search?.*q=.*)@\1\&safe=active@i
                    s@(google\..*/images.*q=.*)@\1\&safe=active@i
                    s@(google\..*/groups.*q=.*)@\1\&safe=active@i
                    s@(google\..*/news.*q=.*)@\1\&safe=active@i
                    s@(yandex\..*/yandsearch?.*text=.*)@\1\&fyandex=1@i
                    s@(search\.yahoo\..*/search.*p=.*)@\1\&vm=r&v=1@i
                    s@(search\.live\..*/.*q=.*)@\1\&adlt=strict@i
                    s@(search\.msn\..*/.*q=.*)@\1\&adlt=strict@i
                    s@(\.bing\..*/.*q=.*)@\1\&adlt=strict@i
                }
                
                #
                acl  {
                    #
                    default  {
                        pass !in-addr all
                        redirect http://MYLOCALIP:80/sgerror.php?url=403%20If%20you%20feel%20that%20you%20need%20access%20to%20this%20page%20please%20contact%20Admin%40domain.com&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u
                    }
                }
                
                1 Reply Last reply Reply Quote 0
                • S
                  saxonbeta
                  last edited by

                  Well, if you mess your configuration, you can just press the Save and Apply buttons in the squidguard configuration page. It seems that you enabled the safesearch option (rew safesearch in your config file). In other hand, have you ever updated your blacklist? Because there aren't dest option in your file, here is my squidguard.conf file:

                  
                  # ============================================================
                  # SquidGuard configuration file
                  # This file generated automaticly with SquidGuard configurator
                  # (C)2006 Serg Dvoriancev
                  # email: dv_serg@mail.ru
                  # ============================================================
                  
                  logdir /var/squidGuard/log
                  dbhome /var/db/squidGuard
                  
                  # 
                  dest blk_BL_adv {
                  	domainlist blk_BL_adv/domains
                  	urllist blk_BL_adv/urls
                          redirect http://[pfsense_ip]:81/sgerror.php?url=blank_img
                  }
                  
                  # 
                  dest blk_BL_aggressive {
                  	domainlist blk_BL_aggressive/domains
                  	urllist blk_BL_aggressive/urls
                  }
                  
                  # 
                  dest blk_BL_alcohol {
                  	domainlist blk_BL_alcohol/domains
                  	urllist blk_BL_alcohol/urls
                  }
                  
                  #Several "dest" options....  
                  
                  # 
                  rew safesearch {
                  	s@(google\..*/search?.*q=.*)@\1\&safe=active@i
                  	s@(google\..*/images.*q=.*)@\1\&safe=active@i
                  	s@(google\..*/groups.*q=.*)@\1\&safe=active@i
                  	s@(google\..*/news.*q=.*)@\1\&safe=active@i
                  	s@(yandex\..*/yandsearch?.*text=.*)@\1\&fyandex=1@i
                  	s@(search\.yahoo\..*/search.*p=.*)@\1\&vm=r&v=1@i
                  	s@(search\.live\..*/.*q=.*)@\1\&adlt=strict@i
                  	s@(search\.msn\..*/.*q=.*)@\1\&adlt=strict@i
                  	s@(\.bing\..*/.*q=.*)@\1\&adlt=strict@i
                  }
                  
                  # 
                  acl  {
                  	# 
                  	default  {
                  		pass !blk_BL_adv all
                  		redirect http://[pfsense_ip]:81/sgerror.php?url=403%20&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u
                  	}
                  }
                  
                  

                  I use the shallalist.de blacklist.

                  1 Reply Last reply Reply Quote 0
                  • JonathanLeeJ JonathanLee referenced this topic on
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.