vpnmain.cgi: Add field for roadwarrior endpoint

This is the IP address or FQDN which will be written into
Apple Configuration profiles as public peer address.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2020-03-05 13:17:03 +00:00
parent 205c3c17c6
commit c7fe09c6ad
12 changed files with 56 additions and 1 deletions

View File

@@ -889,6 +889,8 @@ WARNING: untranslated string: guardian logtarget_file = unknown string
WARNING: untranslated string: guardian logtarget_syslog = unknown string WARNING: untranslated string: guardian logtarget_syslog = unknown string
WARNING: untranslated string: guardian no entries = unknown string WARNING: untranslated string: guardian no entries = unknown string
WARNING: untranslated string: guardian service = unknown string WARNING: untranslated string: guardian service = unknown string
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: netbios nameserver daemon = NetBIOS Nameserver Daemon WARNING: untranslated string: netbios nameserver daemon = NetBIOS Nameserver Daemon
WARNING: untranslated string: no entries = No entries at the moment. WARNING: untranslated string: no entries = No entries at the moment.
WARNING: untranslated string: optional = Optional WARNING: untranslated string: optional = Optional

View File

@@ -1144,9 +1144,11 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec network = IPsec network WARNING: untranslated string: ipsec network = IPsec network
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: iptmangles = IPTable Mangles WARNING: untranslated string: iptmangles = IPTable Mangles

View File

@@ -1227,9 +1227,11 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec network = IPsec network WARNING: untranslated string: ipsec network = IPsec network
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -924,6 +924,8 @@ WARNING: untranslated string: guardian logtarget_file = unknown string
WARNING: untranslated string: guardian logtarget_syslog = unknown string WARNING: untranslated string: guardian logtarget_syslog = unknown string
WARNING: untranslated string: guardian no entries = unknown string WARNING: untranslated string: guardian no entries = unknown string
WARNING: untranslated string: guardian service = unknown string WARNING: untranslated string: guardian service = unknown string
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: pakfire ago = ago. WARNING: untranslated string: pakfire ago = ago.
WARNING: untranslated string: route config changed = unknown string WARNING: untranslated string: route config changed = unknown string
WARNING: untranslated string: routing config added = unknown string WARNING: untranslated string: routing config added = unknown string

View File

@@ -1066,8 +1066,10 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -1075,8 +1075,10 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -1232,9 +1232,11 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec network = IPsec network WARNING: untranslated string: ipsec network = IPsec network
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -1230,9 +1230,11 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec network = IPsec network WARNING: untranslated string: ipsec network = IPsec network
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -1002,8 +1002,10 @@ WARNING: untranslated string: ipsec connection = IPsec Connection
WARNING: untranslated string: ipsec interface mode gre = GRE WARNING: untranslated string: ipsec interface mode gre = GRE
WARNING: untranslated string: ipsec interface mode none = - None (Default) - WARNING: untranslated string: ipsec interface mode none = - None (Default) -
WARNING: untranslated string: ipsec interface mode vti = VTI WARNING: untranslated string: ipsec interface mode vti = VTI
WARNING: untranslated string: ipsec invalid ip address or fqdn for rw endpoint = Invalid IP address or FQDN for Host-to-Net Endpoint
WARNING: untranslated string: ipsec mode transport = Transport WARNING: untranslated string: ipsec mode transport = Transport
WARNING: untranslated string: ipsec mode tunnel = Tunnel WARNING: untranslated string: ipsec mode tunnel = Tunnel
WARNING: untranslated string: ipsec roadwarrior endpoint = Host-to-Net Endpoint
WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries WARNING: untranslated string: ipsec routing table entries = IPsec Routing Table Entries
WARNING: untranslated string: ipsec settings = IPsec Settings WARNING: untranslated string: ipsec settings = IPsec Settings
WARNING: untranslated string: itlb multihit = iTLB MultiHit WARNING: untranslated string: itlb multihit = iTLB MultiHit

View File

