Vitorhugomb
(usa Debian)
Enviado em 05/10/2017 - 09:44h
# DEFINE POLITICA PADRAO
iptables -P INPUT DROP
iptables -A INPUT -i eth2.4043 -j SET --add-set saida src
iptables -A OUTPUT -o eth2.4043 -j SET --add-set entrada dst
#Acept
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
## ICMP
# ECHO REPLY
iptables -A INPUT -p icmp -m icmp --icmp-type 0 -m limit --limit 1/sec -j ACCEPT
# DESTINATION UNREACHABLE
iptables -A INPUT -p icmp -m icmp --icmp-type 3 -m limit --limit 1/sec -j ACCEPT
# ECHO REQUEST
iptables -A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 10/sec -j ACCEPT
# TIME EXCEEDED
iptables -A INPUT -p icmp -m icmp --icmp-type 11 -m limit --limit 1/sec -j ACCEPT
# LOCALHOST
iptables -A INPUT -s 127.0.0.1 -j ACCEPT
# SSH
#iptables -A INPUT -s 0.0.0.0/0 -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 0.0.0.0/0 -p tcp -m tcp --dport 2232 -j ACCEPT
# DNS
iptables -A INPUT -i eth2.4043 -d 192.168.3.51 -p udp -m udp --dport 53 -j ACCEPT
# DHCP RELAY
iptables -A INPUT -i eth2.4043 -s 192.168.0.0/16 -d 192.168.3.51 -p udp -m udp --dport 67 -j ACCEPT
# NTP
iptables -A INPUT -p udp -m udp --dport 123 -j ACCEPT
# SYSLOG
iptables -A INPUT -i eth2.4043 -s 192.168.4.0/24 -d 192.168.3.51 -p udp -m udp --dport 514 -j ACCEPT
iptables -A INPUT -i eth2.4043 -s 192.168.3.0/32 -d 192.168.3.51 -p udp -m udp --dport 514 -j ACCEPT
# RADIUS AUTENTICATION
iptables -A INPUT -i eth2.4043 -s 192.168.4.0/24 -d 192.168.3.51 -p udp -m udp --dport 1812 -j ACCEPT
iptables -A INPUT -i eth2.4043 -s 10.10.11.2/32 -d 192.168.3.51 -p udp -m udp --dport 1812 -j ACCEPT
iptables -A INPUT -i eth2.4043 -s 10.10.12.2/32 -d 192.168.3.51 -p udp -m udp --dport 1812 -j ACCEPT
# HTTP 8082
#iptables -A INPUT -p tcp -m tcp --dport 8090 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8082 -j ACCEPT
# HTTPS
#iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
# TRAPS
iptables -A INPUT -i eth2.4043 -s 192.168.4.0/24 -p udp -m udp --dport 162 -j ACCEPT
iptables -A INPUT -i eth2.4043 -s 192.168.5.0/24 -p udp -m udp --dport 162 -j ACCEPT
#ZABBIX
iptables -A INPUT -i eth2.4043 -s 192.168.3.202/32 -d 192.168.3.51 -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -A INPUT -i eth2.4043 -s 192.168.3.202/32 -d 192.168.3.51 -p tcp -m tcp --dport 10051 -j ACCEPT
# TRACEROUTE SWITCHS
iptables -A INPUT -i eth2.4043 -p udp -s 192.168.3.0/24 --match multiport --dports 33440:33500 -j ACCEPT
# LIBERA O QUE FOR REALIZADO O 3H
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
## FORWARD
# DEFINE POLITICA PADRAO
iptables -P FORWARD DROP
# CHAIN FORWARD – COLOCAR LOGO ABAIXO DO DROP DA FORWARD
iptables -A FORWARD -o eth2.4043 -j SET --add-set entrada dst
iptables -A FORWARD -i eth2.4043 -j SET --add-set saida src
iptables -A FORWARD -m set --match-set entrada dst
iptables -A FORWARD -m set --match-set saida src
# EQUIPAMENTO INTERMEDIARIO DE TRAFEGO - FORWARD ABERTO
iptables -A FORWARD -s 0.0.0.0/0 -d 0.0.0.0/0 -j ACCEPT
# LIBERA O TRÁFEGO PASSANTE VINDO DA ETH2.4043
#iptables -A FORWARD -i eth2.4043 -j ACCEPT
# ICMP
#iptables -A FORWARD -p icmp -j ACCEPT
# LIBERA O QUE FOR REALIZADO O 3H
#iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
### NAT
# SERVIÇOS NO WINDOWS SERVER 2008
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 3389 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5622 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5630 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5631 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5632 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5633 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5634 -j DNAT --to-destination 192.168.3.202
iptables -t nat -A PREROUTING -i eth0.4042 -p tcp -m tcp --dport 5635 -j DNAT --to-destination 192.168.3.202
# REGRA DNAT ENTRADA C/ DESTINO P/ IP 177.38.128.210
iptables -t nat -A PREROUTING -d 177.38.128.210 -p tcp --dport 80 -j DNAT --to-destination 192.168.3.202:80
# REGRA SNAT P/ WINDOWS SERVER
iptables -t nat -A POSTROUTING -o eth2.4043 -s 192.168.0.0/16 -d 192.168.3.202 -p tcp --dport 80 -j MASQUERADE
# iptables -A FORWARD -p udp --dport 8081 -j ACCEPT
#iptables -A INPUT -i eth2.4043 -p tcp --dport 21 -j ACCEPT
## POSTROUTING
# NAT COM MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o eth0.4042 -j MASQUERAD
# NAT INTERFACE VPN - CODATA
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE