initial commit of file from CVS for smeserver-fail2ban on Sat Sep 7 19:53:17 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 19:53:18 +10:00
parent 1700d73fa1
commit 197253af46
86 changed files with 8686 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::ConfigDB;
my $c = esmith::ConfigDB->open_ro;
my $f = esmith::ConfigDB->open('fail2ban');
my $f2b = $c->get('fail2ban');
exit (0) unless ($f2b);
my $bantime = $f2b->prop('BanTime') || '1800';
my $mod = 0;
foreach my $ban ($f->get_all_by_prop( type => 'ban')){
my $ts = $ban->prop('UnbanTimestamp') || time+$bantime;
if ( $ts < time ){
$ban->delete;
$mod = 1;
}
}
if ($mod == 1){
die "An error occured during fail2ban rule update\n"
unless (system('/sbin/e-smith/signal-event fail2ban-update') == 0);
}
exit (0);