ronaz_d12
(usa Ubuntu)
Enviado em 06/12/2012 - 14:40h
modprobe ipt_string
iptables -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
#SQUID
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#Liberando porta 3128
iptables -A INPUT -i eth1 -p tcp --dport 3128 -j ACCEPT
#libetando ssh externa
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#Garante que os pacotes voltem
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
#Libera HTTPS
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
#libera para administradores o facebook
iptables -t nat -I POSTROUTING -s 192.168.1.11 -m string --algo bm --string "facebook.com" -j MASQUERADE
iptables -t nat -I POSTROUTING -s 192.168.1.12 -m string --algo bm --string "facebook.com" -j MASQUERADE
#depois bloqueio para o resto
iptables -I FORWARD -m string --algo bm --string "facebook.com" -j DROP
#Liberando DNS "Se seu DNS for externo"
iptables -A FORWARD -i eth1 -p udp -m udp --dport 53 -j ACCEPT
iptables -A FORWARD -i eth0 -p udp -m udp --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT
#Libera msn
iptables -A FORWARD -p tcp --dport 1863 -j ACCEPT
iptables -A FORWARD -p udp --dport 1863 -j ACCEPT
#Garante que os pacotes voltem
iptables -t filter -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT