|
|
@ -114,16 +114,16 @@ if ($opts{unban}){ |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
my $id = generate_uniq_id(); |
|
|
|
my $id = generate_uniq_id(); |
|
|
|
$f2bdb->new_record($id, {type => 'ban'}); |
|
|
|
my %props; |
|
|
|
$f2bdb->set_prop($id, 'Host', $opts{host}); |
|
|
|
$props{'type'} = 'ban'; |
|
|
|
$f2bdb->set_prop($id, 'Protocol', $opts{proto}) |
|
|
|
$props{'Host'} = $opts{host}; |
|
|
|
|
|
|
|
$props{'Protocol'} = $opts{proto} |
|
|
|
if ($opts{proto}); |
|
|
|
if ($opts{proto}); |
|
|
|
$f2bdb->set_prop($id, 'Port', $opts{port}) |
|
|
|
$props{'Port'} = $opts{proto} |
|
|
|
if ($opts{port}); |
|
|
|
if ($opts{proto}); |
|
|
|
# Set the current timestamp |
|
|
|
$props{'BanTimestamp'} = time(); |
|
|
|
$f2bdb->set_prop($id, 'BanTimestamp', time()); |
|
|
|
$props{'UnbanTimestamp'} = time()+$opts{bantime}; |
|
|
|
# Set the timestamp of the unban |
|
|
|
$f2bdb->new_record($id, \%props); |
|
|
|
$f2bdb->set_prop($id, 'UnbanTimestamp', time()+$opts{bantime}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
die "An error occured while updating the firewall rules" |
|
|
|
die "An error occured while updating the firewall rules" |
|
|
|