Get the most out of your Centmin Mod LEMP stack
Become a Member

CSF Allow Defined ip's only for SSH Access

Discussion in 'Other Centmin Mod Installed software' started by negative, Jan 31, 2017.

  1. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    12:39 PM
    1.9.10
    10.1.11
    Hello


    I want to set SSH access only my defined ip's to my server. Others should be blocked. How can i do it easily. I have defined cloudflare ip's on csf.allow file already so i don't want any mistake and i ask you what is best way to configure it

    p.s: my ssh port is not standart port (22)

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:39 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    12:39 PM
    1.9.10
    10.1.11
    I aggree yes but i bought static ip from my ISP, so it is securely.

    I don't want to go with method-1 because of i worry about csf-iptables problems.

    Method2 is fine, but i don't understand on examples. That website says, use deny list for prevent some ip's. But i want denny all ip's except my ip. So, hosts.allow must be contain my ip then hosts.deny file must be contain that deny all ips ?

    Like that? Thanks
    # /etc/hosts.allow
    sshd: 1.2.3.0

    # /etc/hosts.deny
    sshd: ALL
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:39 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+