From 89e6e210158ca4ca24d2ddbc02ccab72175875a5 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 8 May 2009 13:40:07 -0400 Subject: Fix OpenVPN automatic shared key generation. --- usr/local/www/vpn_openvpn_client.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr/local/www/vpn_openvpn_client.php') diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 5dd6c9a..0aef437 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -158,6 +158,9 @@ if ($_POST) { if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network')) $input_errors[] = $result; + if ($pconfig['autokey_enable']) + $pconfig['shared_key'] = openvpn_create_key(); + if (!$tls_mode && !$pconfig['autokey_enable']) if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") || !strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----")) @@ -168,7 +171,7 @@ if ($_POST) { !strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----")) $input_errors[] = "The field 'TLS Authentication Key' does not appear to be valid"; - if (!$tls_mode) { + if (!$tls_mode && !$pconfig['autokey_enable']) { $reqdfields = array('shared_key'); $reqdfieldsn = array('Shared key'); } else { @@ -211,8 +214,6 @@ if ($_POST) { $client['tls'] = base64_encode($pconfig['tls']); } } else { - if ($pconfig['autokey_enable']) - $pconfig['shared_key'] = openvpn_create_key(); $client['shared_key'] = base64_encode($pconfig['shared_key']); } $client['crypto'] = $pconfig['crypto']; -- cgit v1.1