summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-03-10 10:40:52 +0000
committerErmal Luçi <eri@pfsense.org>2010-03-10 10:40:52 +0000
commit8a47c19021dde35a19f3fe83938d3edcfd6c76d6 (patch)
tree03bd32eedcf13f9f8a36c55e7c81ced0b283f425
parent5a8a69b3126309dd7024f5d9a1b106024c0ffa4e (diff)
downloadpfsense-8a47c19021dde35a19f3fe83938d3edcfd6c76d6.zip
pfsense-8a47c19021dde35a19f3fe83938d3edcfd6c76d6.tar.gz
Ticket #413. Hanlde cases when no authentication is specified.
-rw-r--r--etc/inc/openvpn.inc26
-rw-r--r--usr/local/www/vpn_openvpn_server.php6
2 files changed, 18 insertions, 14 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index c9b4313..766dce3 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -382,19 +382,21 @@ function openvpn_reconfigure($mode,& $settings) {
$conf .= "client-cert-not-required\n";
case 'server_tls_user':
$conf .= "username-as-common-name\n";
- $authcfgs = explode(",", $settings['authmode']);
- $sed = "\$authmodes=array(";
- $firstsed = 0;
- foreach ($authcfgs as $authcfg) {
- if ($firstsed > 0)
- $sed .= ",";
- $firstsed = 1;
- $sed .= "\"{$authcfg}\"";
+ if (!empty($settings['authmode'])) {
+ $authcfgs = explode(",", $settings['authmode']);
+ $sed = "\$authmodes=array(";
+ $firstsed = 0;
+ foreach ($authcfgs as $authcfg) {
+ if ($firstsed > 0)
+ $sed .= ",";
+ $firstsed = 1;
+ $sed .= "\"{$authcfg}\"";
+ }
+ $sed .= ");";
+ mwexec("/bin/cat /etc/inc/openvpn.auth-user.php | /usr/bin/sed 's/\/\/<template>/{$sed}/g' > {$g['varetc_path']}/openvpn/{$mode_id}.php");
+ mwexec("/bin/chmod a+x {$g['varetc_path']}/openvpn/{$mode_id}.php");
+ $conf .= "auth-user-pass-verify {$g['varetc_path']}/openvpn/{$mode_id}.php via-env\n";
}
- $sed .= ");";
- mwexec("/bin/cat /etc/inc/openvpn.auth-user.php | /usr/bin/sed 's/\/\/<template>/{$sed}/g' > {$g['varetc_path']}/openvpn/{$mode_id}.php");
- mwexec("/bin/chmod a+x {$g['varetc_path']}/openvpn/{$mode_id}.php");
- $conf .= "auth-user-pass-verify {$g['varetc_path']}/openvpn/{$mode_id}.php via-env\n";
break;
}
diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php
index 82d6eda..25d6f1b 100644
--- a/usr/local/www/vpn_openvpn_server.php
+++ b/usr/local/www/vpn_openvpn_server.php
@@ -268,7 +268,8 @@ if ($_POST) {
if ($_POST['disable'] == "yes")
$server['disable'] = true;
$server['mode'] = $pconfig['mode'];
- $server['authmode'] = implode(",", $pconfig['authmode']);
+ if (!empty($pconfig['authmode']))
+ $server['authmode'] = implode(",", $pconfig['authmode']);
$server['protocol'] = $pconfig['protocol'];
list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
$server['local_port'] = $pconfig['local_port'];
@@ -341,7 +342,8 @@ if ($_POST) {
header("Location: vpn_openvpn_server.php");
exit;
}
- $pconfig['authmode'] = implode(",", $pconfig['authmode']);
+ if (!empty($pconfig['authmode']))
+ $pconfig['authmode'] = implode(",", $pconfig['authmode']);
}
include("head.inc");
OpenPOWER on IntegriCloud