CentOS 6
Squid + DansGuardian
2014/08/15
 
Install DansGuardian to configure contents filtering.
[1] Install DansGuardian.
This example based on the proxy settings on Clients with [prox.server.world:8080]. Replace the value to your own environment.
# install from RPMforge

[root@prox ~]#
yum --enablerepo=rpmforge -y install dansguardian
[root@prox ~]#
vi /etc/dansguardian/dansguardian.conf
# line 26: change to your own lang

language = '
japanese
'
# line 88: change it (DansGuardian listens) to the port for Clients

filterport =
8080
# line 94: specify the port which Squid listens

proxyport =
3128
[root@prox ~]#
vi /etc/squid/squid.conf
# line 62: change (same with DansGuardian's setting)

http_port
3128
[root@prox ~]#
/etc/rc.d/init.d/squid restart

Stopping squid: ................             [  OK  ]
Starting squid: .                            [  OK  ]
[root@prox ~]#
/etc/rc.d/init.d/dansguardian start

Starting Web Content Filter (dansguardian):  [  OK  ]
[root@prox ~]#
chkconfig dansguardian on
[2] Configure for filtering.
[root@prox ~]#
vi /etc/dansguardian/lists/bannedsitelist
# specify domain names you'd like to block

yahoo.co.jp
[root@prox ~]#
/etc/rc.d/init.d/dansguardian restart

Shutting down Web Content Filter (dansguardian): [ OK ]
Starting Web Content Filter (dansguardian): [ OK ]
# other lists you can define
bannedextensionlist
⇒ banned edextension

bannediplist
⇒ banned client IP address

bannedmimetypelist
⇒ banned MIME Type

bannedphraselist
⇒ banned phrase

bannedregexpheaderlist
⇒ banned header(regexp)

bannedregexpurllist
⇒ banned URL(regexp)

bannedsitelist
⇒ banned domain

bannedurllist
⇒ banned URL

contentregexplist
⇒ replace contents(regexp)

exceptionextensionlist
⇒ exception extension

exceptionfilesitelist
⇒ exception file domain

exceptionfileurllist
⇒ exception file URL

exceptioniplist
⇒ exception client IP address

exceptionmimetypelist
⇒ exception MIME Type

exceptionphraselist
⇒ exception phrase

exceptionregexpurllist
⇒ exception URL(regexp)

exceptionsitelist
⇒ exception domain

exceptionurllist
⇒ exception URL

filtergroupslist
⇒ filter group

greysitelist
⇒ grey domain

greyurllist
⇒ grey URL

[3] Try to access from ClientPC with Web browser to the URL you configured and make sure it is redirected like follows.
 
Tweet