8 |
+ $OUT .=<<"EOF"; |
+ $OUT .=<<"EOF"; |
9 |
+ |
+ |
10 |
+ # Use recent packets match to block SSH from sites generating |
+ # Use recent packets match to block SSH from sites generating |
11 |
+ # $abtries connections within $abtime seconds or $abtries2 in $abtime2 |
+ # $abtries connections within $abtime seconds |
12 |
+ # Check/clear IP block status in /proc/net/ipt_recent/SSH |
+ # Check/clear IP block status in /proc/net/ipt_recent/SSH |
13 |
+ /sbin/iptables --new-chain SSH_Autoblock |
+ /sbin/iptables --new-chain SSH_Autoblock |
14 |
+ /sbin/iptables --append SSH_Autoblock -m recent --set --name SSH |
+ /sbin/iptables --append SSH_Autoblock -m recent --set --name SSH |
46 |
+ /sbin/iptables --replace SSH_Autoblock 2 -m recent --rcheck --rttl \\ |
+ /sbin/iptables --replace SSH_Autoblock 2 -m recent --rcheck --rttl \\ |
47 |
+ --seconds $abtime --hitcount $abtries --name SSH -j denylog |
+ --seconds $abtime --hitcount $abtries --name SSH -j denylog |
48 |
+ # Clear SSH_Autoblock site history too |
+ # Clear SSH_Autoblock site history too |
49 |
+ echo clear > /proc/net/xt_recent/SSH |
+ echo / > /proc/net/xt_recent/SSH |
50 |
+EOF |
+EOF |
51 |
+} |
+} |
52 |
|
|