Commit 804ebfca authored by david's avatar david

auto ban

parent ee988af7
......@@ -28,7 +28,7 @@ use warnings;
## open the log file. we are using the system binary tail which is smart enough
## to follow rotating logs. We could have used File::Tail, but tail is easier.
open(LOG,"/usr/bin/tail -90000000 $log |") || die "ERROR: could not open log file.\n";
open(LOG,"/usr/bin/tail -1000000 $log |") || die "ERROR: could not open log file.\n";
while(<LOG>) {
## process the log line if it contains one of these error codes
......@@ -36,7 +36,7 @@ use warnings;
{
## Whitelisted ips. This is where you can whitelist ips that cause errors,
if ($_ !~ m/^(66\.249\.|192\.168\.)/)
if ($_ !~ m/^(127\.0\.|192\.168\.)/)
{
## extract the ip address from the log line and get the current unix time
......@@ -54,8 +54,8 @@ use warnings;
if ($abusive_ips{ $ip }->{ 'errors' } >= 3 ) {
print "abuse from ip $ip username $username \n";
print "fail2ban-client set manban banip $ip \n\n";
print "abuse from ip $ip username $username, trigged manban with fail2ban \n";
system("fail2ban-client set manban banip $ip");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment