fix(engine): honour configured WireGuard prefix length in wg0.conf

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 10:39:46 +02:00
parent 18d1ed2424
commit f240401a42
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use App\Provisioning\StepResult;
use App\Services\Ssh\RemoteShell;
use App\Services\Wireguard\WireguardHub;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
* Installs WireGuard on the host, allocates a management IP, registers the host
@ -74,10 +75,11 @@ class ConfigureWireguard extends HostStep
private function renderConfig(string $wgIp, string $privateKey): string
{
$subnet = (string) config('provisioning.wireguard.subnet', '10.66.0.0/24');
$prefix = Str::afterLast($subnet, '/'); // honour the configured prefix length
return implode("\n", [
'[Interface]',
"Address = {$wgIp}/24",
"Address = {$wgIp}/{$prefix}",
"PrivateKey = {$privateKey}",
'',
'[Peer]',