diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index c9f67d5735..66ddf7e99c 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -682,6 +682,14 @@ function openvpn_reconfigure($mode, $settings) { $conf .= "ifconfig-ipv6 {$ipv6_2} {$prefix}\n"; } + if ($settings['auth_user'] && $settings['auth_pass']) { + $up_file = "{$g['varetc_path']}/openvpn/{$mode_id}.up"; + $conf .= "auth-user-pass {$up_file}\n"; + $userpass = "{$settings['auth_user']}\n"; + $userpass .= "{$settings['auth_pass']}\n"; + file_put_contents($up_file, $userpass); + } + if ($settings['proxy_addr']) { $conf .= "http-proxy {$settings['proxy_addr']} {$settings['proxy_port']}"; if ($settings['proxy_authtype'] != "none") { diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index ce2cd8eb07..e040beb01a 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -97,10 +97,15 @@ if($_GET['act']=="new"){ $pconfig['digest'] = "SHA1"; } +global $simplefields; +$simplefields = array('auth_user','auth_pass'); + if($_GET['act']=="edit"){ if (isset($id) && $a_client[$id]) { - + foreach($simplefields as $stat) + $pconfig[$stat] = $a_client[$id][$stat]; + $pconfig['disable'] = isset($a_client[$id]['disable']); $pconfig['mode'] = $a_client[$id]['mode']; $pconfig['protocol'] = $a_client[$id]['protocol']; @@ -252,7 +257,10 @@ if ($_POST) { if (!$input_errors) { $client = array(); - + + foreach($simplefields as $stat) + update_if_changed($stat, $client[$stat], $_POST[$stat]); + if ($vpnid) $client['vpnid'] = $vpnid; else @@ -628,6 +636,38 @@ if ($savemsg)
| + + =gettext("Username"); ?> : + + | ++ + | +
| + + =gettext("Password"); ?> : + + | ++ + | +