twitter
    Sigueme en el Twitter :-)

01 junio 2009

Squid + DansGuardian

Hace poco por razones de la vida, tuve que configurar DansGuardian + Squid, ya que me parecia algo curioso y pendiente que tenia, personalmente yo configuro arhivos planos y uso reglas ACL para el bloqueo de Web y accesos, pero quice probar como comente, DansGuardian, y aqui va la receta:

S.O Centos 5.3
1.- Instalamos dansguardian:

yum -y install dansguardian


2.- Instalamos squid:
yum -y install squid squid-common


3.- Nos dirigimos al directorio:
cd /etc/dansguardian


4.- Configuramos el fichero: dansguardian.conf

reportinglevel = 3
languagedir = '/etc/dansguardian/languages'
language = 'ukenglish'
loglevel = 3
logexceptionhits = on
logfileformat = 1
loglocation = '/var/log/dansguardian/access.log'
filterip = 127.0.0.1
filterport = 8181
proxyip = 127.0.0.1
proxyport = 3128
nonstandarddelimiter = on
usecustombannedimage = 1
custombannedimagefile = '/etc/dansguardian/transparent1x1.gif'
filtergroups = 1
filtergroupslist = '/etc/dansguardian/filtergroupslist'
bannediplist = '/etc/dansguardian/bannediplist'
exceptioniplist = '/etc/dansguardian/exceptioniplist'
banneduserlist = '/etc/dansguardian/banneduserlist'
exceptionuserlist = '/etc/dansguardian/exceptionuserlist'
showweightedfound = on
weightedphrasemode = 0
urlcachenumber = 3000
urlcacheage = 900
phrasefiltermode = 2
preservecase = 0
hexdecodecontent = 0
forcequicksearch = 0
reverseaddresslookups = off
reverseclientiplookups = off
createlistcachefiles = on
maxuploadsize = -1
maxcontentfiltersize = 256
usernameidmethodproxyauth = on
usernameidmethodident = off
preemptivebanning = on
forwardedfor = off
usexforwardedfor = off
logconnectionhandlingerrors = on
maxchildren = 120
minchildren = 8
minsparechildren = 4
preforkchildren = 6
maxsparechildren = 32
maxagechildren = 500
ipcfilename = '/tmp/.dguardianipc'
urlipcfilename = '/tmp/.dguardianurlipc'
pidfilename = '/var/run/dansguardian.pid'
nodaemon = off
nologger = off
daemonuser = 'nobody'
daemongroup = 'nobody'
softrestart = off
virusscan = on
virusengine = 'clamav'
tricklelength = 32768
forkscanlength = 32768
firsttrickledelay = 10
followingtrickledelay = 10
maxcontentscansize = 41904304
virusscanexceptions = on
urlcachecleanonly = on
virusscannertimeout = 60
notify = 2 # will notify the admin only
emaildomain = 'tony@tony-server.com'
postmaster = 'admin@tony-server.com'
emailserver = '127.0.0.1:25'
downloaddir = '/tmp/dgvirus'
clmaxfiles = 1500
clmaxreclevel = 3
clmaxfilesize = 10485760
clblockencryptedarchives = off
cldetectbroken = off
#clamdsocket = '127.0.0.1:3310'
accessdeniedaddress = 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl'


En mi caso: filterip,filterport, proxyip y proxyport, son valores importantes para la conexion de DansGuardian con Squid, si van a usar otros puertos, tengan presente los cambios.

5.- Para bloquear algunas webs de prueba, configuramos el archivo:
bannedsitelist, agregamos por ejm. youtube.com, hi5.com, etc (uno debajo de otro y sin WWW)

6.- Ahora nos dirigimos a configurar squid para que se pueda comunicar con Dansguardian:
vi /etc/squid/squid.conf


Agregamos estas lineas:

http_port 3128 transparent
http_port 127.0.0.1:3128
cache_peer 127.0.0.1 parent 8181 3130


7.- Reiniciamos los servicios:
service squid restart
service dansguardian restart

8.- Chekamos los servicios para que se inicien con el reboot del server:

chkconfig squid on
chkconfig dansguardian on


Luego probamos, y veremos que DansGuardian habrá bloqueado la web que hemos puesto en el ejemplo.
Espero que les ayude a investigar mas sobre esta combinación.
saludos

P.D no se olviden revisar el log de squid si tiene problemas

1 comentario:

AudYoeL dijo...

hola como estas,

muy bueno tu ayuda para los que recién empezamos, se puede hacer mas filtros con dansguardian y el squid como el de google gmail y dejar libre el google apps (correo)

Saludos y gracias por todo.