fix(engine): derive WireGuard hub IP from the configured subnet

hub_ip is now defined in config (default: subnet .1), so a custom
CLUPILOT_WG_SUBNET no longer pings the wrong handshake target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 10:38:17 +02:00
parent ced7e6103d
commit 18d1ed2424
2 changed files with 6 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class ConfigureWireguard extends HostStep
// Always verify the tunnel is up — including the idempotent replay path, // Always verify the tunnel is up — including the idempotent replay path,
// so we never advance onto Proxmox API calls over a dead tunnel. // so we never advance onto Proxmox API calls over a dead tunnel.
$hubIp = (string) config('provisioning.wireguard.hub_ip', '10.66.0.1'); $hubIp = (string) config('provisioning.wireguard.hub_ip');
if (! $this->shell->run('ping -c1 -W2 '.escapeshellarg($hubIp))->ok()) { if (! $this->shell->run('ping -c1 -W2 '.escapeshellarg($hubIp))->ok()) {
return StepResult::retry(15, 'WireGuard handshake not up yet'); return StepResult::retry(15, 'WireGuard handshake not up yet');
} }

View File

@ -1,6 +1,9 @@
<?php <?php
use App\Provisioning\Steps\Host; use App\Provisioning\Steps\Host;
use Illuminate\Support\Str;
$wgSubnet = env('CLUPILOT_WG_SUBNET', '10.66.0.0/24');
return [ return [
/* /*
@ -25,7 +28,8 @@ return [
// CluPilot VM acts as the WireGuard hub; hosts join it during onboarding. // CluPilot VM acts as the WireGuard hub; hosts join it during onboarding.
'wireguard' => [ 'wireguard' => [
'subnet' => env('CLUPILOT_WG_SUBNET', '10.66.0.0/24'), 'subnet' => $wgSubnet,
'hub_ip' => env('CLUPILOT_WG_HUB_IP', Str::beforeLast($wgSubnet, '.').'.1'), // handshake target
'endpoint' => env('CLUPILOT_WG_ENDPOINT', ''), // host:port reachable by peers 'endpoint' => env('CLUPILOT_WG_ENDPOINT', ''), // host:port reachable by peers
'hub_public_key' => env('CLUPILOT_WG_HUB_PUBKEY', ''), 'hub_public_key' => env('CLUPILOT_WG_HUB_PUBKEY', ''),
'config_path' => env('CLUPILOT_WG_CONFIG_PATH', '/etc/wireguard/wg0.conf'), 'config_path' => env('CLUPILOT_WG_CONFIG_PATH', '/etc/wireguard/wg0.conf'),