From f240401a422befe428d2b09643122f09eb87f414 Mon Sep 17 00:00:00 2001 From: nexxo Date: Sat, 25 Jul 2026 10:39:46 +0200 Subject: [PATCH] fix(engine): honour configured WireGuard prefix length in wg0.conf Co-Authored-By: Claude Opus 4.8 --- app/Provisioning/Steps/Host/ConfigureWireguard.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Provisioning/Steps/Host/ConfigureWireguard.php b/app/Provisioning/Steps/Host/ConfigureWireguard.php index 0f0120d..18647d8 100644 --- a/app/Provisioning/Steps/Host/ConfigureWireguard.php +++ b/app/Provisioning/Steps/Host/ConfigureWireguard.php @@ -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]',