]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
IPsec: Strip @ from IDs in Apple profile
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 May 2020 14:45:42 +0000 (14:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 May 2021 11:27:04 +0000 (11:27 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/vpnmain.cgi

index 1eee11b94486b608d803575e0186c367f9af3f59..94da2b14501c694ee341b5c31eb1be7abbfdc5d5 100644 (file)
@@ -1390,14 +1390,28 @@ END
 
        # Left ID
        if ($confighash{$key}[9]) {
+               my $leftid = $confighash{$key}[9];
+
+               # Strip leading @ from FQDNs
+               if ($leftid =~ m/^@(.*)$/) {
+                       $leftid = $1;
+               }
+
                print "                                 <key>LocalIdentifier</key>\n";
-               print "                                 <string>$confighash{$key}[9]</string>\n";
+               print "                                 <string>$leftid</string>\n";
        }
 
        # Right ID
        if ($confighash{$key}[7]) {
+               my $rightid = $confighash{$key}[7];
+
+               # Strip leading @ from FQDNs
+               if ($rightid =~ m/^@(.*)$/) {
+                       $rightid = $1;
+               }
+
                print "                                 <key>RemoteIdentifier</key>\n";
-               print "                                 <string>$confighash{$key}[7]</string>\n";
+               print "                                 <string>$rightid</string>\n";
        }
 
        if ($confighash{$key}[4] eq "cert") {