1
2
3
4
5
6
7
8
|
#!/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
|
本文转自wsw26 51CTO博客,原文链接:http://blog.51cto.com/wsw26/1757556,如需转载请自行联系原作者