]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
wireguard.cgi: Correctly compose the FQDN
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Apr 2024 17:33:21 +0000 (19:33 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Apr 2025 14:48:31 +0000 (16:48 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/wireguard.cgi

index f1e8eda9131ae6bd70a632ea3074523ec9a30ac2..bcc51a7b6ab82e69f0817d6d28f9b7484bac5bbb 100644 (file)
@@ -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),