I was wondering how I could deny all SSH logins from any IP but mine? This would be using IPTables.
2 Answers
There are multiple ways to do this using iptables - From the command line:
/sbin/iptables -I INPUT -s MY.IP -p tcp --dport 22 -j ACCEPT /sbin/iptables -I INPUT -p tcp --dport 22 -j DROP
You can do a similar thing leaving out the /sbin/iptables, adding it near the top of /etc/sysconfig/iptables and then doing a restart.
If you want to steer clear of IPTables altogether you can simply modify the SSHD config by adding the following line to the end of /etc/ssh/ssd_config (and then restarting sshd)
AllowUsers [email protected]
(If there is more then one user you can use the form AllowUsers [email protected] myuser2@myip [email protected] )
Looks like you need to configure iptables as @davidgo has mentioned. Adding:
-A RH-Firewall-1-INPUT -s 192.168.1.1 -m state --state NEW -p tcp --dport 22 -j ACCEPT
to your /sbin/iptables might work (change the ip to the desired address).