Secure SSH to IP address by IPTABLES

Discussion in 'Installation/Configuration' started by Ripeed, Nov 13, 2013.

  1. Ripeed

    Ripeed Member

    Hi everyone, I have server with ISPconfig3. I know that ISPconfig block ssh attack by fail2ban. But I want to have secured ssh only to one IP address or more what I choose.

    So question is... If I make rules in IPTABLES will it make something with ISPconfig configuration?

    And another question is how to do that right? What will be right code for IPTABLES.

    Thanks a lot for advice!
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You can limit ssh-connections to one or more ip. But i would just change the sshd-port in /etc/ssh/sshd_config. Maybe 222

    To limit the acces with iptables:
    iptables -I INPUT -p tcp -m tcp --dport 22 -s YOUR_IP  -j ACCEPT
    iptables -I INPUT -p tcp -m tcp --dport 22 -j DROP

Share This Page