检测sshd端口误封脚本

#!/bin/bash
a=`/sbin/iptables -nvL --line-number |awk '/dpt:22/{if($4=="DROP" -o $4=="REJECT")print}'|wc -l`
if [ "$a" -lt 2 ]
then
echo "$a" >> /tmp/iptable22.log
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
#/etc/init.d/iptables restart
fi


你可能感兴趣的:(SSHD,22端口)