<?php session_start(); include_once('ressources/class.templates.inc'); include_once('ressources/class.users.menus.inc'); include_once('ressources/class.openvpn.inc'); include_once('ressources/class.system.network.inc'); include_once('ressources/class.tcpip.inc'); $users=new usersMenus(); if(!$users->AsSystemAdministrator){die("alert('no access');");} if(isset($_GET["popup"])){tabs();exit();} if(isset($_GET["server"])){server();exit();} if(isset($_GET["clients"])){clients();exit();} if(isset($_POST["ENABLE_SERVER"])){SAVE_SERVER();exit;} if(isset($_POST["IP_START"])){SAVE_SERVER();exit;} if(isset($_POST["EnableOpenVPNEndUserPage"])){EnableOpenVPNEndUserPageSave();exit;} js(); function js(){ $tpl=new templates(); $page=CurrentPageName(); $title=$tpl->_ENGINE_parse_body("{OPENVPN_SERVER_SETTINGS}"); $html="YahooWin4('600','$page?popup=yes','$title')"; echo $html;
include_once 'ressources/class.system.network.inc'; include_once 'ressources/class.tcpip.inc'; $users = new usersMenus(); if (!$users->AsSystemAdministrator) { die("alert('no access');"); } if (isset($_GET["popup"])) { tabs(); exit; } if (isset($_GET["server"])) { server(); exit; } if (isset($_GET["clients"])) { clients(); exit; } if (isset($_POST["ENABLE_SERVER"])) { SAVE_SERVER(); exit; } if (isset($_POST["IP_START"])) { SAVE_SERVER(); exit; } if (isset($_POST["EnableOpenVPNEndUserPage"])) { EnableOpenVPNEndUserPageSave(); exit; } js();
function build() { $unix = new unix(); $sock = new sockets(); $checkrad = $unix->find_program("checkrad"); $EnableMikrotik = $sock->GET_INFO("EnableMikrotik"); echo "Starting FreeRadius.............: checkrad: `{$checkrad}`\n"; $ListenIP = $sock->GET_INFO("FreeRadiusListenIP"); $FreeRadiusListenPort = $sock->GET_INFO("FreeRadiusListenPort"); if ($ListenIP == null) { $ListenIP = "*"; } if (!is_numeric($FreeRadiusListenPort)) { $FreeRadiusListenPort = 1812; } echo "Starting FreeRadius.............: Listen addr: `{$ListenIP}:{$FreeRadiusListenPort}`\n"; $IsMySQL = IsMySQL(); $UseMySQL = false; if ($IsMySQL > 0) { $UseMySQL = true; } $f[] = "prefix = /usr"; $f[] = "exec_prefix = /usr"; $f[] = "sysconfdir = /etc"; $f[] = "localstatedir = /var"; $f[] = "sbindir = \${exec_prefix}/sbin"; $f[] = "logdir = /var/log/freeradius"; $f[] = "raddbdir = /etc/freeradius"; $f[] = "radacctdir = \${logdir}/radacct"; $f[] = "name = freeradius"; $f[] = "confdir = \${raddbdir}"; $f[] = "run_dir = \${localstatedir}/run/\${name}"; $f[] = "db_dir = \${raddbdir}"; $f[] = "libdir = /usr/lib/freeradius"; $f[] = "pidfile = /var/run/freeradius/freeradius.pid"; $f[] = "user = root"; $f[] = "group = root"; $f[] = "max_request_time = 30"; $f[] = "cleanup_delay = 5"; $f[] = "max_requests = {$FreeRadiusListenPort}"; $f[] = "listen {"; $f[] = "\ttype = auth"; $f[] = "\tport = 1812"; $f[] = "\tipaddr = {$ListenIP}"; $f[] = "#\tclients = per_socket_clients"; $f[] = "}"; $f[] = ""; $f[] = ""; $f[] = "listen {"; $f[] = "\tport = 0"; $f[] = "\ttype = acct"; $f[] = "\tipaddr = {$ListenIP}"; $f[] = "#\tinterface = eth0"; $f[] = "#\tclients = per_socket_clients"; $f[] = "}"; $f[] = ""; $f[] = ""; $f[] = "hostname_lookups = no"; $f[] = "allow_core_dumps = no"; $f[] = "regular_expressions\t= yes"; $f[] = "extended_expressions\t= yes"; $f[] = ""; $f[] = "log {"; $f[] = "\tdestination = syslog"; $f[] = "\tfile = \${logdir}/radius.log"; $f[] = "\tsyslog_facility = daemon"; $f[] = "\tstripped_names = no"; $f[] = "\tauth = yes"; $f[] = "\tauth_badpass = yes"; $f[] = "\tauth_goodpass = no"; $f[] = "}"; $f[] = ""; $f[] = "checkrad = {$checkrad}"; $f[] = ""; $f[] = "security {"; $f[] = "\tmax_attributes = 200"; $f[] = "\treject_delay = 1"; $f[] = "\tstatus_server = yes"; $f[] = "}"; $f[] = ""; $f[] = "proxy_requests = yes"; $f[] = "\$INCLUDE proxy.conf"; $f[] = "\$INCLUDE clients.conf"; $f[] = ""; $f[] = "thread pool {"; $f[] = "\tstart_servers = 5"; $f[] = "\tmax_servers = 32"; $f[] = "\tmin_spare_servers = 3"; $f[] = "\tmax_spare_servers = 10"; $f[] = "\tmax_requests_per_server = 0"; $f[] = "}"; $f[] = "pap {"; $f[] = "\tencryption_scheme = clear"; $f[] = "}"; $f[] = ""; $f[] = "modules {"; $f[] = "\t\$INCLUDE \${confdir}/modules/"; $f[] = "\t\$INCLUDE eap.conf"; if ($UseMySQL) { $f[] = "\t\$INCLUDE sql.conf"; } $f[] = "#\t\$INCLUDE sql/mysql/counter.conf"; $f[] = "#\t\$INCLUDE sqlippool.conf"; $f[] = "}"; $f[] = ""; $f[] = ""; $f[] = "instantiate {"; $f[] = "\texpr"; $f[] = "#\tdaily"; $f[] = "\texpiration"; $f[] = "\tlogintime"; $f[] = "}"; $f[] = ""; $f[] = "\$INCLUDE policy.conf"; $f[] = "\$INCLUDE sites-enabled/"; //$f[]="\$INCLUDE dictionary"; dictionary(); echo "Starting FreeRadius.............: /etc/freeradius/radiusd.conf done...\n"; @mkdir("/etc/freeradius", 0755, true); @file_put_contents("/etc/freeradius/radiusd.conf", @implode("\n", $f)); attrs_access_reject(); eap(); pap(); proxy(); ntlm_auth(); build_sql_connections(); module_ldap(); inner_tunnel(); site_default(); confusers(); clients(); mschap(); microtik(); }