volcom
(usa Debian)
Enviado em 24/03/2009 - 14:16h
Fala pessoal,
Instalei o Squid 2.7 no Debian Lenny, mas não consegui habilitar o proxy transparente, mesmo com a diretiva "http_port 3128 transparent". Só funciona configurando o browser (seja IE ou Firefox).
Estou até usando umas regras de firewall bem básicas que vi pesquisando na net, são elas:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING -s 0/0 -j MASQUERADE
iptables -A FORWARD -s 0/0 -d 0/0 -j ACCEPT
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
Segue meu squid.conf:
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 localnet src 192.168.1.0/24 # RFC1918 possible internal network
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Only allow purge requests from localhost
http_access allow purge localhost
http_access deny purge
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
acl rede_local src 192.168.1.0/24
acl sem_cache url_regex -i "/etc/squid/direto"
acl lista_urls_negadas url_regex -i "/etc/squid/lista"
acl lista_urls_permitidas url_regex -i "/etc/squid/listapermitida"
# Ativando as regras
no_cache deny sem_cache
http_access allow rede_local
http_access allow lista_urls_permitidas
http_access deny lista_urls_negadas
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
#Allow ICP queries from local networks only
icp_access allow localnet
icp_access allow all
# Squid normally listens to port 3128
http_port 3128 transparent
access_log /var/log/squid/access.log squid
#Suggested default:
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
hosts_file /etc/hosts
Toda e qualquer ajuda será muuuito bem vinda!
E ser for necessário enviar mais alguma informação, por favor avisem...
Um abraço!