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.

Disallow All IP for SSH except for French IP

Discussion in 'Security' started by French user, Jun 17, 2015.

  1. French user

    French user Registered

    Joined:
    Jun 17, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    France
    cPanel Access Level:
    Root Administrator
    Hello,

    Is it possible to disallow all IP for SSH / WHM / Cpanel except the French IP's ?
    Of course all countries must be allow to be visit the website hosted on my dedicated server...
    I checked in Home » Plugins » ConfigServer Security & Firewall and I found only the possibilty to disalow the IP's for all service include the website and not only SSH / WHM / Cpanel
    Thanks
     
  2. LostNerd

    LostNerd Well-Known Member

    Joined:
    Mar 12, 2014
    Messages:
    258
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Hastings, East Sussex, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    This would be a big task. Having to work out what subnets are exclusive to France and then building allow rules around them rather than trying to block 163 countries instead.

    I, personally would rather recommend that you lock it down via a hardware firewall (This is what I do) so that if my IP changes, I can update it in the hardware firewall and then log in to SSH respectively.
     
  3. French user

    French user Registered

    Joined:
    Jun 17, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    France
    cPanel Access Level:
    Root Administrator
    That's not a big task :) if the concept can work with France, the same setting can work with other country and avoid hacking....
    I don't have a fix IP internet connection but i'm alway in France, so that's the best solution to reduce the haking
     
  4. LostNerd

    LostNerd Well-Known Member

    Joined:
    Mar 12, 2014
    Messages:
    258
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Hastings, East Sussex, UK
    cPanel Access Level:
    Root Administrator
    Twitter:
    It simply reduces the chances of hacking to people who are able to use a VPN based in france. Which is still anybody with access to Google (Search free france based VPN).

    Can you ask your ISP what IP ranges they use? Even just allowing those ranges is safer than the entire country yet still not ideal.
     
  5. 24x7ss

    24x7ss Well-Known Member

    Joined:
    Sep 30, 2014
    Messages:
    271
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :),

    Instead of blocking countries, you can access the SSH using public key. As you are having dynamic IP from your ISP, you can setup a public key using which only you can connect through SSH, though your IP gets changes frequently. You can find more details at :
    https://documentation.cpanel.net/display/ALD/SSH+Shell+Access
     
  6. French user

    French user Registered

    Joined:
    Jun 17, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    France
    cPanel Access Level:
    Root Administrator
    public key can be a very good idea with SSH but it doesn't solve on WHM and Cpanel ;-)

    Concerning => Can you ask your ISP what IP ranges they use?
    It's like if I want try to talk with GOD :) the customer services doesn't know what is IP, they only know how to improve their business and they doesn't care with the rest....
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    The feature you are looking for is called "Host Access Control". It's documented at:

    WHM - Host Access Control

    This is an interface for the /etc/hosts.allow file. You can deny access to all IP addresses for services such as SSH or cPanel/WHM and only allow specific IP addresses or ranges. The key here is that you need to figure out which IP ranges you are connecting from so you know which IP addresses to whitelist. Your ISP might be able to help with this, or you can monitor your own IP address over time to see if the range changes.

    Thank you.
     
  8. keat63

    keat63 Well-Known Member

    Joined:
    Nov 20, 2014
    Messages:
    765
    Likes Received:
    20
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I have done exactly this .

    I found that my ISP uses only two ranges of IP, so I added both ranges as follows.

    192.168.0.0/255.255.0.0
    192.169.0.0/255.255.0.0

    Obviously ive obfuscated my real range, but you get the picture.

    You may need to add a few more as you find them, and you also run the risk of locking yourself out unless you add yourself something which you know is a static IP.
    For me, this was my work IP.
     
Loading...

Share This Page