@@ -40,6 +40,8 @@
< g.dtm < g.dtm
< g.lite < g.lite
< insert removable device < insert removable device
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec roadwarrior endpoint
< netbios nameserver daemon < netbios nameserver daemon
< no entries < no entries
< notes < notes
@@ -541,10 +543,12 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec network < ipsec network
< ipsec no connections < ipsec no connections
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit
@@ -925,6 +929,8 @@
< download apple profile < download apple profile
< g.dtm < g.dtm
< g.lite < g.lite
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec roadwarrior endpoint
< upload fcdsl.o < upload fcdsl.o
< zoneconf val vlan tag range error < zoneconf val vlan tag range error
############################################################################ ############################################################################
@@ -1139,8 +1145,10 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit
@@ -1550,8 +1558,10 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit
@@ -2284,10 +2294,12 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec network < ipsec network
< ipsec no connections < ipsec no connections
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit
@@ -3179,10 +3191,12 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec network < ipsec network
< ipsec no connections < ipsec no connections
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit
@@ -3641,8 +3655,10 @@
< ipsec interface mode gre < ipsec interface mode gre
< ipsec interface mode none < ipsec interface mode none
< ipsec interface mode vti < ipsec interface mode vti
< ipsec invalid ip address or fqdn for rw endpoint
< ipsec mode transport < ipsec mode transport
< ipsec mode tunnel < ipsec mode tunnel
< ipsec roadwarrior endpoint
< ipsec routing table entries < ipsec routing table entries
< ipsec settings < ipsec settings
< itlb multihit < itlb multihit

View File

