From 46bc6e545a17e77202aaf01ec0cd8d5a46567525 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 25 Aug 2015 08:08:24 -0300 Subject: Move main pfSense content to src/ --- etc/inc/openvpn.auth-user.php | 213 ------------------------------------------ 1 file changed, 213 deletions(-) delete mode 100644 etc/inc/openvpn.auth-user.php (limited to 'etc/inc/openvpn.auth-user.php') diff --git a/etc/inc/openvpn.auth-user.php b/etc/inc/openvpn.auth-user.php deleted file mode 100644 index e108a4f..0000000 --- a/etc/inc/openvpn.auth-user.php +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/local/bin/php-cgi -f - - -if (file_exists("{$g['varetc_path']}/openvpn/{$modeid}.ca")) { - putenv("LDAPTLS_CACERT={$g['varetc_path']}/openvpn/{$modeid}.ca"); - putenv("LDAPTLS_REQCERT=never"); -} - -$authenticated = false; - -if (($strictusercn === true) && ($common_name != $username)) { - syslog(LOG_WARNING, "Username does not match certificate common name ({$username} != {$common_name}), access denied.\n"); - if (isset($_GET['username'])) { - echo "FAILED"; - closelog(); - return; - } else { - closelog(); - return (1); - } -} - -if (!is_array($authmodes)) { - syslog(LOG_WARNING, "No authentication server has been selected to authenticate against. Denying authentication for user {$username}"); - if (isset($_GET['username'])) { - echo "FAILED"; - closelog(); - return; - } else { - closelog(); - return (1); - } -} - -$attributes = array(); -foreach ($authmodes as $authmode) { - $authcfg = auth_get_authserver($authmode); - if (!$authcfg && $authmode != "local") { - continue; - } - - $authenticated = authenticate_user($username, $password, $authcfg, $attributes); - if ($authenticated == true) { - break; - } -} - -if ($authenticated == false) { - syslog(LOG_WARNING, "user '{$username}' could not authenticate.\n"); - if (isset($_GET['username'])) { - echo "FAILED"; - closelog(); - return; - } else { - closelog(); - return (-1); - } -} - -if (file_exists("/etc/inc/openvpn.attributes.php")) { - include_once("/etc/inc/openvpn.attributes.php"); -} - -$content = ""; -if (is_array($attributes['dns-servers'])) { - foreach ($attributes['dns-servers'] as $dnssrv) { - if (is_ipaddr($dnssrv)) { - $content .= "push \"dhcp-option DNS {$dnssrv}\"\n"; - } - } -} -if (is_array($attributes['routes'])) { - foreach ($attributes['routes'] as $route) { - $content .= "push \"route {$route} vpn_gateway\"\n"; - } -} - -if (isset($attributes['framed_ip'])) { -/* XXX: only use when TAP windows driver >= 8.2.x */ -/* if (isset($attributes['framed_mask'])) { - $content .= "topology subnet\n"; - $content .= "ifconfig-push {$attributes['framed_ip']} {$attributes['framed_mask']}"; - } else { -*/ - $content .= "topology net30\n"; - $content .= "ifconfig-push {$attributes['framed_ip']} ". long2ip((ip2long($attributes['framed_ip']) + 1)); -// } -} - -if (!empty($content)) { - @file_put_contents("{$g['tmp_path']}/{$username}", $content); -} - -syslog(LOG_NOTICE, "user '{$username}' authenticated\n"); -closelog(); - -if (isset($_GET['username'])) { - echo "OK"; -} else { - return (0); -} - -?> -- cgit v1.1