Command to check if X port is open in IPTABLES and check if open in CSF?

000

Well-Known Member
Jun 3, 2008
194
3
68
Hi.

If X command is CLOSED in IPTABLES, but OPEN in rules of CSF = port no accesible
If X command is OPEN in IPTABLES, but CLOSED in rules of CSF = port no accesible

Then... Please:

With what command I check if X port is open/closed in IPTABLES ???

With what command I check if X port is open/closed in CSF ???

Thanks
 

cPMelaniel

Technical Analyst Supervisor
Staff member
Jun 25, 2013
9
1
78
Houston,Tx
cPanel Access Level
Root Administrator
Re: Command to check if X port is open in IPTABLES and OTHER command to check if is open in CSF - Th

Hi.

If X command is CLOSED in IPTABLES, but OPEN in rules of CSF = port no accesible
If X command is OPEN in IPTABLES, but CLOSED in rules of CSF = port no accesible

Then... Please:

With what command I check if X port is open/closed in IPTABLES ???

With what command I check if X port is open/closed in CSF ???

Thanks

CSF is simply a GUI for the IPTABLES firewall on the server. If the port is open or blocked in one, it should be the same status in the other.

Try using nmap to scan the ports.


EX:

nmap -Pn $IP -p $PORT
 

000

Well-Known Member
Jun 3, 2008
194
3
68
Re: Command to check if X port is open in IPTABLES and OTHER command to check if is open in CSF - Th

If the port is open or blocked in one, it should be the same status in the other.
Thanks.

I like detect if X port is blocked BY CSF or BY IPTABLES.

By this I like a command similar to:

csf -status_of_ -portX
iptables -status_of_ -portX

to I can detect if port is BLOCKED by IPTABLES, by CSF or by BOTH
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
86
78
cPanel Access Level
DataCenter Provider
Re: Command to check if X port is open in IPTABLES and OTHER command to check if is open in CSF - Th

CSF just manages IPtables. If something is blocked in CSF, CSF blocks it by making an iptables rule.

You can make your own iptables rules outside of CSF using some of it's included files/configuration, but you should know if you have done this.

If you restart CSF it creates all your iptables rules based on CSF config. There should not be differences.

You can just run this to see all the actual iptables rules, but there will be a lot if you use LFD blocking:

Code:
iptables -L -n
 

000

Well-Known Member
Jun 3, 2008
194
3
68
Re: Command to check if X port is open in IPTABLES and OTHER command to check if is open in CSF - Th

Code:
iptables -L -n
Thanks.

This show just ALL RULES...

I need samplely know if X port is open, and this show all rules...
 

24x7server

Well-Known Member
Apr 17, 2013
1,894
91
78
India
cPanel Access Level
Root Administrator
Re: Command to check if X port is open in IPTABLES and OTHER command to check if is open in CSF - Th

Hello,

Check the port status in iptables with the following command

Code:
iptables -L -n | grep :PORT