Issue with - Linux network services task

Hi Inderpreet/Kodekloud team,

Can someone shed some light on this task and let me know where im doing wrong.

The task was to check Apache httpd service is not reachable from jump host.

Solution i applied was:

  1. Checked 8080 port was in use by sendmail service. Hence stopped that service and disabled it.
  2. Started httpd service and it got started.
  3. Checked httpd was listening with port 8080.
  4. Added iptables rule and saved it.
  5. Checked from jumphost still apache service was not accessible neither telnet.
  6. Firewalld service was not active.
  7. my email id: ramashish.sharma@gmail.com
    Attaching screenshot for all my above points.

Task_1

Okay, after some research, i realised my mistake, I have actually inserted my new rule after a existing “REJECT” rule in iptables using “iptables -A” command.

iptables work in the order starting from top to bottom…so the formula here is whenever you add a new rule it should be above a REJECT rule and how to do that. Here it is.

Always use -I INPUT (hypen Capital Letter I) which always places your new rule to the top.
Avoid using -A INPUT (hypen Capital A simply appends rule at the end of all rules in file:/etc/sysconfig/iptables)

2 Likes