Application Security - Task failed - Need help

Hello Team @Inderpreet @rahul456 @KodeKloud - Could you please look into my task and advise what could be mistake ?
The same exact steps worked fine for me for the first time when I worked on this task. Not sure what went wrong now.

We have a backup management application UI hosted on Nautilus’s backup server in Stratos DC. That backup management application code is deployed under Apache on the backup server itself, and Nginx is running as a reverse proxy on the same server. Apache and Nginx ports are 5001 and 8092, respectively. We have iptables firewall installed on this server. Make the appropriate changes to fulfill the requirements mentioned below:

We want to open all incoming connections to Nginx’s port and block all incoming connections to Apache’s port. Also make sure rules are permanent.


sudo iptables -L -nv

yum install iptables-services

cp /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config_bak

sudo iptables -A INPUT -p tcp --dport 8092 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 5001 -m conntrack --ctstate NEW -j REJECT

sudo iptables-save | sudo tee /etc/sysconfig/iptables

diff /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config_bak
systemctl start iptables
systemctl status iptables
systemctl enable iptables

sudo iptables -L -nv

systemctl restart iptables

sudo iptables -L -nv

I think you needed to do the below steps to make it work after the restart
sudo vi /etc/rc.local
then add the below
iptables-restore < /etc/sysconfig/iptables

I did this extra step and then it passed successfully.