I want this behaviour:
All outside computers can only bind to my server's ports 22(ssh), 80(http) and 443(https).
However all localhost apps can bind to any port they want.
I have search and this is what I came up with:
iptables -A INPUT -p tcp -m tcp -m multiport ! --dports 22,80,443 -j DROP
It does what I want, but blocks to all localhost apps as well. What should I change there to enable localhost apps bind to any port?
And then how can I make the rule permanent?
Thanks!
-s 127.0.0.1
?