0

As part of a "Hardening" task, I need to run

iptables -P INPUT DROP 
iptables -P OUTPUT DROP 
iptables -P FORWARD DROP

On our servers. Normally we would run this command and then run /sbin/iptables-save to implement the new policy. However as soon as I ran iptables -P OUTPUT DROP my SSH disconnected. Is this due to the OS being RHEL? How do I configure this machine to allow my IP address through?

searcot jabali
  • 261
  • 1
  • 2
  • 6

1 Answers1

1

If you really want to just allow your "IP address through", you need to allow your IP in and out before setting the default policy. So, before any other iptables commands run something like this:

iptables -I INPUT -s 192.168.241.1 -j ACCEPT

iptables -I OUTPUT -d 192.168.241.1 -j ACCEPT

(Of course substitute 192.168.241.1 for your IP address.)

In real life though we normally do stuff a bit more elegantly, but in your specific task/situation/question this should give your IP free access you want.

It should be noted that default DROP policies without any amendments will disrupt many basic network functionalities. If this is a school lab or something, next steps are probably allowing basic networking functionalities with iptables again.