feat(firewall): add safeguarded rule creation
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -41,6 +41,29 @@ final class SystemFirewallRuleService
|
||||
return $this->rules->fetch(FirewallRuleScope::system(), $ruleId);
|
||||
}
|
||||
|
||||
public function createRule(
|
||||
string $type,
|
||||
string $action,
|
||||
string $value,
|
||||
string $reason,
|
||||
?int $durationSeconds = null,
|
||||
?string $currentIp = null,
|
||||
bool $confirmCurrentIp = false
|
||||
): FirewallRuleObject {
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
return $this->rules->createManualRule(
|
||||
FirewallRuleScope::system(),
|
||||
$type,
|
||||
$action,
|
||||
$value,
|
||||
$reason,
|
||||
$this->identity->identifier(),
|
||||
$durationSeconds,
|
||||
$currentIp,
|
||||
$confirmCurrentIp
|
||||
);
|
||||
}
|
||||
|
||||
public function blockIp(string $ip, ?string $reason = null, ?int $durationSeconds = null): FirewallRuleObject
|
||||
{
|
||||
$this->requirePermission(self::PERMISSION_MANAGE);
|
||||
|
||||
Reference in New Issue
Block a user