firewall enable parameter type changed from boolean to integer so it can store
the timestamp of the firewall enable call to avoid an admin remote lockout
Signed-off-by: Alen Grizonic <a.grizonic@proxmox.com>
my $option_properties = {
enable => {
- type => 'boolean',
+ type => 'integer',
+ minimum => 0,
optional => 1,
},
policy_in => {
}
}
- if (defined($param->{enable})) {
- $param->{enable} = $param->{enable} ? 1 : 0;
+ if (defined($param->{enable}) && ($param->{enable} > 1)) {
+ $param->{enable} = time();
}
foreach my $k (keys %$option_properties) {
optional => 1,
},
enable => {
- type => 'boolean',
+ type => 'integer',
+ minimum => 0,
optional => 1,
},
sport => {
my ($opt, $value);
- if ($line =~ m/^(enable):\s*(0|1)\s*$/i) {
+ if ($line =~ m/^(enable):\s*(\d+)\s*$/i) {
$opt = lc($1);
$value = int($2);
+ if (($value > 1) && ((time() - $value) > 60)) {
+ $value = 0
+ }
} elsif ($line =~ m/^(policy_(in|out)):\s*(ACCEPT|DROP|REJECT)\s*$/i) {
$opt = lc($1);
$value = uc($3);