feat(firewall): add audited rule lifecycle management
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -103,23 +103,44 @@ final class SystemFirewallRuleService
|
||||
);
|
||||
}
|
||||
|
||||
public function disableRule(string $ruleId): bool
|
||||
public function disableRule(string $ruleId, string $reason): ?FirewallRuleObject
|
||||
{
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
return $this->rules->disable(
|
||||
FirewallRuleScope::system(),
|
||||
$ruleId,
|
||||
$this->identity->identifier()
|
||||
return $this->rules->disableManual(
|
||||
FirewallRuleScope::system(), $ruleId, $reason, $this->identity->identifier()
|
||||
);
|
||||
}
|
||||
|
||||
public function removeRule(string $ruleId): bool
|
||||
{
|
||||
public function enableRule(
|
||||
string $ruleId,
|
||||
string $reason,
|
||||
?string $currentIp = null,
|
||||
bool $confirmCurrentIp = false
|
||||
): ?FirewallRuleObject {
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
return $this->rules->remove(
|
||||
return $this->rules->enableManual(
|
||||
FirewallRuleScope::system(),
|
||||
$ruleId,
|
||||
$this->identity->identifier()
|
||||
$reason,
|
||||
$this->identity->identifier(),
|
||||
$currentIp,
|
||||
$confirmCurrentIp
|
||||
);
|
||||
}
|
||||
|
||||
public function extendRule(string $ruleId, int $durationSeconds, string $reason): ?FirewallRuleObject
|
||||
{
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
return $this->rules->extendManual(
|
||||
FirewallRuleScope::system(), $ruleId, $durationSeconds, $reason, $this->identity->identifier()
|
||||
);
|
||||
}
|
||||
|
||||
public function removeRule(string $ruleId, string $reason): ?FirewallRuleObject
|
||||
{
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
return $this->rules->removeManual(
|
||||
FirewallRuleScope::system(), $ruleId, $reason, $this->identity->identifier()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user