diff --git a/src/etc/inc/ipsec.inc b/src/etc/inc/ipsec.inc index 35224c36a..e37722f6c 100644 --- a/src/etc/inc/ipsec.inc +++ b/src/etc/inc/ipsec.inc @@ -807,7 +807,8 @@ EOD; } else { $ident = $key['ident']; } - $pskconf .= "{$ident} : PSK 0s".base64_encode($key['pre-shared-key'])."\n"; + $identType = !empty($key['type']) ? $key['type'] : "PSK"; + $pskconf .= "{$ident} : {$identType} 0s".base64_encode($key['pre-shared-key'])."\n"; } unset($key); } diff --git a/src/www/vpn_ipsec_keys.php b/src/www/vpn_ipsec_keys.php index 78d40bdf6..f752d89b8 100644 --- a/src/www/vpn_ipsec_keys.php +++ b/src/www/vpn_ipsec_keys.php @@ -60,7 +60,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $savemsg = get_std_save_message(); clear_subsystem_dirty('ipsec'); } else { - // nothing to post, redirect + // nothing to post, redirect header(url_safe('Location: /vpn_ipsec_keys.php')); exit; } @@ -122,53 +122,43 @@ if (is_subsystem_dirty('ipsec')) { + $user) { - if (!empty($user['ipsecpsk'])) { - $userkeys[] = array('ident' => $user['name'], 'pre-shared-key' => $user['ipsecpsk'], 'id' => $id); - } -} -foreach ($userkeys as $secretent) : -?> - - - - - - - - - " class="btn btn-default btn-xs"> - - - + foreach ($config['system']['user'] as $id => $user) { + if (!empty($user['ipsecpsk'])) { + $userkeys[] = array('ident' => $user['name'], 'pre-shared-key' => $user['ipsecpsk'], 'id' => $id); + } + } + foreach ($userkeys as $secretent):?> + + + + PSK + + " class="btn btn-default btn-xs"> + + - - - - - - - - - " class="btn btn-default btn-xs"> - " class="act_delete btn btn-default btn-xs"> - - - + foreach ($config['ipsec']['mobilekey'] as $secretent) :?> + + + + + " class="btn btn-default btn-xs"> + " class="act_delete btn btn-default btn-xs"> + + + diff --git a/src/www/vpn_ipsec_keys_edit.php b/src/www/vpn_ipsec_keys_edit.php index 7eda6e385..5dce633eb 100644 --- a/src/www/vpn_ipsec_keys_edit.php +++ b/src/www/vpn_ipsec_keys_edit.php @@ -49,10 +49,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $id = $_GET['id']; $pconfig['ident'] = $config['ipsec']['mobilekey'][$id]['ident']; $pconfig['psk'] = $config['ipsec']['mobilekey'][$id]['pre-shared-key']; + $pconfig['type'] = $config['ipsec']['mobilekey'][$id]['type']; } else { // init new $pconfig['ident'] = ''; $pconfig['psk'] = ''; + $pconfig['type'] = 'PSK'; } } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { $input_errors = array(); @@ -97,6 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $secretent = array(); $secretent['ident'] = $pconfig['ident']; $secretent['pre-shared-key'] = $pconfig['psk']; + $secretent['type'] = $pconfig['type']; if ($id !== null) { // edit existing key @@ -153,6 +156,15 @@ include("head.inc"); + + + + + +