Plugins base (#613)

* wip

* wip

* cleanup

* notification channels

* phpstan

* services

* remove server types

* refactoring

* refactoring
This commit is contained in:
Saeed Vaziry
2025-06-14 14:35:18 +02:00
committed by GitHub
parent adc0653d15
commit 131b828807
311 changed files with 3976 additions and 2660 deletions

57
app/Services/Firewall/Ufw.php Executable file
View File

@ -0,0 +1,57 @@
<?php
namespace App\Services\Firewall;
use App\Enums\FirewallRuleStatus;
use App\Exceptions\SSHError;
class Ufw extends AbstractFirewall
{
public static function id(): string
{
return 'ufw';
}
public static function type(): string
{
return 'firewall';
}
public function unit(): string
{
return 'ufw';
}
/**
* @throws SSHError
*/
public function install(): void
{
$this->service->server->ssh()->exec(
view('ssh.services.firewall.ufw.install-ufw'),
'install-ufw'
);
$this->service->server->os()->cleanup();
}
public function uninstall(): void
{
//
}
/**
* @throws SSHError
*/
public function applyRules(): void
{
$rules = $this->service->server
->firewallRules()
->where('status', '!=', FirewallRuleStatus::DELETING)
->get();
$this->service->server->ssh()->exec(
view('ssh.services.firewall.ufw.apply-rules', ['rules' => $rules]),
'apply-rules'
);
}
}