Skip to content

Commit

Permalink
(ipsec) add eap-mschapv2
Browse files Browse the repository at this point in the history
  • Loading branch information
AdSchellevis committed Jul 12, 2016
1 parent 1e2ace8 commit 4638d99
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/etc/inc/ipsec.inc
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ EOD;
case 'rsasig':
$authentication = "leftauth = pubkey\n\trightauth = pubkey";
break;
case 'eap-mschapv2':
$authentication = "leftauth = pubkey\n\trightauth = eap-mschapv2";
$authentication .= "\n\teap_identity=%any";
break;
case 'hybrid_rsa_server':
$authentication = "leftauth = xauth-generic\n\trightauth = pubkey";
$authentication .= "\n\trightauth2 = xauth";
Expand Down
28 changes: 17 additions & 11 deletions src/www/vpn_ipsec_phase1.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ function ipsec_ikeid_next() {
$pconfig = $_POST;
$old_ph1ent = $a_phase1[$p1index];

// Preperations to kill some settings which aren't left empty by the field.
// Unset ca and cert if not required to avoid storing in config
if ($pconfig['authentication_method'] == "pre_shared_key" || $pconfig['authentication_method'] == "xauth_psk_server") {
unset($pconfig['caref']);
unset($pconfig['certref']);
}
// unset dpd on post
if (!isset($pconfig['dpd_enable'])) {
unset($pconfig['dpd_delay']);
Expand All @@ -184,10 +178,11 @@ function ipsec_ikeid_next() {
// For RSA methods, require the CA/Cert.
switch ($method) {
case "eap-tls":
if ($pconfig['iketype'] != 'ikev2') {
$input_errors[] = gettext("EAP-TLS can only be used with IKEv2 type VPNs.");
}
break;
case 'eap-mschapv2':
if ($pconfig['iketype'] != 'ikev2') {
$input_errors[] = sprintf(gettext("%s can only be used with IKEv2 type VPNs."), strtoupper($method));
}
break;
case "pre_shared_key":
// If this is a mobile PSK tunnel the user PSKs go on
// the PSK tab, not here, so skip the check.
Expand Down Expand Up @@ -448,20 +443,30 @@ function ipsec_ikeid_next() {

$("#authentication_method").change(function(){
$(".auth_opt").hide();
$(".auth_opt select,input").prop( "disabled", true );
switch ($("#authentication_method").val()) {
case 'eap-mschapv2':
$(".auth_eap_tls").show();
$(".auth_eap_tls select,input").prop( "disabled", false );
break;
case 'eap-tls':
case 'hybrid_rsa_server':
case 'xauth_rsa_server':
case 'rsasig':
$(".auth_eap_tls").show();
$(".auth_eap_tls select,input").prop( "disabled", false );
$(".auth_eap_tls_caref").show();
$(".auth_eap_tls_caref select,input").prop( "disabled", false );
break;
case 'pre_shared_key':
if ($("#mobile").val() == undefined) {
$(".auth_psk").show();
$(".auth_psk select,input").prop( "disabled", false );
}
break;
default: /* psk modes*/
$(".auth_psk").show();
$(".auth_psk select,input").prop( "disabled", false );
break;
}
});
Expand Down Expand Up @@ -666,6 +671,7 @@ function ipsec_ikeid_next() {
'xauth_rsa_server' => array( 'name' => 'Mutual RSA + Xauth', 'mobile' => true ),
'xauth_psk_server' => array( 'name' => 'Mutual PSK + Xauth', 'mobile' => true ),
'eap-tls' => array( 'name' => 'EAP-TLS', 'mobile' => true),
'eap-mschapv2' => array( 'name' => 'EAP-MSCHAPV2', 'mobile' => true),
'rsasig' => array( 'name' => 'Mutual RSA', 'mobile' => false ),
'pre_shared_key' => array( 'name' => 'Mutual PSK', 'mobile' => false ) );
foreach ($p1_authentication_methods as $method_type => $method_params) :
Expand Down Expand Up @@ -792,7 +798,7 @@ function ipsec_ikeid_next() {
</div>
</td>
</tr>
<tr class="auth_opt auth_eap_tls">
<tr class="auth_opt auth_eap_tls_caref">
<td><a id="help_for_caref" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("My Certificate Authority"); ?></td>
<td>
<select name="caref" class="formselect">
Expand Down

0 comments on commit 4638d99

Please sign in to comment.