Ubuntu 16.04
Sponsored Link

Squid + SquidGuard2016/06/12

 
Configure SquidGuard which is the URL redirector to use blacklists.
[1] Install and Configure SquidGuard.
root@prox:~#
apt-get -y install squidguard
root@prox:~#
mv /etc/squidguard/squidGuard.conf /etc/squidguard/squidGuard.conf.bk

root@prox:~#
vi /etc/squidguard/squidGuard.conf
# create new ( simply settings as an example )

dbhome /var/lib/squidguard/db
logdir /var/log/squidguard
dest deny {
   
# define 'deny' category for prohibited domain

    domainlist deny/domains
   
# define 'deny' category for prohibited URL

    urllist deny/urls
}
acl {
    default {
       
# permit all except 'deny' category

        pass !deny all
       
# the redirected URL if matchs 'deny'

        redirect http://www.srv.world/error.html
    }
}
root@prox:~#
mkdir /var/lib/squidguard/db/deny

root@prox:~#
vi /var/lib/squidguard/db/deny/domains
# write domains you'd like to prohibit to access

yahoo.co.jp
example.com
root@prox:~#
vi /var/lib/squidguard/db/deny/urls
# write URLs you'd like to prohibit to access

www.yahoo.co.jp/deny/
www.example.com/
root@prox:~#
squidGuard -C all

root@prox:~#
chown -R proxy. /var/lib/squidguard /var/log/squidguard
root@prox:~#
vi /etc/squid/squid.conf
# line 4395: add

url_rewrite_program /usr/bin/squidGuard
root@prox:~#
systemctl restart squid
[2] Try to access to the URL you set as prohibited domains in [1].
Matched Content