We have SSH open on one of our production servers leaving it prone to various brute force attacks to break in. I reduced the attempts by changing the default port from 22.
I want to further harden security by allowing ssh login from a particular country domain .in only. For this I can configure /etc/hosts.deny or /etc/hosts.allow .
For hosts.allow, I have added the following entry
sshd: in
If I use hosts.deny, then my entry is like this
sshd: !in
After configuring any one of the above, I am noticing that it takes more time to connect to the ssh server.
With verbose it is showing hanging here for some time before providing the login attempt
ssh -vv 103.8.X.X
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 103.8.X.X [103.8.X.X] port 565.
debug1: Connection established.
debug1: identity file /home/amin/.ssh/id_rsa type -1
debug1: identity file /home/amin/.ssh/id_rsa-cert type -1
debug1: identity file /home/amin/.ssh/id_dsa type -1
debug1: identity file /home/amin/.ssh/id_dsa-cert type -1
debug1: identity file /home/amin/.ssh/id_ecdsa type -1
debug1: identity file /home/amin/.ssh/id_ecdsa-cert type -1 (<-- hangs here for arnd 30 secs)
It takes more time with putty , after setting rules for tcp wrappers.