eesm_redhat
(usa Arch Linux)
Enviado em 27/03/2009 - 18:46h
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
if [ ${NETWORKING} = "no" ]
then
exit 0
fi
case "$1" in
start)
gprintf "Iniciando o servico de %s: " "Firewall"
modprobe ip_tables
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe ipt_REDIRECT
modprobe ip_nat_ftp
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j REDIRECT --to-port 80
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo
echo 1 > /proc/sys/net/ipv4/ip_forward
#Politica de privacidade
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
Liberando FTP
iptables -A INPUT -i eth0 -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 20 -j ACCEPT
iptables -A FORWARD -i eth0 -p tcp --dport 21 -j ACCEPT
iptables -A FORWARD -i eth0 -p tcp --dport 21 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 21 -j DNAT --to-dest 192.168.xxx.xxx:21
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 192.168.1.1 --dport 21 -j DNAT --to-destination 192.168.xxx.xxx:21
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 21 -j DNAT --to-dest 192.168.xxx.xxx:20
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 192.168.xxx.xxx --dport 21 -j DNAT --to-destination 192.168.xxx.xxx:20
# Bloqueando servicos
iptables -A INPUT -i eth0 -p tcp --dport 22 -j DROP
iptables -A INPUT -i eth0 -p tcp --dport 3128 -j DROP
iptables -A INPUT -i eth0 -p tcp --dport 139 -j DROP
iptables -A INPUT -i eth0 -p tcp --dport 443 -j DROP
iptables -A INPUT -i eth0 -p tcp --dport 445 -j DROP
iptables -A INPUT -i eth0 -p tcp --dport 631 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 67 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 137 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 138 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 631 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 1024 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 1025 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 3130 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 4287 -j DROP