marllon1987
(usa Ubuntu)
Enviado em 29/09/2009 - 10:33h
touch /var/lock/subsys/local
iptables -X
iptables -F
iptables -t nat -F
#==========================PROTECOES=============================
#Contra pactoes danificados ou suspeitos
iptables -A FORWARD -m unclean -j DROP
#Contra Ping
iptables -A FORWARD -p icmp --icmp-type echo-request -j DROP
#Cotra Ping da Morte
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
#Contra ataque SMURF
iptables -A INPUT -p icmp --icmp-type 8 -j REJECT
#Contra Ataques SYN-FLOOD
iptables -A FORWARD -p tcp -m limit --limit 1/s -j ACCEPT
#Contra Scanners avancados (namp)
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
modprobe ip_tables
modprobe iptable_filter
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe ip_conntrack
modprobe ipt_REDIRECT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 5 > /proc/sys/net/ipv4/ip_forward
ifconfig eth1:1 192.168.0.100 netmask 255.255.255.0 up
#Bloqueando acessos externos ao squid
iptables -A INPUT -i eth0 -p tcp --dport 3128 -j DROP
#Libera acesso à porta 3389 e 1234
#iptables -A INPUT -i eth0 -p tcp --dport 3389 -j ACCEPT
#iptables -A INPUT -i eth0 -p tcp --dport 1234 -j ACCEPT
#Bloqueando acessos externos ao smtp
iptables -A INPUT -i eth0 -p tcp --dport 25 -j DROP
#Libera acesso da porta VPN
iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to-destination 192.168.0.156:1723
iptables -t nat -I PREROUTING -p udp --dport 1723 -j DNAT --to-destination 192.168.0.156:1723
#iptables -t nat -I PREROUTING -p 47 --dport 1723 -j DNAT --to-destination 192.168.0.156:1723
#iptables -t nat -I PREROUTING -p gre --dport 1723 -j DNAT --to-destination 192.168.0.156:1723
iptables -A FORWARD -p 47 -j ACCEPT
###iptables -t nat -A PREROUTING -s eth0 -p tcp --dport 1723 -j DNAT --to-destination 192.168.0.156
###iptables -t nat -A POSROUTING -s 192.168.0.156 -p tcp --sport 1723 -j DNAT --to-destination eth0
#Libera acesso para Web
#iptables -t nat -I POSTROUTING -p tcp --dport 80:80 -j DNAT --to-destination 192.168.0.157:80 -o eth0
#iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.0.157:80 -j ACCEPT
#iptables -A FORWARD -i eth0 -p tcp --dport 80 -d 192.168.0.157 -j ACCEPT
iptables -t nat -I PREROUTING -p tcp --dport 8088 -j DNAT --to-destination 192.168.0.157:80
# Nega acesso à porta 80
#iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 80 -j DROP
# Aceita conexões da Conectividade Social
iptables -A FORWARD -s 192.168.0.0/24 -d obsupgdp.caixa.gov.br -j ACCEPT
iptables -A FORWARD -s obsupgdp.caixa.gov.br -d 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -d cmt.caixa.gov.br -j ACCEPT
iptables -A FORWARD -s cmt.caixa.gov.br -d 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -p tcp -d 200.201.160/20 -j ACCEPT
#iptables -A FORWARD -s 200.201.174.204 -p tcp --dport 2631 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d 200.201.0.0/16 -j ACCEPT
# Redireciona porta 80 para 3128
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p udp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -I PREROUTING -j ACCEPT -s 192.168.0.160 -p tcp --dport 80
iptables -t nat -I PREROUTING -j ACCEPT -s 192.168.0.160 -p udp --dport 80
#Bloqueia acesso ao GTalk
iptables -A FORWARD -d chatenabled.mail.google.com -j DROP
iptables -A FORWARD -d b.mail.google.com -j DROP
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 5222 -j DROP
#Bloqueia acesso ao chat do gtalk pelo gmail
iptables -A FORWARD -d chatenabled.mail.google.com -j DROP
#Bloqueia acesso ao POP e SMTP do gmail nos clientes de e-mail
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 995 -j DROP
iptables -A FORWARD -s 192.168.200.0/24 -p tcp --dport 465 -j DROP
#BLOQUEAR ACESSO AO ORKUT POR HTTPS
iptables -t filter -A INPUT -d 216.239.51.85 -p tcp --dport 443 -j DROP
iptables -t filter -A OUTPUT -d 216.239.51.85 -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d 216.239.51.85 -p tcp --dport 443 -j DROP
iptables -t filter -A INPUT -d 216.239.37.85 -p tcp --dport 443 -j DROP
iptables -t filter -A OUTPUT -d 216.239.37.85 -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d 216.239.37.85 -p tcp --dport 443 -j DROP
iptables -t filter -A INPUT -d images.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A OUTPUT -d images.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d images.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A INPUT -d
www.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A OUTPUT -d
www.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d
www.orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A INPUT -d orkut.com -p tcp --dport 433 -j DROP
iptables -t filter -A OUTPUT -d orkut.com -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d orkut.com -p tcp --dport 443 -j DROP
#BLOQUEAR MSN
# Esta regra bloqueia qualquer host da rede ao conectar no MSN:
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 1863 -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 5223 -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d loginnet.passport.com -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d config.messenger.msn.com -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d messenger.msn.com -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d 200.46.110.0/24 -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d 64.4.13.0/24 -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d messenger.msn.ca -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d webmessenger.msn.com -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d c.msn.com -j REJECT
iptables -A FORWARD -s 192.168.0.0/24 -d tkfiles.storage.msn.com -j REJECT
iptables -A filter -d gateway.messenger.hotmail.com -j REJECT
iptables -A filter -d gw.msnmessenger.akadns.net -j REJECT
iptables -t filter -A INPUT -d by2.omega.contacts.msn.com -p tcp --dport 443 -j DROP
iptables -t filter -A OUPUT -d by2.omega.contacts.msn.com -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d by2.omega.contacts.msn.com -p tcp --dport 443 -j DROP
iptables -t filter -A INPUT -d urs.microsoft.com -p tcp --dport 443 -j DROP
iptables -t filter -A OUPUT -d urs.microsoft.com -p tcp --dport 443 -j DROP
iptables -t filter -A FORWARD -d urs.microsoft.com -p tcp --dport 443 -j DROP