nene_guitar
(usa openSUSE)
Enviado em 14/07/2013 - 20:15h
pessoal mais testes porem sem sucesso..
porem ainda so funcionando setando proxy no navegador cliente
sei que em algum lugar tem erro porem nao estou conseguindo resolver.
obrigado desde ja
lembrando
eth0 (internet ADSL oi 10.1.1.1)
eth1 (rede local 192.168.1.254)
segue arquivos de conf
etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Sun Jul 14 06:28:49 2013
*mangle
:PREROUTING ACCEPT [7870:5552182]
:INPUT ACCEPT [7866:5551617]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [9050:4884061]
:POSTROUTING ACCEPT [9050:4884061]
COMMIT
# Completed on Sun Jul 14 06:28:49 2013
# Generated by iptables-save v1.4.7 on Sun Jul 14 06:28:49 2013
*filter
:INPUT DROP [12:594]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [9050:4884061]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -m limit --limit 1/sec -j DROP
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 3128 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 123 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Sun Jul 14 06:28:49 2013
# Generated by iptables-save v1.4.7 on Sun Jul 14 06:28:49 2013
*nat
:PREROUTING ACCEPT [184:9987]
:POSTROUTING ACCEPT [2:120]
:OUTPUT ACCEPT [258:15609]
-A PREROUTING -s 10.0.0.0/8 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
-A POSTROUTING -o eth1 -j MASQUERADE
-A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# Completed on Sun Jul 14 06:28:49 2013
obs. nao sei de onde ele tirou essas regras.
##################################################
squid.conf
http_port 3128 transparent (jatentei intercept)
visible_hostname pxy.br
acl lan src 192.168.1.0/24
http_access allow lan
(ja fiz so com essas linhas para testes.
###################################################
etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
sh /usr/local/bin/squidfw.sh (criei esse arquivo)
chmod +x /usr/local/bin/squidfw.sh
#####################################################
/usr/local/bin/squidfw.sh
# Limite contra ping da morte e DoS
iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -m limit --limit 1/s -j DROP
# Liberando portas SSH a partir de qualquer interface
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Liberando portas squid, http e NTP.
iptables -A INPUT -p tcp --dport 3128 -i eth1 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -i eth1 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -i eth1 -j ACCEPT
iptables -A INPUT -p tcp --dport 123 -i eth1 -j ACCEPT
iptables -A INPUT -p udp --dport 123 -i eth1 -j ACCEPT
# Nat Global
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# NAT Rede
iptables -t nat -A POSTROUTING -s 10.1.1.0/255.0.0.0 -o eth0 -j MASQUERADE
# Jogando tráfego da porta 80 para o SQUID3 TRANSPARENT
iptables -t nat -A PREROUTING -s 10.1.1.0/255.0.0.0 -p tcp --dport 80 -j REDIRECT --to-port 3128