The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

i need to open a port linux linux whm server

Discussion in 'Security' started by shufil, Jul 12, 2014.

  1. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello,

    I need to open port 8080, so I added to two IPtables rules:

    iptables -A INPUT -m state --state NEW -m tcp -p tcp -d remoteserverip --dport 8080 -j ACCEPT
    iptables -I OUTPUT -p tcp -d remoteserverip --sport 8080 --dport 8080 -j ACCEPT

    The port still seems to be closed:
    telnet localhost 8080
    Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused

    Please advice .

    Regards,
    Shufil
     
  2. triantech

    triantech Well-Known Member

    Joined:
    Jul 1, 2014
    Messages:
    145
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Kochi, India, India
    cPanel Access Level:
    Root Administrator
    Shufil,

    does your WHM server has csf enabled ?
     
  3. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Which service is running on your 8080 port ?

    And what is the output of following command ?

    Code:
    netstat -apn | grep 8080
    
    iptables -nL |  grep 8080
     
  4. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello triantech,

    CSF is not installed , only running iptable .

    Regards,
    Shufil

    - - - Updated - - -

    Hello,
    netstat -apn | grep 8080 not give any reply ,
    iptables -nL | grep 8080
    ACCEPT tcp -- 0.0.0.0/0 remoteip state NEW tcp dpt:8080
    ACCEPT tcp -- 0.0.0.0/0 rempteip tcp spt:8080 dpt:8080

    Regards,
    Shufil
     
  5. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    also i added without -d
    iptables -A INPUT ( output both udp and tcp ) -m state --state NEW -m udp -p udp --dport 8080 -j ACCEPT
    so result is
    iptables -nL | grep 8080
    ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
    ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW udp dpt:8080
    ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
    ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW udp dpt:8080

    Regards,
    Shufil
     
  6. triantech

    triantech Well-Known Member

    Joined:
    Jul 1, 2014
    Messages:
    145
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Kochi, India, India
    cPanel Access Level:
    Root Administrator
    Shufil,

    what exactly is running on that port? iS the service running? If not telnet would be showing
    connection refused , as there is nothing running to connect :D
     
  7. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi triantech ,

    Thanks for reply ,
    You mean is this enough for port open , and how can we check a port open or not ?
    netstat -apn | grep 8080 , not getting any reply .
     
  8. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    You have added correct rule in firewall to open a port 8080 but currently you are not running any services on port 8080 and due to that netstat command is not showing any output.
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will need to ensure a service is listening for connections on port 8080 before it will respond to connection requests. Are you attempting to have a service such as Apache run on port 8080?

    Thank you.
     
  10. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello,

    But i try to pass a url with port number 8080 using curl program , but still i getting error that is coult not connect host .
    So i believe still that port is close .

    - - - Updated - - -

    Hello,

    Yes i need to add service http with port number , currently port 80 443 running with http .
     
  11. triantech

    triantech Well-Known Member

    Joined:
    Jul 1, 2014
    Messages:
    145
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Kochi, India, India
    cPanel Access Level:
    Root Administrator
    shufil ,

    You can configure the ports associated with the service Apache from WHM as follows :

    Home »Server Configuration »Tweak Settings >> under the section "System"
     
  12. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    HI Triantech ,

    There seems port 80 and 443 in default , if we need to add other port we need to drop 80 or 443 ?

    Regards,
    Shufil
     
    #12 shufil, Jul 21, 2014
    Last edited: Jul 21, 2014
  13. triantech

    triantech Well-Known Member

    Joined:
    Jul 1, 2014
    Messages:
    145
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Kochi, India, India
    cPanel Access Level:
    Root Administrator
    Hello,

    If you want to make Apache non-SSL connections, drop 80 and add 8080, or the other way around for
    the SSL connections.
     
  14. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello ,

    Both are need , becouse non and ssl site are running in server .

    Regards,
    Shufil
     
  15. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can add multiple "Listen" entries in the Apache configuration file. Here is an example of the existing default entries:

    Code:
    # grep Listen /usr/local/apache/conf/httpd.conf
    Listen 0.0.0.0:80
    Listen [::]:80
        Listen 0.0.0.0:443
        Listen [::]:443
    Documentation on making modifications to the Apache configuration file is available here:

    Custom Directives Outside of a VirtualHost Tag

    Thank you.
     
  16. shufil

    shufil Well-Known Member

    Joined:
    Mar 19, 2014
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator

    Hello,

    Thanks , nice .

    Regards,
    Shufil
     
Loading...

Share This Page