Enviat: 29/Abr/2010 - 16:37
Hola Pablo, com que amb Mandriva no calia tocar res, he preferit buscar una solució que NO impliqués tocar configuracions de xarxa ni de navegadors.
He trobat això per Internet, i m'ha funcionat. Potser són massa línies, i podríeu "triar" quines són realment necessàries, i que no impliqués saber quina interfície de xarxa (eth0, eth1), ni quina IP s'està fent servir, perquè resulti una solució més "estàndard".
Aquestes són les ordres de tipus iptables que han fet que el DansGuardian filtri sense tocar RES MÉS!
# Allow Squid outbound access on port 8080 (Dansguardian)
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 8080 -m owner --uid-owner squid -j ACCEPT
# Allow Squid outbound access on port 80
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -m owner --uid-owner squid -j ACCEPT
# Don't redirect root on port 80
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -m owner --uid-owner root -j ACCEPT
# Don't redirect root on port 3128 (Squid)
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 3128 -m owner --uid-owner root -j ACCEPT
# Redirect all requests on port 80 to 8080 (Dansguardian)
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
# Accept requests on port 3128 from nobody (Dansguardian user)
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 3128 -m owner --uid-owner nobody -j ACCEPT
# Redirect all other requests on port 3128 to 8080 to prevent users from getting around Dansguardian by going directly to Squid
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 3128 -j REDIRECT --to-ports 8080
# Delete the NOTRACK rule that SuSEfirewall2 adds to the raw table of the OUTPUT chain
iptables -t raw -D OUTPUT -o lo -j NOTRACK
... que he afegit al fitxer /etc/sysconfig/scripts/SuSEfirewall2-custom.
Després he executat, com a root, les ordres següents:
chkconfig squid on
chkconfig dansguardian on
rcSuSEfirewall2 restart
rcsquid reload
rcdansguardian reload
He reiniciat la màquina per assegurar-me que tot funcionaria un cop reiniciada i HA FUNCIONAT, el DansGuardian filtra sense haver de tocar el navegador.
Si podeu "polir" les frases de tipus iptables, estaria molt bé.
Si algú pogués confirmar que també li ha funcionat així, seria perfecte.
Gràcies
Joan Padró