Problème Squid SquidGuard

Bonjour à tous :smt006

J’essaie de mettre en place squid et squidguard en virtuel.

J’ai deux debian 5.00 sur vmware workstation.

Le premier, le serveur avec deux interfaces réseaux :

  • eth0 : NAT (de base dans vmware pour avoir Internet)

  • eth1 : Bridged (vers le réseau local)

IP : 192.168.0.1
Mask : 255.255.255.0

Le deuxième est le client avec une interface réseau :

  • eth0 : Bridged

IP : 192.168.0.2
Mask : 255.255.255.0
Gateway : 192.168.0.1

Les deux machines ont le même DNS.

Sur mon serveur je rajoute une ligne iptables :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Pour autoriser le NAT.

Puis j’autorise le partage de la connexion :

echo 1 > /proc/sys/net/ipv4/ip_forward

A ce stade, tous les ping fonctionnent et j’ai Internet sur le serveur et le client.

Ensuite j’installe squid3 :

apt-get install squid3

Je rajoute une ligne iptables pour rendre le proxy transparent :

iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-port 3128

Je rajoute transparent dans le fichier /etc/squid3/squid.conf :

http_port 3128 transparent

Et la impeccable le proxy marche car sur le serveur j’ai le net mais le client à un message ERROR, mon proxy a bloqué la page.

Je modifie mon fichier de configuration squid3 :

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl lan src 192.168.0.0/24
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow lan
http_access deny all
icp_access deny all
htcp_access deny all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid3/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern (cgi-bin|?) 0 0% 0
refresh_pattern . 0 20% 4320
icp_port 3130
coredump_dir /var/spool/squid3

Et maintenant grâce à lan mon client a accès a Internet.

J’installe squidguard :

apt-get install squidguard

Ensuite je le configure :

/etc/squid/squidGuard.conf :

dbhome /var/lib/squidguard/db
logdir /var/log/squid

TIME RULES:

abbrev for weekdays:

s = sun, m = mon, t =tue, w = wed, h = thu, f = fri, a = sat

time workhours {
weekly mtwhf 08:00 - 16:30
date --01 08:00 - 16:30
}

REWRITE RULES:

#rew dmz {

s@://admin/@://admin.foo.bar.no/@i

s@://foo.bar.no/@://www.foo.bar.no/@i

#}

SOURCE ADDRESSES:

src admin {
ip 192.168.0.1

user root foo bar

within workhours

}

src client {
ip 192.168.0.2
}

#src bar-clients {

ip 172.16.4.0/26

#}

DESTINATION CLASSES:

dest good {
}

dest local {
}

dest adult {
domainlist adult/domains
urllist adult/urls
expressionlist adult/expressions

redirect admin.foo.bar.no/cgi-bin/squidGu … lientaddr=%a+clientname=%n+clientident=%i+srcclass=%s+targetclass=%t+url=%u

}

acl {
admin {
pass all
}

client {
	pass	 !adult all
}

bar-clients {

pass local none

}

default {
	pass	 none

rewrite dmz

redirect orange.fr

}

}

Je télécharge la blacklist sur le site de toulouse, je le décompresse et je mets le contenu du fichier blacklists dans /var/lib/squidguard/db

Ensuite je rajoute à la fin du fichier de conf de squid la ligne :

redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf

Je redémarre squid3 :

/etc/init.d/squid3 restart

Et la sur le client je peux aller n’importe ou et même sur des sites pornographiques comme si squidguard ne servait à rien.

Quel est mon erreur?

Si quelqu’un à la gentillesse de m’éclairer.

dans ce fil http://forum.debian-fr.org/viewtopic.php?f=8&t=11658

fran.b donne la manière de tester des urls en mode console, pour tester squidguard.

J’ai mis un site faisant partie de la liste urls de adult.

Et 192.168.0.2 j’ai lancé ça sur le serveur.

debian:/usr/bin# echo “http://www.100-links.com/sexe_gratuit 192.168.0.2/- - GET” | /usr/bin/squidGuard -c /etc/squid/squidGuard.conf -d

