Skip to content

Commit

Permalink
Allow if in case of firewall state is set to monitor for default filt…
Browse files Browse the repository at this point in the history
…ers.
  • Loading branch information
oyeaussie committed Aug 4, 2024
1 parent d88e770 commit 953b702
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,23 @@ public function checkIp($ip = null, array $overrideIp2locationLookupSequence = n
$newFilter['updated_by'] = "000";
$newFilter['updated_at'] = time();
$newFilter['filter_type'] = $this->config['default_filter'];
$this->addFilter($newFilter, true);
$filter = $this->addFilter($newFilter, true);
}

$this->setMicroTimer('defaultCheckIpFilter', true);

if ($this->config['default_filter'] === 'allow') {
$this->addResponse('Allowed by default firewall filter', 0);
$this->addResponse('Allowed by default firewall filter', 0, ['filter' => $filter]);

return true;
} else if ($this->config['default_filter'] === 'block') {
$this->addResponse('Blocked by default firewall filter', 1);
if ($this->config['status'] === 'monitor') {
$this->addResponse('IP address is blocked, but firewall status is monitor so ip address is allowed!', 2, ['filter' => $filter]);

return true;
}

$this->addResponse('Blocked by default firewall filter', 1, ['filter' => $filter]);

return false;
}
Expand Down

0 comments on commit 953b702

Please sign in to comment.