From b526e4998161c217ac0af88ad616e32bdac314c7 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 25 Apr 2024 19:33:21 +0200 Subject: [PATCH] wireguard.cgi: Correctly compose the FQDN Signed-off-by: Michael Tremer --- html/cgi-bin/wireguard.cgi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/wireguard.cgi b/html/cgi-bin/wireguard.cgi index f1e8eda91..bcc51a7b6 100644 --- a/html/cgi-bin/wireguard.cgi +++ b/html/cgi-bin/wireguard.cgi @@ -1245,6 +1245,13 @@ sub generate_client_configuration($) { push(@allowed_ips, "${netaddress}/${prefix}"); } + # Build the FQDN of the firewall + my $fqdn = join(".", ( + $General::mainsettings{'HOSTNAME'}, + $General::mainsettings{'DOMAINNAME'}, + )); + my $port = $settings{'PORT'}; + my @conf = ( "[Interface]", "PrivateKey = $peer->{'PRIVATE_KEY'}", @@ -1252,7 +1259,7 @@ sub generate_client_configuration($) { "", "[Peer]", - "Endpoint = $General::main{'HOSTNAME'}.$General::main{'DOMAINNAME'}", + "Endpoint = ${fqdn}:${port}", "PublicKey = $settings{'PUBLIC_KEY'}", "PresharedKey = $peer->{'PSK'}", "AllowedIPs = " . join(", ", @allowed_ips), -- 2.39.5