function status() { $page = CurrentPageName(); $tpl = new templates(); $OPENVPN_SERVER_CONNECT = $tpl->_ENGINE_parse_body("{OPENVPN_SERVER_CONNECT}"); $sql = "SELECT * FROM vpnclient WHERE ID={$_GET["ID"]}"; $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } $infos = "\n\t<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>ID:</td>\n\t\t<td><strong style='font-size:14px'>{$_GET["ID"]}</strong>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{connection_name}:</td>\n\t\t<td><strong style='font-size:14px'>{$ligne["connexion_name"]}</strong>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{openvpn_server}:</td>\n\t\t<td><strong style='font-size:14px'>{$ligne["servername"]}:{$ligne["serverport"]}</strong>\n\t</tr>\t\n\t\n\t\n\t"; $sock = new sockets(); $tbl = unserialize(base64_decode($sock->getFrameWork("cmd.php?openvpn-client-sesssions={$_GET["ID"]}"))); while (list($num, $line) = each($tbl)) { if (preg_match("#(.+?),(.+?)\$#", $line, $re)) { if (preg_match("#bytes#", $re[1])) { $re[2] = FormatBytes($re[2] / 1024); } $re[1] = str_replace("Updated", "{updated_on}", $re[1]); $infos = $infos . "<tr>\n\t\t\t\t<td class=legend style='font-size:14px'>{$re[1]}:</td>\n\t\t\t\t<td><strong style='font-size:14px'>{$re[2]}</strong></td>\n\t\t\t</tr>"; } } $infos = $infos . "</table>"; $reload = LocalParagraphe("reconnect", "reconnect_openvpn_text", "ReconnectSession()", "48-refresh.png"); if ($ligne["enabled"] == 1) { $disable = LocalParagraphe("disable", "disable_openvpn_connection", "DisableConnection()", "shutdown-computer-48.png"); } else { $disable = LocalParagraphe("activate", "activate_openvpn_connection", "EnableConnection()", "48-run.png"); } $delete = LocalParagraphe("delete", "delete_openvpn_connection", "DeleteConnection()", "delete-48.png"); $config = LocalParagraphe("parameters", "edit_openvpn_connection", "EditConnection()", "rouage-48.png"); $html = "\n\t<div id='client-status-id'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=100%'>{$infos}\n\t\t<div style='text-align:right'>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('main_openvpn_clientconf')") . "</div>\n\t\t\n\t\t</td>\n\t\t<td valign='top' width=1%><table class=form><tr><td>{$config}<br>{$reload}<br>{$disable}<br>{$delete}</td></tr></table></td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\n\tvar x_ReconnectSession= function (obj) {\n\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\tRefreshTab('main_openvpn_clientconf');\n\t\t\tif(document.getElementById('master-list')){RefreshOpenVPNMasterList();}\n\t\t}\t\n\t\t\n\tvar x_DeleteConnection= function (obj) {\n\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\tif(document.getElementById('master-list')){RefreshOpenVPNMasterList();}\n\t\t\tYahooWin3Hide();\n\t\t}\t\n\t\t\n\t\n\tfunction ReconnectSession(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('ReconnectSession','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\t\t\n\tfunction DisableConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('DisableConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\n\tfunction EnableConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('EnableConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\n\tfunction DeleteConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('DeleteConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteConnection); \n\t\t} \t\n\n\tfunction EditConnection(){\n\t\t\tLoadjs('openvpn.servers-connect.php?inline-js-id={$_GET["ID"]}');\n\t\t}\t\t\n\t\t\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function fetchmail(){ $users=new usersMenus(); if(!$users->fetchmail_installed){return null;} return LocalParagraphe("play_with_isp","play_with_isp","Loadjs('configure.server.php?script=fetchmail_script')","home-48.png"); }
function incremental_backup() { $GLOBALS["ICON_FAMILY"] = "BACKUP"; $js = "Loadjs('wizard.backup-all.php')"; $img = "64-dar-index.png"; return Paragraphe($img, "{manage_backups}", "{manage_backups}", "javascript:{$js}"); return LocalParagraphe("manage_backups", "manage_backups", $js, "48-dar-index.png"); }
function popup_status(){ if(GET_CACHED(__FILE__,__FUNCTION__,"{$_GET["hostname"]}&ou={$_GET["ou"]}")){return;} $tpl=new templates(); $page=CurrentPageName(); $ou_encoded=base64_encode($_GET["ou"]); $delete_postfix_instance_sure=$tpl->javascript_parse_text("{delete_postfix_instance_sure}\n{$_GET["hostname"]}"); $tr[]=LocalParagraphe("postfix_reload", "postfix_reload_text", "MultipleInstanceReload()", "32-refresh.png"); $tr[]=LocalParagraphe("postfix_restart", "postfix_restart_text", "MultipleInstanceRestart()", "service-restart-32.png"); $tr[]=LocalParagraphe("postfix_reconfigure", "postfix_reconfigure_text", "MultipleInstanceReconfigure()", "32-settings.png"); $tr[]=LocalParagraphe("flush_queue", "flush_queue_text", "MultipleInstanceFlush()", "refresh-queue-32.png"); $tr[]=LocalParagraphe("delete_postfix_instance", "delete_postfix_instance_text", "MultipleInstanceDelete()", "delete-32.png"); $tr[]=LocalParagraphe("pause_the_queue", "pause_the_queue_text", "Loadjs('postfix.freeze.queue.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "pause-32.png"); $tables[]="<table style='width:100%'><tr>"; $t=0; while (list ($key, $line) = each ($tr) ){ $line=trim($line); if($line==null){continue;} $t=$t+1; $tables[]="<td valign='top'>$line</td>"; if($t==2){$t=0;$tables[]="</tr><tr>";} } if($t<2){ for($i=0;$i<=$t;$i++){ $tables[]="<td valign='top'> </td>"; } } $tables[]="</table>"; $toolbox=implode("\n",$tables); $html=" <div style='float:right'>". imgtootltip("20-refresh.png","{refresh}","MultipleInstanceRefreshEtat()")."</div> <div id='postfix-status-etat'></div> <div id='postfix-multi-toolbox' style='margin-top:3px'> $toolbox </div> <script> var x_MultipleInstanceReload=function (obj) { var tempvalue=obj.responseText; if (tempvalue.length>0){alert(tempvalue);} RefreshTab('main_multi_config_postfix'); } function MultipleInstanceReload(){ var XHR = new XHRConnection(); XHR.appendData('ou','{$_GET["ou"]}'); XHR.appendData('hostname','{$_GET["hostname"]}'); XHR.appendData('instance-reload','{$_GET["hostname"]}'); document.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>'; XHR.sendAndLoad('$page', 'GET',x_MultipleInstanceReload); } function MultipleInstanceRestart(){ var XHR = new XHRConnection(); XHR.appendData('ou','{$_GET["ou"]}'); XHR.appendData('hostname','{$_GET["hostname"]}'); XHR.appendData('instance-restart','{$_GET["hostname"]}'); document.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>'; XHR.sendAndLoad('$page', 'GET',x_MultipleInstanceReload); } function MultipleInstanceFlush(){ var XHR = new XHRConnection(); XHR.appendData('ou','{$_GET["ou"]}'); XHR.appendData('hostname','{$_GET["hostname"]}'); XHR.appendData('instance-flush','{$_GET["hostname"]}'); document.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>'; XHR.sendAndLoad('$page', 'GET',x_MultipleInstanceReload); } function MultipleInstanceReconfigure(){ var XHR = new XHRConnection(); XHR.appendData('ou','{$_GET["ou"]}'); XHR.appendData('hostname','{$_GET["hostname"]}'); XHR.appendData('instance-reconfigure','{$_GET["hostname"]}'); document.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>'; XHR.sendAndLoad('$page', 'GET',x_MultipleInstanceReload); } var x_MultipleInstanceDelete=function (obj) { var tempvalue=obj.responseText; if (tempvalue.length>0){alert(tempvalue);} if(document.getElementById('org_main')){ RefreshTab('org_main'); }else{ Loadjs('domains.postfix.multi.php?ou=$ou_encoded&encoded=yes&in-front-ajax=yes'); } } function MultipleInstanceRefreshEtat(){ LoadAjax('postfix-status-etat','$page?status-server=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}'); } function MultipleInstanceDelete(){ var a=confirm('$delete_postfix_instance_sure'); if(a){ var XHR = new XHRConnection(); XHR.appendData('ou','{$_GET["ou"]}'); XHR.appendData('hostname','{$_GET["hostname"]}'); XHR.appendData('instance-kill','{$_GET["hostname"]}'); document.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>'; XHR.sendAndLoad('$page', 'GET',x_MultipleInstanceDelete); } } MultipleInstanceRefreshEtat(); </script> "; $html=$tpl->_ENGINE_parse_body($html); echo $html; SET_CACHED(__FILE__,__FUNCTION__,"{$_GET["hostname"]}&ou={$_GET["ou"]}",$html); }
function popup_status() { //if(GET_CACHED(__FILE__,__FUNCTION__,"{$_GET["hostname"]}&ou={$_GET["ou"]}")){return;} $tpl = new templates(); $page = CurrentPageName(); $ou_encoded = base64_encode($_GET["ou"]); $delete_postfix_instance_sure = $tpl->javascript_parse_text("{delete_postfix_instance_sure}\n{$_GET["hostname"]}"); $maincf = new maincf_multi($_GET["hostname"]); $enabled = 1; if ($maincf->GET("DisabledInstance") == 1) { $enabled = 0; $fontcolor = "#B3B3B3"; } if ($enabled == 1) { $tr[] = LocalParagraphe("postfix_reload", "postfix_reload_text", "MultipleInstanceReload()", "32-refresh.png"); $tr[] = LocalParagraphe("postfix_restart", "postfix_restart_text", "MultipleInstanceRestart()", "service-restart-32.png"); $tr[] = LocalParagraphe("postfix_reconfigure", "postfix_reconfigure_text", "MultipleInstanceReconfigure()", "32-settings.png"); $tr[] = LocalParagraphe("flush_queue", "flush_queue_text", "MultipleInstanceFlush()", "refresh-queue-32.png"); } $tr[] = LocalParagraphe("delete_postfix_instance", "delete_postfix_instance_text", "MultipleInstanceDelete()", "delete-32.png"); $tr[] = LocalParagraphe("pause_the_queue", "pause_the_queue_text", "Loadjs('postfix.freeze.queue.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "pause-32.png"); $tr[] = LocalParagraphe("purge_all_queues", "purge_all_queues_text", "Loadjs('postfix.purge.queues.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "32-hd-delete.png"); $tr[] = LocalParagraphe("bookmark_item", "bookmark_item_text", "Loadjs('postfix.multi-bookmark.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "document-prefered-32.png"); $tr[] = LocalParagraphe("send_test_message", "send_test_message_text", "Loadjs('postfix.multi-tests.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "test-message-32.png"); $tr[] = LocalParagraphe("main.cf", "main.cf_explain", "Loadjs('postfix.main.cf.php?hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')", "script-32.png"); $tables[] = "<table style='width:99%' class=form><tr>"; $t = 0; while (list($key, $line) = each($tr)) { $line = trim($line); if ($line == null) { continue; } $t = $t + 1; $tables[] = "<td valign='top'>{$line}</td>"; if ($t == 2) { $t = 0; $tables[] = "</tr><tr>"; } } if ($t < 2) { for ($i = 0; $i <= $t; $i++) { $tables[] = "<td valign='top'> </td>"; } } $tables[] = "</table>"; $toolbox = implode("\n", $tables); $html = "\n<div style='float:right'>" . imgtootltip("20-refresh.png", "{refresh}", "MultipleInstanceRefreshEtat()") . "</div>\n<div id='postfix-status-etat'></div>\n\n<div id='postfix-multi-toolbox' style='margin-top:-55px'>\n\t{$toolbox}\n</div>\n<script>\n\n\tvar x_MultipleInstanceReload=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif (tempvalue.length>0){alert(tempvalue);} \n\t\tRefreshTabMainMultiConfigPostfix();\n\t} \n\n\tfunction MultipleInstanceReload(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('instance-reload','{$_GET["hostname"]}');\n\t\tdocument.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_MultipleInstanceReload);\n\t}\n\t\n\tfunction MultipleInstanceRestart(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('instance-restart','{$_GET["hostname"]}');\n\t\tdocument.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_MultipleInstanceReload);\n\t}\t\n\t\n\tfunction MultipleInstanceFlush(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('instance-flush','{$_GET["hostname"]}');\n\t\tdocument.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_MultipleInstanceReload);\n\t}\n\n\tfunction MultipleInstanceReconfigure(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('instance-reconfigure','{$_GET["hostname"]}');\n\t\tdocument.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_MultipleInstanceReload);\n\t}\t\n\t\n\t\n\t\n\t\n\t\nvar x_MultipleInstanceDelete=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif (tempvalue.length>0){alert(tempvalue);} \n\t\tif(document.getElementById('org_main')){\n\t\t\tRefreshTab('org_main');\n\t\t}else{\n\t\t\tLoadjs('domains.postfix.multi.php?ou={$ou_encoded}&encoded=yes&in-front-ajax=yes');\n\t\t}\n\t} \t\n\t\n\tfunction MultipleInstanceRefreshEtat(){\n\t\tLoadAjax('postfix-status-etat','{$page}?status-server=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}');\n\t\n\t}\n\t\n\t\n\tfunction MultipleInstanceDelete(){\n\t\tvar a=confirm('{$delete_postfix_instance_sure}');\n\t\tif(a){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ou','{$_GET["ou"]}');\n\t\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\t\tXHR.appendData('instance-kill','{$_GET["hostname"]}');\n\t\t\tdocument.getElementById('postfix-multi-toolbox').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_MultipleInstanceDelete);\n\t\t}\n\t\t\t\n\t\n\t}\n\t\n\tif(document.getElementById('admin-left-infos')){\n\t\tLoadAjax('admin-left-infos','admin.index.status-infos.php');\n\t}\n\t\n\tMultipleInstanceRefreshEtat();\n\t\n</script>\n\n"; $html = $tpl->_ENGINE_parse_body($html); echo $html; SET_CACHED(__FILE__, __FUNCTION__, "{$_GET["hostname"]}&ou={$_GET["ou"]}", $html); }
function server_settings() { $vpn = new openvpn(); $nic = new networking(); $sock = new sockets(); $OpenVpnPasswordCert = $sock->GET_INFO("OpenVpnPasswordCert"); if ($OpenVpnPasswordCert == null) { $OpenVpnPasswordCert = "MyKey"; } //openvpn_access_interface $DEV_TYPE = $vpn->main_array["GLOBAL"]["DEV_TYPE"]; $dev = Field_array_Hash(array("tun" => "{routed_IP_tunnel}", "tap0" => "{ethernet_tunnel}"), "DEV_TYPE", $vpn->main_array["GLOBAL"]["DEV_TYPE"], "OpenVPNChangeServerMode()", null, 0, 'font-size:13px;padding:3px'); $dev = "{routed_IP_tunnel}<input type='hidden' name='DEV_TYPE' id='DEV_TYPE' value='tun'>"; if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $vpn->main_array["GLOBAL"]["IP_START"] = "10.8.0.0"; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $vpn->main_array["GLOBAL"]["NETMASK"] = "255.255.255.0"; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $openvpn_local = null; } $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"]; if ($CLIENT_NAT_PORT == null) { $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["LISTEN_PORT"]; } $vpn->main_array["GLOBAL"]["PUBLIC_IP"]; $vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"]; $vpn->main_array["GLOBAL"]["LISTEN_PORT"]; $vpn->main_array["GLOBAL"]["LISTEN_PROTO"]; $vpn->main_array["GLOBAL"]["ENABLE_SERVER"]; $vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"]; $vpn->main_array["GLOBAL"]["IP_START"]; $vpn->main_array["GLOBAL"]["IPTABLES_ETH"]; if ($vpn->main_array["GLOBAL"]["PUBLIC_IP"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{public_ip_addr}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["LISTEN_PORT"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}:{public_ip_addr}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["LISTEN_PROTO"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{protocol}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = LocalParagraphe("MISSING_PARAMETER", "{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong>", "Loadjs('index.openvpn.server.php')", "42-red.png"); } $LDAP_AUTH = "{no}"; $EnableOpenVPNEndUserPage = "{no}"; if ($vpn->main_array["GLOBAL"]["LDAP_AUTH"] == 1) { $LDAP_AUTH = "{yes}"; } if ($sock->GET_INFO("EnableOpenVPNEndUserPage") == 1) { $EnableOpenVPNEndUserPage = "{yes}"; } $wake_up_ip = $vpn->main_array["GLOBAL"]["WAKEUP_IP"]; $tcp_ip = new ip(); if (!$tcp_ip->isValid($wake_up_ip)) { $wake_up_ip = "{disabled}"; } $ahref_edit = "<a href=\"javascript:blur();\" OnClick=\"Loadjs('index.openvpn.server.php');\" style='font-size:13px;text-decoration:underline'>"; $openvpn_local = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{openvpn_local}</a>:</td>\n\t\t\t\t<td style='font-size:13px'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["LOCAL_BIND"]}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>"; $mandatories = "<table style='width:100%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{listen_port}:</a></td>\n\t\t\t\t<td style='font-size:13px'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["LISTEN_PORT"]} {$vpn->main_array["GLOBAL"]["LISTEN_PROTO"]}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\n\t\t\t{$openvpn_local}\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{public_ip_addr}</a>:</td>\n\t\t\t\t<td style='font-size:13px;'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["PUBLIC_IP"]}:{$CLIENT_NAT_PORT}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t<tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{password}:</a></td>\n\t\t\t\t<td style='font-size:13px'>{$ahref_edit}*****</a></td>\n\t\t\t\t<td> </td>\n\t\t\t<tr>\n\t\t\t</table>"; $proxy = "{no}"; if ($vpn->main_array["GLOBAL"]["USE_RPROXY"] == 1) { $proxy = "{$vpn->main_array["GLOBAL"]["PROXYADDR"]}:{$vpn->main_array["GLOBAL"]["PROXYPORT"]}"; } if ($vpn->main_array["GLOBAL"]["IPTABLES_ETH"] == null) { $vpn->main_array["GLOBAL"]["IPTABLES_ETH"] = "{no}"; } $mode_tun = "<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{enable_authentication}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$LDAP_AUTH}</td>\n\t\t<td> </td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{EnableOpenVPNEndUserPage}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$EnableOpenVPNEndUserPage}</td>\n\t\t<td> </td>\n\t<tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{reverse_proxy}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$proxy}</td>\n\t\t<td> </td>\n\t<tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{from_ip_address}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["IP_START"]}</td>\n\t\t<td> </td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{netmask}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["NETMASK"]}</a></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{openvpn_access_interface}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$vpn->main_array["GLOBAL"]["IPTABLES_ETH"]}</a></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:13px'>{$ahref_edit}{wake_up_ip}</a>:</td>\n\t\t<td style='font-size:13px'>{$ahref_edit}{$wake_up_ip}</a></td>\n\t\t<td> </td>\n\t</tr>\t\n\t\n</table>"; $VPN_SERVER_IP = $vpn->main_array["GLOBAL"]["VPN_SERVER_IP"]; $VPN_DHCP_FROM = $vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"]; $VPN_DHCP_TO = $vpn->main_array["GLOBAL"]["VPN_DHCP_TO"]; $tcp = new networking(); if ($vpn->main_array["GLOBAL"]["BRIDGE_ETH"] == null) { $vpn->main_array["GLOBAL"]["BRIDGE_ETH"] = "eth0"; } $array_ip = $tcp->GetNicInfos($vpn->main_array["GLOBAL"]["BRIDGE_ETH"]); if ($vpn->main_array["GLOBAL"]["VPN_SERVER_IP"] == null) { $vpn->main_array["GLOBAL"]["VPN_SERVER_IP"] = $array_ip["IPADDR"]; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $vpn->main_array["GLOBAL"]["NETMASK"] = $array_ip["NETMASK"]; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $nics = Field_array_Hash($vpn->virtual_ip_lists(), 'BRIDGE_ETH', $vpn->main_array["GLOBAL"]["BRIDGE_ETH"]); } $mode_tap = "\n\t<div style='width:100%;margin-bottom:5px'>\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<div id='nicvpninfo' style='float:right;margin:5px;'>" . ShowIPConfig($vpn->main_array["GLOBAL"]["BRIDGE_ETH"]) . "</div>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<div class=explain>{SERVER_MODE_TAP}</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:13px'>{BRIDGE_ETH}:</td>\n\t\t<td width=1% nowrap>{$nics}</td>\n\t\t<td align='left' width=1% nowrap>" . texttooltip("{add_virtual_ip_address}", "{add_virtual_ip_address}", "Loadjs('system.nic.config.php?js-add-nic=yes')", null, 0, "font-size:13px;padding:3px") . "</td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:13px'>{BRIDGE_ADDR}:</td>\n\t\t<td width=1% nowrap>" . Field_text('BRIDGE_ADDR', $vpn->main_array["GLOBAL"]["BRIDGE_ADDR"], 'width:120px;font-size:13px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:13px'>{VPN_DHCP_FROM}:</td>\n\t\t<td width=1% nowrap>" . Field_text('VPN_DHCP_FROM', $vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"], 'width:120px;font-size:13px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:13px'>{VPN_DHCP_TO}:</td>\n\t\t<td width=1% nowrap>" . Field_text('VPN_DHCP_TO', $vpn->main_array["GLOBAL"]["VPN_DHCP_TO"], 'width:120px;font-size:13px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{apply}", "SaveServerSettings()") . "</td>\n\t</tr>\t\t\t\t\n</table>\n"; $mode = $mode_tun; if ($vpn->main_array["GLOBAL"]["DEV_TYPE"] == "tap0") { $mode = $mode_tap; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $mode = $mode_tap; } $schedule = LocalParagraphe("OPENVPN_SCHEDULE_RUN", "OPENVPN_SCHEDULE_RUN_TEXT", "Loadjs('index.openvpn.schedule.php')", "ScheduleSettings-48.png"); if ($vpn->main_array["GLOBAL"]["ENABLE_SERVER"] != 1) { $status = LocalParagraphe("OPENVPN_NOT_ENABLED", "OPENVPN_NOT_ENABLED_TEXT", "Loadjs('index.openvpn.server.php')", "warning42.png"); } if ($status == null) { $status = LocalParagraphe("OPENVPN_APPLY_CONFIG", "OPENVPN_APPLY_CONFIG_TEXT", "YahooWin3(500,'index.openvpn.php?restart-server=yes','{APP_OPENVPN_APPLY}')", "reconfigure-42.png"); $script = LocalParagraphe("BUILD_OPENVPN_CLIENT_CONFIG", "BUILD_OPENVPN_CLIENT_CONFIG_TEXT", "Loadjs('index.openvpn.build.client.php')", "script-42.png"); } $html = "\n<table style='width:100%'>\n<tr>\n<td valign='top'>\n<div id='OPENVPN_SERVER_SETTINGS'>\n<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top' style='padding-right:5px;border-right:5px solid #CCCCCC'>{$script}{$status}{$schedule}</td>\n\t\t\t<td valign='top'>\n\t\t\t<div style='font-size:16px'>{service_parameters}</div>\n\t\t\t{$mandatories}{$mode}</td>\n\t\t</tr>\n\t\t</table>\n\t\t\n\t</div>\n</td>\n</tr>\n</table>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); // openvpn --remote touzeau.ath.cx --port 1194 --dev tun --comp-lzo --tls-client --ca /home/dtouzeau/ca.crt --cert /home/dtouzeau/dtouzeau.crt --key /home/dtouzeau/dtouzeau.key --verb 5 --pull }