Find out the open ports in an instance

 Below command will list out ports which are already defined in the linux machine:

$ semanage port -l | grep http_port_t


http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988


If you wish to add a new port to the list, run the below command:


$ semanage port -l | grep http_port_t -p tcp 7001


http_port_t                    tcp      7001, 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988


Check if firewall rules are enabled:


$ service iptables status


Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination


If you wish to add specific port to firewall rules, run below command:


$ iptables -A INPUT -p tcp -m tcp --dport 7001 -j ACCEPT


Comments

Post a Comment

Popular posts from this blog

12 tweakings for WHM/cPanel to speed up WordPress

Error: could not open mime types config file

Disabling open relay on cPanel server