xvktr
(usa Debian)
Enviado em 16/09/2008 - 11:13h
Bom Dia!
Estou tentando configurar o squid em modo transparente, mas nao está funcionando.
Atualmente os usr possuem acesso livre (direto modem).
Os micro dos usr estão com ip fixo, com Gateway e DNS o ip do modem.
Minha idéia seria por um servidor com o mesmo ip para controlar a "festa".
Porém não estou conseguindo. Para funcionar tenho que configurar o navegador para usar um servidor proxy (as portas 3128 e 80 funcionam), e remover o dns da maquina do usr, e mesmo assim algumas não funcionam.
Necessito que funcionasse transparente , sem ter que mudar nenhuma configuração dos micros dos usrs.
Já tentei algumas coisas, mas nada.
Uso o debian etch padrão, instalei o squid via apt-get
segue o squid.conf
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_dir ufs /var/cache/squid 2000 16 256
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 192.168.254.0/255.255.255.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 allowed_hosts src 192.168.254.0/255.255.255.0
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
#LISTA DE MALWARES
acl malware url_regex -i "/etc/squid/malwareList.txt"
http_access deny malware
deny_info
http://192.168.254.2/erros/malware.html malware
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
# CONFIG DO SQUIDGUARD funcionando OK
redirect_program /usr/bin/squidGuard
http_access allow localhost
http_access allow all
http_reply_access allow all
icp_access allow all
cache_effective_group proxy
coredump_dir /var/spool/squid
Script do iptables executado apartir do rc.local
#!/bin/sh
# Carrega os modulos
modprobe ip_tables
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
# Limpa regras
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
# liberando localhost para funcionar
iptables -A INPUT -i lo -j ACCEPT
# liberando retorno dos pacotes DNS
iptables -A INPUT -s 0/0 -p udp --sport 53 -j ACCEPT
iptables -A FORWARD -s 0/0 -p udp --sport 53 -j ACCEPT
iptables -A INPUT -s 0/0 -p udp --sport 500 -j ACCEPT
iptables -A INPUT -s 0/0 -p udp --sport 4500 -j ACCEPT
iptables -A INPUT -s 0/0 -p udp --sport 888 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --sport 700 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --sport 2323 -j ACCEPT
iptables -A FORWARD -s 0/0 -p udp --sport 500 -j ACCEPT
iptables -A FORWARD -s 0/0 -p udp --sport 4500 -j ACCEPT
iptables -A FORWARD -s 0/0 -p udp --sport 888 -j ACCEPT
iptables -A FORWARD -s 0/0 -p tcp --sport 700 -j ACCEPT
iptables -A FORWARD -s 0/0 -p tcp --sport 2323 -j ACCEPT
# liberando retorno dos pacotes de http
iptables -A INPUT -s 0/0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --sport 8017 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --dport 8017 -j ACCEPT
# Bloqueando TraceRoute
iptables -A INPUT -p udp -s 0/0 -i eth1 --dport 33435:33525 -j DROP
iptables -A INPUT -p udp -s 0/0 -i eth2 --dport 33435:33525 -j DROP
# Nao responde a pings
echo "1" >/proc/sys/net/ipv4/icmp_echo_ignore_all
# Bloqueia o MSN
iptables -A FORWARD -s 192.168.0.3 -p tcp --dport 1863 -j ACCEPT
iptables -A FORWARD -s 192.168.0.3 -d loginnet.passport.com -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 1863 -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d loginnet.passport.com -j REJECT
echo "1" >/proc/sys/net/ipv4/ip_forward
# Compartilha a conexao
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
# Abre para a rede local
#iptables -A INPUT -p tcp --syn -s 192.168.0.0/255.255.255.0 -j ACCEPT
# Bloqueando Kazaa
iptables -A FORWARD -d 213.248.112.0/24 -j REJECT
iptables -A FORWARD -p TCP --dport 1214 -j REJECT
# Bloqueando o MSN
iptables -A FORWARD -s 192.168.0.0 -p tcp --dport 1863 -j REJECT
iptables -A FORWARD -s 192.168.0.0 -d loginnet.passport.com -j REJECT
arquivo interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# rede externa (modem)
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.220
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254
# rede interna
allow-hotplug eth1
iface eth1 inet static
address 192.168.254.2
netmask 255.255.255.0
network 192.168.254.0
broadcast 192.168.0.255
se alguem tiver alguma ideia, pois to sem do que pode ser