2009-02-26 14:16:29 [4557] destblock good missing active content, set inactive
2009-02-26 14:16:29 [4557] destblock local missing active content, set inactive
2009-02-26 14:16:29 [4557] init domainlist /var/lib/squidguard/db/adult/domains
2009-02-26 14:16:29 [4557] loading dbfile /var/lib/squidguard/db/adult/domains.db
2009-02-26 14:16:29 [4557] init urllist /var/lib/squidguard/db/adult/urls
2009-02-26 14:16:29 [4557] init expressionlist /var/lib/squidguard/db/adult/expressions
2009-02-26 14:16:29 [4557] squidGuard 1.2.0 started (1235654189.519)
2009-02-26 14:16:29 [4557] recalculating alarm in 8011 seconds
2009-02-26 14:16:29 [4557] squidGuard ready for requests (1235654189.685)

2009-02-26 14:16:29 [4557] squidGuard stopped (1235654189.685)

Tu n’as pas de pages de redirection en cas de rejet…

J’ai modifié puis redémarrer squid3, pareil…

CONFIG FILE FOR SQUIDGUARD

dbhome /var/lib/squidguard/db
logdir /var/log/squid

TIME RULES:

abbrev for weekdays:

s = sun, m = mon, t =tue, w = wed, h = thu, f = fri, a = sat

time workhours {
weekly mtwhf 08:00 - 16:30
date --01 08:00 - 16:30
}

REWRITE RULES:

#rew dmz {

s@://admin/@://admin.foo.bar.no/@i

s@://foo.bar.no/@://www.foo.bar.no/@i

#}

SOURCE ADDRESSES:

src admin {
ip 192.168.0.1

user root foo bar

within workhours

}

src client {
ip 192.168.0.2
}

#src bar-clients {

ip 172.16.4.0/26

#}

DESTINATION CLASSES:

dest good {
}

dest local {
}

dest adult {
domainlist adult/domains
urllist adult/urls
expressionlist adult/expressions

redirect admin.foo.bar.no/cgi-bin/squidGu … lientaddr=%a+clientname=%n+clientident=%i+srcclass=%s+targetclass=%t+url=%u

}

acl {
admin {
pass all
}

client {
	pass	 !adult all
	redirect [www.google.fr](http://www.google.fr)	

}

bar-clients {

pass local none

}

default {
	pass	 none

rewrite dmz

	redirect [www.google.fr](http://www.google.fr)
}

}

Il faut le http:// dans les «redirect»

Je vous montre mon squid.conf :

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl lan src 192.168.0.0/24
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow lan
http_access deny all
icp_access deny all
htcp_access deny all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid3/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern (cgi-bin|?) 0 0% 0
refresh_pattern . 0 20% 4320
icp_port 3130
coredump_dir /var/spool/squid3
redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf

Mon squidGuard.conf :

CONFIG FILE FOR SQUIDGUARD

dbhome /var/lib/squidguard/db
logdir /var/log/squid

TIME RULES:

abbrev for weekdays:

s = sun, m = mon, t =tue, w = wed, h = thu, f = fri, a = sat

time workhours {
weekly mtwhf 08:00 - 16:30
date --01 08:00 - 16:30
}

REWRITE RULES:

#rew dmz {

s@://admin/@://admin.foo.bar.no/@i

s@://foo.bar.no/@://www.foo.bar.no/@i

#}

SOURCE ADDRESSES:

src admin {
ip 192.168.0.1

user root foo bar

within workhours

}

src client {
ip 192.168.0.2
}

#src bar-clients {

ip 172.16.4.0/26

#}

DESTINATION CLASSES:

dest good {
}

dest local {
}

dest adult {
domainlist adult/domains
urllist adult/urls
expressionlist adult/expressions

redirect admin.foo.bar.no/cgi-bin/squidGu … lientaddr=%a+clientname=%n+clientident=%i+srcclass=%s+targetclass=%t+url=%u

}

acl {
admin {
pass !adult all
redirect google.fr
}

client {
	pass	 !adult all
	redirect [google.fr](http://www.google.fr)	
}

bar-clients {

pass local none

}

default {
	pass	 none

rewrite dmz

	redirect [google.fr](http://www.google.fr)
}

}

J’ai toujours le même problème je peux aller n’importe ou sur Internet… :cry:

Qua donne un test en local (ligne de commande via echo sur squidGuard?