in Basic All Posts ~ read.
How to lock down SSH access

How to lock down SSH access

If you are using iptables for your machine Firewall.

Below script might help to lock down SSH access which only allow specific IP to connect via SSH.

##########################
# LOCK DOWN
##########################
for IP in 111.111.111.111 222.222.222.222 333.333.333.333 444.444.444.444/27 ; do
/sbin/iptables -A INPUT -p tcp -s $IP –dport (SSH PORT)-j ACCEPT
/sbin/iptables -A OUTPUT -p tcp -d $IP –sport (SSH PORT)-j ACCEPT
done
iptables -A INPUT -p tcp –dport (SSH PORT) -j DROP
iptables -A OUTPUT -p tcp –sport (SSH PORT)-j DROP

#####################

Make sure to change (SSH PORT) to your SSH Port.

Hope this would be useful.

// reference //Initialize ghostHunter