OpenSSH is tool used for connecting and managing remote linux machines. And this should be secured. I am here by telling some security tips to make the SSH server perfect.
1.
The following iptable rule will drop incoming connections which make more than 5 connection attempts upon port 22 within 60 secondsiptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --setiptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 5 -j DROP2.Disable Empty PasswordsOpen the file /etc/sshd/sshd_config and
PermitEmptyPasswords no3.TCPWrappersopen --> vi /etc/hosts.denysshd:ALLthen
open --> vi /etc/hosts.allosshd:192.168.1.32 192.168.1.21 (Change to your desired IP)4.Change the SSH PortThe Idea behind this , suppose we change the port 22 to something other say Oracle 1521 , the attackers thinks that this is an Oracle server and will try oracle hacking tools :)
Port 300
5.Force Logout for Idle Sessions
ClientAliveInterval 300
ClientAliveCountMax 0
And to be continued .......