SSH安全防护笔记
1
利用IPTABLES
命令如下:iptables -A INPUT -P TCP -s 192.168.1.1 -j ACCEPT 对192.168.1.1放行(也可以用域名)
iptables -A INPUT -P TCP --dport 22 -j DROP
2
利用/etc/hosts.*下面的文件
/etc/hosts.allow 和/etc/hosts.deny这2个文件
在/etc/hosts.allow增加一条规则
vim hosts.allow
#
sshd:192.168.1.1
#
vim hosts.deny
#
sshd:all
#
上面的意思就是 只对192.168.1.1放行
iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 2 --name SSH --rsource -j DROP
iptables -A INPUT -P tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name SSH --rsource -j ACCEPT
上面意思就是说 在输入了2次错误的SSH密码以后 将会在60秒内访问不了SSH 而且还会在/proc/net/ipt_recent/目录下生成SSH文件.记录你的IP.当然时间可以更改
顶(0)
踩(0)
- 最新评论
