Squid !!
Inviato: dom 17 apr 2005, 15:19
ragazzi dopo avere installato Samba come pdc sto cercando ora di far funzionare Squid sulla stessa macchina. In rc.local ho impostto alcune regole di firewalling e masquerade:
<BR>
<BR>echo 1 > /proc/sys/net/ipv4/ip_forward
<BR>iptables -F
<BR>iptables -P INPUT DROP
<BR>iptables -P OUTPUT ACCEPT
<BR>iptables -P FORWARD DROP
<BR>iptables -A INPUT -p tcp --dport 22 -j ACCEPT
<BR>iptables -A INPUT -p tcp --dport 53 -j ACCEPT
<BR>iptables -A INPUT -i eth0 -j ACCEPT
<BR>iptables -A INPUT -s 10.0.0.0/8 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 10.0.0.0/8 -i eth1 -j DROP
<BR>iptables -A INPUT -s 172.16.0.0/12 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 172.16.0.0/12 -i eth1 -j DROP
<BR>iptables -A INPUT -s 192.168.0.0/16 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 192.168.0.0/16 -i eth1 -j DROP
<BR>iptables -A INPUT -s 224.0.0.0/3 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 224.0.0.0/3 -i eth1 -j DROP
<BR>iptables -A INPUT -s 127.0.0.1 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 127.0.0.1 -i eth1 -j DROP
<BR>iptables -A INPUT -i eth1 -p tcp --dport 1024:65535 -j ACCEPT
<BR>iptables -A InPUT -i eth1 -p udp --dport 1024:65535 -j ACCEPT
<BR>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
<BR>iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 2/s -j ACCEPT
<BR>iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
<BR>iptables -A FORWARD -i eth1 -o eth0 -m state ESTABLISHED,RELATED -j ACCEPT
<BR>iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
<BR>iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
<BR>
<BR>aggiungendo poi:
<BR>iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
<BR>per redirigere il traffico http sullo squid locale.
<BR>
<BR>il file squid.conf :
<BR>http_port 3128
<BR>icp_port 3130
<BR>cache_mem 8 MB
<BR>cache_dir ufs /var/log/squid/cache 100 16 256
<BR>cache_access_log /var/log/squid/logs/access.log
<BR>cache_log /var/log/squid/logs/cache.log
<BR>cache_store_log /var/log/squid/logs/store.log
<BR>emulate_httpd_log off
<BR>mime_table /etc/squid/mime.conf
<BR>acl all src 0.0.0.0/0.0.0.0
<BR>acl manager proto cache_object
<BR>acl localhost src 127.0.0.1/255.255.255.255
<BR>acl to_localhost dst 127.0.0.0/8
<BR>acl SSL_ports port 443 563
<BR>acl Safe_ports port 80 # http
<BR>acl Safe_ports port 21 # ftp
<BR>acl Safe_ports port 443 563 # https, snews
<BR>acl Safe_ports port 70 # gopher
<BR>acl Safe_ports port 210 # wais
<BR>acl Safe_ports port 1025-65535 # unregistered ports
<BR>acl Safe_ports port 280 # http-mgmt
<BR>acl Safe_ports port 488 # gss-http
<BR>acl Safe_ports port 591 # filemaker
<BR>acl Safe_ports port 777 # multiling http
<BR>acl locallan src 192.168.0.0/255.255.255.0
<BR>acl CONNECT method CONNECT
<BR>http_access allow manager localhost
<BR>http_access deny manager
<BR>http_access deny !Safe_ports
<BR>http_access deny CONNECT !SSL_ports
<BR>http_access allow localhost
<BR>http_access allow locallan
<BR>http_access deny all
<BR>cache_effective_user nobody
<BR>cache_effective_group nobody
<BR>
<BR>
<BR>adesso non funzione più la condivisione internet. Sto approfondendo Squid ma intanto mi piacerebbe vederlo funzionare, e´ da più di un giorno ch ci smanetto senza risultati :-[ <br>
<BR>
<BR>echo 1 > /proc/sys/net/ipv4/ip_forward
<BR>iptables -F
<BR>iptables -P INPUT DROP
<BR>iptables -P OUTPUT ACCEPT
<BR>iptables -P FORWARD DROP
<BR>iptables -A INPUT -p tcp --dport 22 -j ACCEPT
<BR>iptables -A INPUT -p tcp --dport 53 -j ACCEPT
<BR>iptables -A INPUT -i eth0 -j ACCEPT
<BR>iptables -A INPUT -s 10.0.0.0/8 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 10.0.0.0/8 -i eth1 -j DROP
<BR>iptables -A INPUT -s 172.16.0.0/12 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 172.16.0.0/12 -i eth1 -j DROP
<BR>iptables -A INPUT -s 192.168.0.0/16 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 192.168.0.0/16 -i eth1 -j DROP
<BR>iptables -A INPUT -s 224.0.0.0/3 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 224.0.0.0/3 -i eth1 -j DROP
<BR>iptables -A INPUT -s 127.0.0.1 -i eth1 -j DROP
<BR>iptables -A FORWARD -s 127.0.0.1 -i eth1 -j DROP
<BR>iptables -A INPUT -i eth1 -p tcp --dport 1024:65535 -j ACCEPT
<BR>iptables -A InPUT -i eth1 -p udp --dport 1024:65535 -j ACCEPT
<BR>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
<BR>iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 2/s -j ACCEPT
<BR>iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
<BR>iptables -A FORWARD -i eth1 -o eth0 -m state ESTABLISHED,RELATED -j ACCEPT
<BR>iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
<BR>iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
<BR>
<BR>aggiungendo poi:
<BR>iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
<BR>per redirigere il traffico http sullo squid locale.
<BR>
<BR>il file squid.conf :
<BR>http_port 3128
<BR>icp_port 3130
<BR>cache_mem 8 MB
<BR>cache_dir ufs /var/log/squid/cache 100 16 256
<BR>cache_access_log /var/log/squid/logs/access.log
<BR>cache_log /var/log/squid/logs/cache.log
<BR>cache_store_log /var/log/squid/logs/store.log
<BR>emulate_httpd_log off
<BR>mime_table /etc/squid/mime.conf
<BR>acl all src 0.0.0.0/0.0.0.0
<BR>acl manager proto cache_object
<BR>acl localhost src 127.0.0.1/255.255.255.255
<BR>acl to_localhost dst 127.0.0.0/8
<BR>acl SSL_ports port 443 563
<BR>acl Safe_ports port 80 # http
<BR>acl Safe_ports port 21 # ftp
<BR>acl Safe_ports port 443 563 # https, snews
<BR>acl Safe_ports port 70 # gopher
<BR>acl Safe_ports port 210 # wais
<BR>acl Safe_ports port 1025-65535 # unregistered ports
<BR>acl Safe_ports port 280 # http-mgmt
<BR>acl Safe_ports port 488 # gss-http
<BR>acl Safe_ports port 591 # filemaker
<BR>acl Safe_ports port 777 # multiling http
<BR>acl locallan src 192.168.0.0/255.255.255.0
<BR>acl CONNECT method CONNECT
<BR>http_access allow manager localhost
<BR>http_access deny manager
<BR>http_access deny !Safe_ports
<BR>http_access deny CONNECT !SSL_ports
<BR>http_access allow localhost
<BR>http_access allow locallan
<BR>http_access deny all
<BR>cache_effective_user nobody
<BR>cache_effective_group nobody
<BR>
<BR>
<BR>adesso non funzione più la condivisione internet. Sto approfondendo Squid ma intanto mi piacerebbe vederlo funzionare, e´ da più di un giorno ch ci smanetto senza risultati :-[ <br>