Lista
Resolvi fazer um teste para verificar se o problema estava na regra
de firewall ou na configuração do squid. Montei um novo ambiente, só que
desta vez instalei o squid3 no mesmo computador do iptables(firewall).
Utilizei o mesmo arquivo de configuração do squid só que desta vez utilizei
outra regra de firewall. Deu certo, os sites que deveriam ser bloqueados
foram bloqueados e as informações foram armazenadas no arquivo access.log. Já
que a configuração do squid esta certa, então o problema esta na firewall.
Procurei na internet vários textos descrevendo esse tipo de topologia que eu
estou querendo montar, firewall e squid em computadores diferentes, mas até
agora nada. Alguém por acaso montou uma topologia como esta?
##### firewall #####
http_port 3128 transparent
cache_dir ufs /var/spool/squid3 100 16 256
cache_mgr [email protected]
cache_effective_user proxy
logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A
%mt
access_log /var/log/squid3/access.log squid
cache_log /var/log/squid3/cache.log
cache_store_log /var/log/squid3/store.log
acl localhost src 127.0.0.0/8 # Localhost
acl lan src 192.168.0.0/24 # LAN where authorized
clients reside
acl manager proto cache_object # Cache object protocol
acl to_localhost dst 127.0.0.0/8 # Requests to localhost
acl SSL_ports port 443 # https port
acl Safe_ports port 80 21 443 # http, ftp, https ports
acl CONNECT method CONNECT # SSL CONNECT method
acl rede_interna src 192.168.0.0/24
acl adm src 192.168.0.0-192.168.0.20
http_access allow adm all
acl block url_regex "/etc/squid3/block"
acl noblock url_regex "/etc/squid3/noblock"
http_access deny block !noblock
##### squid.conf #####
#!/bin/bash
IPTABLES=/sbin/iptables
# clean all possible old mess
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# masquerading
$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
# Squid - NAO DEU CERTO
$IPTABLES -t nat -A PREROUTING -i eth0 -s ! 192.168.0.7 -p tcp --dport
80 -j DNAT --to 192.168.0.7:3128
$IPTABLES -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -d
192.168.0.7 -j SNAT --to 192.168.0.7
$IPTABLES -A FORWARD -s 192.168.0.0/24 -d 192.168.0.7 -i eth0 -o eth0
-p tcp --dport 3128 -j ACCEPT
# Squid - DEU CERTO, mas com o squid e firewall no mesmo computador
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT
--to-port 3128
iptables -t nat -A PREROUTING -i eth1 -p udp --dport 80 -j REDIRECT
--to-port 3128
# opening all icmp
$IPTABLES -A INPUT -i eth0 -p icmp -j ACCEPT
# opening all for insiders
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -i eth1 -j ACCEPT
Obrigado.
--
.''`. Caio Abreu Ferreira
: :' : [email protected]
`. `'` Debian User
`- Key fingerprint = 97F8 61AC 605F 8A8B 3BA1 D479 8C9A 52E8 6478 601F
On (21/10/10 15:57), Flavio Menezes dos Reis wrote:
> Não entendi porque destas duas linhas?
> $IPTABLES -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j
> DNAT --to 192.168.0.7:3128
> $IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j
> REDIRECT --to-port 3128
>
>
> O correto não seria só a primeira?
>
> 2010/10/19 Caio Abreu Ferreira <[email protected]>:
> > Lista
> >
> > O meu objetivo agora é configurar o squid para trabalahar como proxy
> > só que localizado em um computador separado do gateway. Sei como configurar
> > o
> > squid localizado no gateway, o que eu estou querendo fazer é instalar em
> > outro computador. O que eu fiz até agora foi:
> >
> > #: Title : Squid Howto
> > #: Date : 2010-10-19
> > #: Author : "Caio Abreu Ferreira" <idic_terra.com.br>
> > #: Version : 1.0
> > #: Description : Servidor Squid
> > #: Options : None
> > #: Reference :
> > #: Technical information
> > gateway 192.168.0.2
> > servidor 192.168.0.7
> >
> > # /etc/init.d/firewall.sh (gateway)
> > $IPTABLES -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT
> > --to 192.168.0.7:3128
> > $IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT
> > --to-port 3128
> >
> > # aptitude install squid3 (server)
> >
> > # /etc/squid/squid.conf (server)
> > # Port on which connections are redirected
> > http_port 192.168.0.7:3128 transparent
> >
> > cache_dir ufs /var/spool/squid3 100 16 256
> > cache_mgr [email protected]
> > cache_effective_user proxy
> >
> > ftp_user [email protected]
> >
> > # Define the access log format
> > logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un
> > %Sh/%<A %mt
> > # Log client request activities ('squid' is the name of the log
> > format to use)
> > access_log /var/log/squid3/access.log squid
> > # Log information about the cache's behavior
> > cache_log /var/log/squid3/cache.log
> > # Log the activities of the storage manager
> > cache_store_log /var/log/squid3/store.log
> >
> > # Classes
> > acl all src all # Any IP address
> > acl localhost src 127.0.0.0/8 # Localhost
> > acl lan src 192.168.0.0/24 # LAN where authorized
> > clients reside
> > acl manager proto cache_object # Cache object protocol
> > acl to_localhost dst 127.0.0.0/8 # Requests to localhost
> > acl SSL_ports port 443 # https port
> > acl Safe_ports port 80 21 443 # http, ftp, https ports
> > acl CONNECT method CONNECT # SSL CONNECT method
> >
> > # Only allow cachemgr access from localhost
> > http_access allow manager localhost
> > http_access deny manager
> >
> > # Deny requests to unknown ports
> > http_access deny !Safe_ports
> >
> > # Deny CONNECT to other than SSL ports
> > http_access deny CONNECT !SSL_ports
> >
> > # Prevent access to local web applications from remote users
> > http_access deny to_localhost
> >
> > # Allow access from the local network
> > http_access allow lan
> >
> > # Default deny (this must be the last rule)
> > http_access deny all
> >
> > Alguem na lista por acaso já fez algo parecido?
signature.asc
Description: Digital signature

