From: Michael Tremer Date: Thu, 25 Apr 2024 17:33:21 +0000 (+0200) Subject: wireguard.cgi: Correctly compose the FQDN X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b526e4998161c217ac0af88ad616e32bdac314c7;p=people%2Fstevee%2Fipfire-2.x.git wireguard.cgi: Correctly compose the FQDN Signed-off-by: Michael Tremer --- 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),