Commit 8346e8e3 authored by Ad Schellevis's avatar Ad Schellevis

(ipsec) small cleanups, to ease addition of other auth methods.

parent 9fe3389c
...@@ -429,16 +429,7 @@ $( document ).ready(function() { ...@@ -429,16 +429,7 @@ $( document ).ready(function() {
<?=gettext("DH Group"); ?>&nbsp;<?=$p1_dhgroups[$ph1ent['dhgroup']];?> <?=gettext("DH Group"); ?>&nbsp;<?=$p1_dhgroups[$ph1ent['dhgroup']];?>
</td> </td>
<td class="hidden-xs"> <td class="hidden-xs">
<?php <?=str_replace('_', ' ', $ph1ent['authentication_method']);?>
$p1_authentication_methods = array(
'hybrid_rsa_server' => array( 'name' => 'Hybrid RSA + Xauth', 'mobile' => true ),
'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),
'rsasig' => array( 'name' => 'Mutual RSA', 'mobile' => false ),
'pre_shared_key' => array( 'name' => 'Mutual PSK', 'mobile' => false ) );
?>
<?=$p1_authentication_methods[$ph1ent['authentication_method']]['name'];?>
</td> </td>
<td> <td>
<?=$ph1ent['descr'];?>&nbsp; <?=$ph1ent['descr'];?>&nbsp;
......
...@@ -156,12 +156,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -156,12 +156,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = $_POST; $pconfig = $_POST;
$old_ph1ent = $a_phase1[$p1index]; $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 // unset dpd on post
if (!isset($pconfig['dpd_enable'])) { if (!isset($pconfig['dpd_enable'])) {
unset($pconfig['dpd_delay']); unset($pconfig['dpd_delay']);
...@@ -184,10 +178,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -184,10 +178,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// For RSA methods, require the CA/Cert. // For RSA methods, require the CA/Cert.
switch ($method) { switch ($method) {
case "eap-tls": case "eap-tls":
if ($pconfig['iketype'] != 'ikev2') { if ($pconfig['iketype'] != 'ikev2') {
$input_errors[] = gettext("EAP-TLS can only be used with IKEv2 type VPNs."); $input_errors[] = sprintf(gettext("%s can only be used with IKEv2 type VPNs."), strtoupper($method));
} }
break; break;
case "pre_shared_key": case "pre_shared_key":
// If this is a mobile PSK tunnel the user PSKs go on // If this is a mobile PSK tunnel the user PSKs go on
// the PSK tab, not here, so skip the check. // the PSK tab, not here, so skip the check.
...@@ -448,20 +442,26 @@ include("head.inc"); ...@@ -448,20 +442,26 @@ include("head.inc");
$("#authentication_method").change(function(){ $("#authentication_method").change(function(){
$(".auth_opt").hide(); $(".auth_opt").hide();
$(".auth_opt select,input").prop( "disabled", true );
switch ($("#authentication_method").val()) { switch ($("#authentication_method").val()) {
case 'eap-tls': case 'eap-tls':
case 'hybrid_rsa_server': case 'hybrid_rsa_server':
case 'xauth_rsa_server': case 'xauth_rsa_server':
case 'rsasig': case 'rsasig':
$(".auth_eap_tls").show(); $(".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; break;
case 'pre_shared_key': case 'pre_shared_key':
if ($("#mobile").val() == undefined) { if ($("#mobile").val() == undefined) {
$(".auth_psk").show(); $(".auth_psk").show();
$(".auth_psk select,input").prop( "disabled", false );
} }
break; break;
default: /* psk modes*/ default: /* psk modes*/
$(".auth_psk").show(); $(".auth_psk").show();
$(".auth_psk select,input").prop( "disabled", false );
break; break;
} }
}); });
...@@ -792,7 +792,7 @@ endforeach; ?> ...@@ -792,7 +792,7 @@ endforeach; ?>
</div> </div>
</td> </td>
</tr> </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><a id="help_for_caref" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("My Certificate Authority"); ?></td>
<td> <td>
<select name="caref" class="formselect"> <select name="caref" class="formselect">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment