removido
(usa Nenhuma)
Enviado em 04/06/2010 - 12:56h
Ai vai, só um firewall "caseiro".
#!/bin/bash
#Carregando iptables
echo "Carregando Modulo"
modprobe ip_tables
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_MASQUERADE
#limpando tabelas
echo "Limpando Regras"
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
#Regras de Mascaramento
echo "Definindo Regras"
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# rede
echo "Rede"
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#Cups
echo Cups
iptables -A INPUT -p tcp -s 127.0.0.1 --dport 631 -j ACCEPT
iptables -A INPUT -p udp -s 127.0.0.1 --dport 631 -j ACCEPT
#JVM
echo "Liberando JVM"
#Liberar Porta 80
echo "porta 80"
iptables -A INPUT -p tcp --destination-port 80 -j ACCEPT
iptables -A FORWARD -p tcp --destination-port 80 -j ACCEPT
iptables -A FORWARD -s 127.0.0.1/255.255.255.0 -p tcp --destination-port 80 -j ACCEPT
#Liberando aMule
echo "aMule"
iptables -A INPUT -p tcp -i ppp0 --dport 4662 -j ACCEPT
iptables -A INPUT -p udp -i ppp0 --dport 4672 -j ACCEPT
echo "Proteção"
#Proteão contra scaner ocultos
iptables -A INPUT -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -A INPUT -s 0.0.0.0/0 -p icmp -j DROP
#Bloqueando tracertroute
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A OUTPUT -p tcp ! --tcp-flags SYN,RST,ACK SYN -m state --state NEW -j DROP
#Proteção contra ping da morte
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
#Proteão contra Syn-floods
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
#Finaliza Firewall
echo "Fecha Tudo"
iptables -A INPUT -p tcp --syn -j DROP
echo "Firewall OK!"