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]',