From 0ba11fc416fda0045a33f693b3c930dab8a8418f Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 2 May 2013 14:00:14 +0200 Subject: [PATCH] pass bantime arg to smeserver-fail2ban action --- root/etc/fail2ban/action.d/smeserver.conf | 3 ++- root/sbin/e-smith/smeserver-fail2ban | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/root/etc/fail2ban/action.d/smeserver.conf b/root/etc/fail2ban/action.d/smeserver.conf index 16e5a3d..d14e5c7 100644 --- a/root/etc/fail2ban/action.d/smeserver.conf +++ b/root/etc/fail2ban/action.d/smeserver.conf @@ -1,9 +1,10 @@ [Definition] -actionban = /sbin/e-smith/smeserver-fail2ban --host= --proto= --port= +actionban = /sbin/e-smith/smeserver-fail2ban --host= --proto= --port= --bantime= actionunban = /sbin/e-smith/smeserver-fail2ban --host= --unban --proto= --port= [Init] protocol = undef port = undef +bantime = undef diff --git a/root/sbin/e-smith/smeserver-fail2ban b/root/sbin/e-smith/smeserver-fail2ban index 6a4e7c4..d1605d4 100644 --- a/root/sbin/e-smith/smeserver-fail2ban +++ b/root/sbin/e-smith/smeserver-fail2ban @@ -74,12 +74,14 @@ GetOptions( "unban" => \$opts{unban}, "protocol=s" => \$opts{proto}, "port=s" => \$opts{port}, - "bantime=i" => \$opts{bantime} + "bantime=s" => \$opts{bantime} ); # special "undef" value for port and proto undef $opts{proto} if ($opts{proto} eq 'undef'); undef $opts{port} if ($opts{port} eq 'undef'); +$opts{bantime} = ($f2b->prop('BanTime') || '1800') + if ($opts{bantime} eq 'undef'); # Check options are valid