New direction; removed wireguard, readme update
This commit is contained in:
26
app/Actions/Servers/SyncUfwRules.php
Normal file
26
app/Actions/Servers/SyncUfwRules.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Servers;
|
||||
|
||||
use App\Models\Server;
|
||||
use Spatie\QueueableAction\QueueableAction;
|
||||
|
||||
class SyncUfwRules
|
||||
{
|
||||
use QueueableAction;
|
||||
|
||||
public function execute(
|
||||
Server $server,
|
||||
) {
|
||||
$ssh = $server->sshClient();
|
||||
$result = $ssh->execute('wg show wg0');
|
||||
|
||||
if (! $result->isSuccessful()) {
|
||||
logger()->error('Failed to retrieve WireGuard rules', [
|
||||
'server_id' => $server->id,
|
||||
'error' => $result->getErrorOutput(),
|
||||
]);
|
||||
throw new \Exception('Failed to retrieve WireGuard rules');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user