From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] ipsec: Allow selection of ESP group type Date: Tue, 02 Jun 2015 20:24:04 +0200 Message-ID: <1433269444-8615-1-git-send-email-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3193509475702068581==" List-Id: --===============3193509475702068581== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable If a connection is edited, the IKE group types will be used instead. Fixes #10860 Signed-off-by: Michael Tremer --- doc/language_issues.de | 1 + doc/language_issues.es | 1 + doc/language_issues.fr | 1 + doc/language_issues.it | 1 + doc/language_issues.nl | 1 + doc/language_issues.pl | 1 + doc/language_issues.ru | 1 + doc/language_issues.tr | 1 + html/cgi-bin/vpnmain.cgi | 73 ++++++++++++++++++++++++++++++++++++++++++----= -- langs/en/cgi-bin/en.pl | 1 + 10 files changed, 74 insertions(+), 8 deletions(-) diff --git a/doc/language_issues.de b/doc/language_issues.de index 90accb3c006a..0d86987569b5 100644 --- a/doc/language_issues.de +++ b/doc/language_issues.de @@ -644,6 +644,7 @@ WARNING: untranslated string: fwhost cust geoipgrp WARNING: untranslated string: fwhost err hostip WARNING: untranslated string: ike lifetime should be between 1 and 8 hours WARNING: untranslated string: no data +WARNING: untranslated string: none WARNING: untranslated string: qos add subclass WARNING: untranslated string: route config changed WARNING: untranslated string: routing config added diff --git a/doc/language_issues.es b/doc/language_issues.es index fe8b726243ab..b0c066f644a3 100644 --- a/doc/language_issues.es +++ b/doc/language_issues.es @@ -917,6 +917,7 @@ WARNING: untranslated string: most preferred WARNING: untranslated string: nameserver WARNING: untranslated string: no data WARNING: untranslated string: no hardware random number generator +WARNING: untranslated string: none WARNING: untranslated string: not a valid dh key WARNING: untranslated string: notice WARNING: untranslated string: openvpn default diff --git a/doc/language_issues.fr b/doc/language_issues.fr index fee481d25bb0..b13969b01705 100644 --- a/doc/language_issues.fr +++ b/doc/language_issues.fr @@ -932,6 +932,7 @@ WARNING: untranslated string: most preferred WARNING: untranslated string: nameserver WARNING: untranslated string: no data WARNING: untranslated string: no hardware random number generator +WARNING: untranslated string: none WARNING: untranslated string: not a valid dh key WARNING: untranslated string: notice WARNING: untranslated string: ntp common settings diff --git a/doc/language_issues.it b/doc/language_issues.it index 2f61cb61b17c..c133fec1b84f 100644 --- a/doc/language_issues.it +++ b/doc/language_issues.it @@ -705,6 +705,7 @@ WARNING: untranslated string: masquerading disabled WARNING: untranslated string: masquerading enabled WARNING: untranslated string: messages WARNING: untranslated string: no data +WARNING: untranslated string: none WARNING: untranslated string: outgoing compression in bytes per second WARNING: untranslated string: outgoing overhead in bytes per second WARNING: untranslated string: ovpn add conf diff --git a/doc/language_issues.nl b/doc/language_issues.nl index fadc79272f9b..692420e6b30b 100644 --- a/doc/language_issues.nl +++ b/doc/language_issues.nl @@ -737,6 +737,7 @@ WARNING: untranslated string: modem status WARNING: untranslated string: monitor interface WARNING: untranslated string: nameserver WARNING: untranslated string: no data +WARNING: untranslated string: none WARNING: untranslated string: not a valid dh key WARNING: untranslated string: outgoing compression in bytes per second WARNING: untranslated string: outgoing overhead in bytes per second diff --git a/doc/language_issues.pl b/doc/language_issues.pl index fe8b726243ab..b0c066f644a3 100644 --- a/doc/language_issues.pl +++ b/doc/language_issues.pl @@ -917,6 +917,7 @@ WARNING: untranslated string: most preferred WARNING: untranslated string: nameserver WARNING: untranslated string: no data WARNING: untranslated string: no hardware random number generator +WARNING: untranslated string: none WARNING: untranslated string: not a valid dh key WARNING: untranslated string: notice WARNING: untranslated string: openvpn default diff --git a/doc/language_issues.ru b/doc/language_issues.ru index a9e900134b79..f23b103e1642 100644 --- a/doc/language_issues.ru +++ b/doc/language_issues.ru @@ -917,6 +917,7 @@ WARNING: untranslated string: most preferred WARNING: untranslated string: nameserver WARNING: untranslated string: no data WARNING: untranslated string: no hardware random number generator +WARNING: untranslated string: none WARNING: untranslated string: not a valid dh key WARNING: untranslated string: notice WARNING: untranslated string: openvpn default diff --git a/doc/language_issues.tr b/doc/language_issues.tr index d94953a84d93..8ec9e31295ec 100644 --- a/doc/language_issues.tr +++ b/doc/language_issues.tr @@ -684,6 +684,7 @@ WARNING: untranslated string: incoming compression in byt= es per second WARNING: untranslated string: incoming overhead in bytes per second WARNING: untranslated string: invalid input for valid till days WARNING: untranslated string: no data +WARNING: untranslated string: none WARNING: untranslated string: outgoing compression in bytes per second WARNING: untranslated string: outgoing overhead in bytes per second WARNING: untranslated string: ovpn add conf diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index 94900765f523..6458bf251920 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -327,7 +327,13 @@ sub writeipsecfiles { if ($lconfighash{$key}[21] && $lconfighash{$key}[22]) { my @encs =3D split('\|', $lconfighash{$key}[21]); my @ints =3D split('\|', $lconfighash{$key}[22]); - my @groups =3D split('\|', $lconfighash{$key}[20]); + my @groups =3D split('\|', $lconfighash{$key}[23]); + + # Use IKE grouptype if no ESP group type has been selected + # (for backwards compatibility) + if ($lconfighash{$key}[23] eq "") { + @groups =3D split('\|', $lconfighash{$key}[20]); + } =20 my @algos =3D &make_algos("esp", \@encs, \@ints, \@groups, ($pfs eq "on")); print CONF "\tesp=3D" . join(",", @algos); @@ -1260,6 +1266,9 @@ END $cgiparams{'ESP_ENCRYPTION'} =3D $confighash{$cgiparams{'KEY'}}[21]; $cgiparams{'ESP_INTEGRITY'} =3D $confighash{$cgiparams{'KEY'}}[22]; $cgiparams{'ESP_GROUPTYPE'} =3D $confighash{$cgiparams{'KEY'}}[23]; + if ($cgiparams{'ESP_GROUPTYPE'} eq "") { + $cgiparams{'ESP_GROUPTYPE'} =3D $cgiparams{'IKE_GROUPTYPE'}; + } $cgiparams{'ESP_KEYLIFE'} =3D $confighash{$cgiparams{'KEY'}}[17]; $cgiparams{'COMPRESSION'} =3D $confighash{$cgiparams{'KEY'}}[13]; $cgiparams{'ONLY_PROPOSED'} =3D $confighash{$cgiparams{'KEY'}}[24]; @@ -1855,7 +1864,7 @@ END $cgiparams{'IKE_LIFETIME'} =3D '3'; #[16]; $cgiparams{'ESP_ENCRYPTION'} =3D 'aes256gcm128|aes256gcm96|aes256gcm64|aes2= 56|aes192gcm128|aes192gcm96|aes192gcm64|aes192|aes128gcm128|aes128gcm96|aes12= 8gcm64|aes128'; #[21]; $cgiparams{'ESP_INTEGRITY'} =3D 'sha2_512|sha2_256|sha1'; #[22]; - $cgiparams{'ESP_GROUPTYPE'} =3D ''; #[23]; + $cgiparams{'ESP_GROUPTYPE'} =3D '4096|3072|2048|1536|1024'; #[23]; $cgiparams{'ESP_KEYLIFE'} =3D '1'; #[17]; $cgiparams{'COMPRESSION'} =3D 'on'; #[13]; $cgiparams{'ONLY_PROPOSED'} =3D 'off'; #[24]; @@ -2165,13 +2174,17 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) || goto ADVANCED_ERROR; } } - if ($cgiparams{'ESP_GROUPTYPE'} ne '' && - $cgiparams{'ESP_GROUPTYPE'} !~ /^ecp(192|224|256|384|512)(bp)?$/ && - $cgiparams{'ESP_GROUPTYPE'} !~ /^modp(1024|1536|2048|2048s(256|224|160= )|3072|4096|6144|8192)$/) { + @temp =3D split('\|', $cgiparams{'ESP_GROUPTYPE'}); + if ($#temp < 0) { $errormessage =3D $Lang::tr{'invalid input'}; goto ADVANCED_ERROR; } - + foreach my $val (@temp) { + if ($val !~ /^(e521|e384|e256|e224|e192|e512bp|e384bp|e256bp|e224bp|102= 4|1536|2048|2048s256|2048s224|2048s160|3072|4096|6144|8192|none)$/) { + $errormessage =3D $Lang::tr{'invalid input'}; + goto ADVANCED_ERROR; + } + } if ($cgiparams{'ESP_KEYLIFE'} !~ /^\d+$/) { $errormessage =3D $Lang::tr{'invalid input for esp keylife'}; goto ADVANCED_ERROR; @@ -2234,6 +2247,9 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) || $cgiparams{'ESP_ENCRYPTION'} =3D $confighash{$cgiparams{'KEY'}}[21]; $cgiparams{'ESP_INTEGRITY'} =3D $confighash{$cgiparams{'KEY'}}[22]; $cgiparams{'ESP_GROUPTYPE'} =3D $confighash{$cgiparams{'KEY'}}[23]; + if ($cgiparams{'ESP_GROUPTYPE'} eq "") { + $cgiparams{'ESP_GROUPTYPE'} =3D $cgiparams{'IKE_GROUPTYPE'}; + } $cgiparams{'ESP_KEYLIFE'} =3D $confighash{$cgiparams{'KEY'}}[17]; $cgiparams{'COMPRESSION'} =3D $confighash{$cgiparams{'KEY'}}[13]; $cgiparams{'ONLY_PROPOSED'} =3D $confighash{$cgiparams{'KEY'}}[24]; @@ -2323,7 +2339,17 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) || $checked{'ESP_INTEGRITY'}{'aesxcbc'} =3D ''; @temp =3D split('\|', $cgiparams{'ESP_INTEGRITY'}); foreach my $key (@temp) {$checked{'ESP_INTEGRITY'}{$key} =3D "selected= =3D'selected'"; } - $checked{'ESP_GROUPTYPE'}{$cgiparams{'ESP_GROUPTYPE'}} =3D "selected=3D'= selected'"; + $checked{'ESP_GROUPTYPE'}{'768'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'1024'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'1536'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'2048'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'3072'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'4096'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'6144'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'8192'} =3D ''; + $checked{'ESP_GROUPTYPE'}{'none'} =3D ''; + @temp =3D split('\|', $cgiparams{'ESP_GROUPTYPE'}); + foreach my $key (@temp) {$checked{'ESP_GROUPTYPE'}{$key} =3D "selected= =3D'selected'"; } =20 $checked{'COMPRESSION'} =3D $cgiparams{'COMPRESSION'} eq 'on' ? "checked= =3D'checked'" : '' ; $checked{'ONLY_PROPOSED'} =3D $cgiparams{'ONLY_PROPOSED'} eq 'on' ? "che= cked=3D'checked'" : '' ; @@ -2484,7 +2510,30 @@ if(($cgiparams{'ACTION'} eq $Lang::tr{'advanced'}) ||