- Muchas notas - Fran Acién

20231218 - Iptables restrict ports and open a specific port

I am realising that my ansible configuration has some errors >.< That is why I am going to show some important things of iptables.

Delete all the iptables configuration

iptables -F
iptables -X

Open a specific port

I have my ssh in 666, so I need to open it to allow access to that port:

iptables -A INPUT -p tcp --dport 666 -j ACCEPT

Open HTTPS port

iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT