Topic: iptables
Hola a todos, debo hacer un scrip con iptables que cierre todo los puertos entrantes y solo dejar abiertos el 22 y el 80 y alguno mas que necesite luego, y que pueda hacer ping, ya tengo un scrip y me gustaria que me den su opinion y si debo agregarle alguna otra cosa mas. Saludos
### SCRIPT ###
#!/bin/sh
# Drop all incoming traffic
iptables -P INPUT DROP
# Drop all forwarded traffic
iptables -P FORWARD DROP
# Allow all outgoing traffic
iptables -P OUTPUT ACCEPT
# Allow returning packets
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Allow incoming traffic on port 80 for web server
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# Allow local traffic
iptables -A INPUT -i lo -j ACCEPT
# Allow incoming SSH on port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
# Allow ping
iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
chmod go-r /etc/sysconfig/iptables
service iptables restart
### /SCRIPT ###