@@ -26,6 +26,7 @@ use File::Copy;
use File::Temp qw/ tempfile tempdir /; use File::Temp qw/ tempfile tempdir /;
use strict; use strict;
use Sort::Naturally; use Sort::Naturally;
use Sys::Hostname;
# enable only the following on debugging purpose # enable only the following on debugging purpose
#use warnings; #use warnings;
#use CGI::Carp 'fatalsToBrowser'; #use CGI::Carp 'fatalsToBrowser';
@@ -112,6 +113,7 @@ $cgiparams{'ROOTCERT_EMAIL'} = '';
$cgiparams{'ROOTCERT_OU'} = ''; $cgiparams{'ROOTCERT_OU'} = '';
$cgiparams{'ROOTCERT_CITY'} = ''; $cgiparams{'ROOTCERT_CITY'} = '';
$cgiparams{'ROOTCERT_STATE'} = ''; $cgiparams{'ROOTCERT_STATE'} = '';
$cgiparams{'RW_ENDPOINT'} = '';
$cgiparams{'RW_NET'} = ''; $cgiparams{'RW_NET'} = '';
$cgiparams{'DPD_DELAY'} = '30'; $cgiparams{'DPD_DELAY'} = '30';
$cgiparams{'DPD_TIMEOUT'} = '120'; $cgiparams{'DPD_TIMEOUT'} = '120';
@@ -507,12 +509,18 @@ if ($ENV{"REMOTE_ADDR"} eq "") {
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cgiparams{'KEY'} eq '') { if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cgiparams{'KEY'} eq '') {
&General::readhash("${General::swroot}/vpn/settings", \%vpnsettings); &General::readhash("${General::swroot}/vpn/settings", \%vpnsettings);
if ($cgiparams{'RW_ENDPOINT'} ne '' && !&General::validip($cgiparams{'RW_ENDPOINT'}) && !&General::validfqdn($cgiparams{'RW_ENDPOINT'})) {
$errormessage = $Lang::tr{'ipsec invalid ip address or fqdn for rw endpoint'};
goto SAVE_ERROR;
}
if ( $cgiparams{'RW_NET'} ne '' and !&General::validipandmask($cgiparams{'RW_NET'}) ) { if ( $cgiparams{'RW_NET'} ne '' and !&General::validipandmask($cgiparams{'RW_NET'}) ) {
$errormessage = $Lang::tr{'urlfilter invalid ip or mask error'}; $errormessage = $Lang::tr{'urlfilter invalid ip or mask error'};
goto SAVE_ERROR; goto SAVE_ERROR;
} }
$vpnsettings{'ENABLED'} = $cgiparams{'ENABLED'}; $vpnsettings{'ENABLED'} = $cgiparams{'ENABLED'};
$vpnsettings{'RW_ENDPOINT'} = $cgiparams{'RW_ENDPOINT'};
$vpnsettings{'RW_NET'} = $cgiparams{'RW_NET'}; $vpnsettings{'RW_NET'} = $cgiparams{'RW_NET'};
&General::writehash("${General::swroot}/vpn/settings", \%vpnsettings); &General::writehash("${General::swroot}/vpn/settings", \%vpnsettings);
&writeipsecfiles(); &writeipsecfiles();
@@ -1182,6 +1190,10 @@ END
# Export Apple profile to browser # Export Apple profile to browser
} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'download apple profile'}) { } elsif ($cgiparams{'ACTION'} eq $Lang::tr{'download apple profile'}) {
# Read global configuration
&General::readhash("${General::swroot}/vpn/settings", \%vpnsettings);
# Read connections
&General::readhasharray("${General::swroot}/vpn/config", \%confighash); &General::readhasharray("${General::swroot}/vpn/config", \%confighash);
my $key = $cgiparams{'KEY'}; my $key = $cgiparams{'KEY'};
@@ -1209,6 +1221,9 @@ END
print "Content-Disposition: attachment; filename=" . $confighash{$key}[1] . ".mobileconfig\n"; print "Content-Disposition: attachment; filename=" . $confighash{$key}[1] . ".mobileconfig\n";
print "\n"; # end headers print "\n"; # end headers
# Use our own FQDN if nothing else is configured
my $endpoint = ($vpnsettings{'RW_ENDPOINT'} ne "") ? $vpnsettings{'RW_ENDPOINT'} : &hostname();
print "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"; print "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n";
print "<plist version=\"1.0\">\n"; print "<plist version=\"1.0\">\n";
print " <dict>\n"; print " <dict>\n";
@@ -1240,7 +1255,7 @@ END
print " <key>IKEv2</key>\n"; print " <key>IKEv2</key>\n";
print " <dict>\n"; print " <dict>\n";
print " <key>RemoteAddress</key>\n"; print " <key>RemoteAddress</key>\n";
print " <string>18.206.152.26</string>\n"; print " <string>$endpoint</string>\n";
# Left ID # Left ID
if ($confighash{$key}[9]) { if ($confighash{$key}[9]) {
@@ -3081,6 +3096,10 @@ EOF
<input type='checkbox' name='ENABLED' $checked{'ENABLED'} /> <input type='checkbox' name='ENABLED' $checked{'ENABLED'} />
</td> </td>
</tr> </tr>
<tr>
<td class='base' nowrap='nowrap' width="60%">$Lang::tr{'ipsec roadwarrior endpoint'}:</td>
<td width="40%"><input type='text' name='RW_ENDPOINT' value='$cgiparams{'RW_ENDPOINT'}' /></td>
</tr>
<tr> <tr>
<td class='base' nowrap='nowrap' width="60%">$Lang::tr{'host to net vpn'}:</td> <td class='base' nowrap='nowrap' width="60%">$Lang::tr{'host to net vpn'}:</td>
<td width="40%"><input type='text' name='RW_NET' value='$cgiparams{'RW_NET'}' /></td> <td width="40%"><input type='text' name='RW_NET' value='$cgiparams{'RW_NET'}' /></td>

View File

@@ -1550,10 +1550,12 @@
'ipsec interface mode gre' => 'GRE', 'ipsec interface mode gre' => 'GRE',
'ipsec interface mode none' => '- None (Default) -', 'ipsec interface mode none' => '- None (Default) -',
'ipsec interface mode vti' => 'VTI', 'ipsec interface mode vti' => 'VTI',
'ipsec invalid ip address or fqdn for rw endpoint' => 'Invalid IP address or FQDN for Host-to-Net Endpoint',
'ipsec mode transport' => 'Transport', 'ipsec mode transport' => 'Transport',
'ipsec mode tunnel' => 'Tunnel', 'ipsec mode tunnel' => 'Tunnel',
'ipsec network' => 'IPsec network', 'ipsec network' => 'IPsec network',
'ipsec no connections' => 'No active IPsec connections', 'ipsec no connections' => 'No active IPsec connections',
'ipsec roadwarrior endpoint' => 'Host-to-Net Endpoint',
'ipsec routing table entries' => 'IPsec Routing Table Entries', 'ipsec routing table entries' => 'IPsec Routing Table Entries',
'ipsec settings' => 'IPsec Settings', 'ipsec settings' => 'IPsec Settings',
'iptable rules' => 'IPTable rules', 'iptable rules' => 'IPTable rules',