View previous topic :: View next topic |
Author |
Message |
oleo Tux's lil' helper
Joined: 09 Nov 2004 Posts: 117
|
Posted: Tue Mar 27, 2007 5:05 pm Post subject: [RISOLTO] Dansguardian: impossibile avviarlo |
|
|
Ciao a tutti!
Sto implementando un router a cui vorrei aggiungere le funzioni di filtraggio del contenuto dei siti web. La soluzione adottata è squid + dansguardian. Il problema è che dansguardian si rifiuta di partire.
Lanciando
Code: | /etc/init.d/dansguardian start | il servizio si addormenta su
Code: | * Starting DansGuardian... | finchè devo lanciargli ctrl+c per interromperlo.
Dopo alcune prove ho scoperto che se disattivo le iptables DansGuardian riesce a partire... poi ovviamente non funziona più nulla però almeno il servizio va su. Deduco quindi sia un problema delle iptables però non riesco a venirne a capo.
Prima di postare i file di cfg preciso che senza dansguardian funziona tutto perfettamente, squid compreso e tutti i pc della LAN accedono ad internet tramite il proxy (trasparente).
Allego i file di configurazione, comprese le regole di iptables.
IPTABLES (eth0=INTERNET eth1=LAN)
Code: | # Generated by iptables-save v1.3.5 on Tue Mar 27 17:22:35 2007
*nat
:PREROUTING ACCEPT [70286:4807849]
:POSTROUTING ACCEPT [35162:2378361]
:OUTPUT ACCEPT [3225:376066]
-A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Tue Mar 27 17:22:36 2007
# Generated by iptables-save v1.3.5 on Tue Mar 27 17:22:36 2007
*filter
:INPUT DROP [169:13670]
:FORWARD DROP [39:28136]
:OUTPUT ACCEPT [3754945:4699940638]
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -s 10.0.0.0/255.0.0.0 -i eth0 -j DROP
-A INPUT -s 172.16.0.0/255.240.0.0 -i eth0 -j DROP
-A INPUT -s 192.168.0.0/255.255.0.0 -i eth0 -j DROP
-A INPUT -s 127.0.0.1 -i eth0 -j DROP
-A INPUT -i eth0 -p tcp -m tcp --dport 1024:65535 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 1024:65535 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 2/sec -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j DROP
-A FORWARD -s 10.0.0.0/255.0.0.0 -i eth0 -j DROP
-A FORWARD -s 172.16.0.0/255.240.0.0 -i eth0 -j DROP
-A FORWARD -s 192.168.0.0/255.255.0.0 -i eth0 -j DROP
-A FORWARD -s 127.0.0.1 -i eth0 -j DROP
-A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -o eth0 -j ACCEPT
COMMIT
# Completed on Tue Mar 27 17:22:36 2007
|
SQUID (configurazione di default non cambiata)
Code: | http_port 192.168.0.1:3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow all
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_user squid
cache_effective_group squid
forwarded_for off
coredump_dir /var/cache/squid |
DANSGUARDIAN (configurazione di default a parte gli IP e le porte)
Code: | reportinglevel = 3
languagedir = '/etc/dansguardian/languages'
language = 'ukenglish'
loglevel = 2
logexceptionhits = on
logfileformat = 1
filterip = 192.168.0.1
filterport = 8080
proxyip = 192.168.0.1
proxyport = 3128
accessdeniedaddress = 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl'
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 = 2
urlcachenumber = 1000
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'
nodaemon = off
nologger = off
softrestart = off
|
Dove sbaglio? C'è una regola delle iptables che blocca dansguardian all'avvio?
Grazie dell'aiuto,
Fabio.
Last edited by oleo on Wed Mar 28, 2007 10:22 am; edited 2 times in total |
|
Back to top |
|
|
oleo Tux's lil' helper
Joined: 09 Nov 2004 Posts: 117
|
Posted: Tue Mar 27, 2007 7:43 pm Post subject: |
|
|
Ho trovato il problema: la catena di input ha come regola di default DROP.
Ho aggiunto questa regola:
Code: | iptables -A INPUT -s 192.168.0.1 -i lo -j ACCEPT
|
e ora funziona tutto.
Mi chiedo: con questa regola comprometto la sicurezza del server?
Ciao,
Fabio. |
|
Back to top |
|
|
noppy Tux's lil' helper
Joined: 10 Dec 2003 Posts: 103
|
Posted: Tue Mar 27, 2007 10:15 pm Post subject: |
|
|
che io sappia la loopback deve sempre essere accettata ma non sa sorgente esterna , cioe io metto
-A -i lo -j ACCEPT
che una eth deva accedere alla lo mi pare un po' strano |
|
Back to top |
|
|
oleo Tux's lil' helper
Joined: 09 Nov 2004 Posts: 117
|
Posted: Tue Mar 27, 2007 10:55 pm Post subject: |
|
|
Subito anche io avevo messo solo
Code: | iptables -A INPUT -i lo -j ACCEPT |
ed effettivamente funzionava.
Ho pensato poi di rendere più strette le maglie di questa regola specificando anche la sorgente e continua a funzionare. Deduco quindi che ci sia una comunicazione tra DansGuardian e Squid che rispetti tale regola. |
|
Back to top |
|
|
noppy Tux's lil' helper
Joined: 10 Dec 2003 Posts: 103
|
Posted: Wed Mar 28, 2007 10:08 am Post subject: |
|
|
puo' essere che squid si presenti come indirizzo eth alla lo dove gira guardian , cmq è un buona cosa accettare cmq tutti i pacchetti che arrivano dalla lo che viene utilizzata anche per altre cose |
|
Back to top |
|
|
oleo Tux's lil' helper
Joined: 09 Nov 2004 Posts: 117
|
Posted: Wed Mar 28, 2007 10:21 am Post subject: |
|
|
Ok, grazie mille per il suggeriemento. |
|
Back to top |
|
|
|