adsjcsp
(usa Debian)
Enviado em 25/11/2008 - 11:57h
#!/bin/bash
#limpando tabelas
iptables -F &&
iptables -X &&
iptables -t nat -F &&
iptables -t nat -X &&
iptables -A INPUT -s 0.0.0.0/0.0.0.0 -j ACCEPT
#VPN--------------------------------------------------------------------------------------------
iptables -A INPUT -p tcp --dport 4001 -j ACCEPT
iptables -A INPUT -p udp --dport 4001 -j ACCEPT
iptables -A INPUT -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -p tcp --dport 47 -j ACCEPT
#iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 47 -j DNAT --to 192.168.10.101
#-----------------------------------------------------------------------------------------------
#SSH
iptables -A INPUT -s 192.168.10.87/255.255.255.0 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 22 -j DROP
#porta segura
#iptables -A INPUT -p tcp --dport 433 -j ACCEPT
#iptables -A OUTPUT -p tcp --dport 433 -j ACCEPT
#Email
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --dport 110 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 110 -j ACCEPT
#Dsecurity Câmeras de Segurança
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8090 -j DNAT --to 192.168.10.80
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 4550 -j DNAT --to 192.168.10.80
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5550 -j DNAT --to 192.168.10.80
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5980 -j DNAT --to 192.168.10.80
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5900 -j DNAT --to 192.168.10.80
#Preroteamento para a VPN
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 4001 -j DNAT --to 192.168.10.101
#Servidor de Mensagem
iptables -t nat -A PREROUTING -i Eth0 -p tcp --dport 5222 -j DNAT --to 192.168.10.101
# Ignora pings
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
# Protecao ra IP spoofing
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
# Protege contra synflood
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
# Protecao ra ICMP Broadcasting
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Bloqueia traceroute
iptables -A INPUT -p udp --dport 33435:33525 -j DROP
# Protecoes diversas contra portscanners, ping of death, ataques DoS, etc.
iptables -A INPUT -m state --state INVALID -j DROP
# Abre para a interface de loopback.
# Esta regra sao sencial para o KDE e outros programas gracos funcionarem adequadamente.
iptables -A INPUT -i lo -j ACCEPT
# Fecha as portas udp de 1 a 1024
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
# Protege contra synflood
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
# Protecao ra ICMP Broadcasting
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Bloqueia traceroute
iptables -A INPUT -p udp --dport 33435:33525 -j DROP
# Protecoes diversas contra portscanners, ping of death, ataques DoS, etc.
iptables -A INPUT -m state --state INVALID -j DROP
# Abre para a interface de loopback.
# Esta regra sao sencial para o KDE e outros programas gracos funcionarem adequadamente.
iptables -A INPUT -i lo -j ACCEPT
# Fecha as portas udp de 1 a 1024
iptables -A INPUT -p udp --dport 1:1024 -j DROP
iptables -A INPUT -p udp --dport 59229 -j DROP
iptables -A INPUT -p tcp --syn -j DROP
Espero que possa me ajudar......