I copied this rule off someone for TCP SSH connections:
iptables -A INPUT -p tcp --sport 1024:65535 --dport 22 -m state --state
NEW,ESTABLISHED
-j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 --dport 1024:65535 -m state --state
ESTABLISHED -j
ACCEPT
iptables -A OUTPUT -p tcp --sport 1024:65535 --dport 22 -m state --state
NEW,ESTABLISHED
-j ACCEPT
iptables -A INPUT -p tcp --sport 22 --dport 1024:65535 -m state --state ESTABLISHED
-j
ACCEPT
Here it is in Pastie if it helps: http://pastie.org/2007433
It seems okay but let me know if I've made any mistakes.
I know I can't use ESTABLISHED for UDP connections but if I want to open up a port,
say
UDP port 12345, what other options can I give to be safer ? Can RELATED be used for
example ?
Help would be great ! | |