function wakeup_client_mode_getWakeup($path){ $f=explode("\n",@file_get_contents($path)); while (list ($num, $line) = each ($f) ){ if(preg_match('#wakeup:"([0-9\.]+)#', $line,$re)){ $ip=$re[1]; $tcp=new ip(); if(!$tcp->isValid($ip)){return null;}else{return $ip;} } } if($GLOBALS["VERBOSE"]){echo "Starting......: $path no wakeup ip addr\n";} }
function remote_site_save() { $sitename = $_POST["sitename"]; $IP_START = $_POST["IP_START"]; $netmask = $_POST["netmask"]; $siteid = $_POST["siteid"]; $wakeupip = $_POST["wakeup"]; $FixedIPAddr = $_POST["FixedIPAddr"]; $connexion_type = 1; if ($sitename == null) { $error[] = "{site_name}"; } if ($IP_START == null) { $error[] = "{from_ip_address}"; } if ($netmask == null) { $error[] = "{netmask}"; } $ip = new ip(); if (!$ip->isValid($IP_START)) { $error[] = "{from_ip_address}"; } if (count($error) > 0) { echo "{error}:" . implode("\n", $error) . " =NULL\n"; exit; } if ($siteid == 0) { $sql = "INSERT INTO vpnclient (sitename,IP_START,netmask,connexion_type,wakeupip,FixedIPAddr) VALUES('{$sitename}','{$IP_START}','{$netmask}',1,'{$wakeupip}','{$FixedIPAddr}')"; } else { $sql = "UPDATE vpnclient SET sitename='{$sitename}',IP_START='{$IP_START}',netmask='{$netmask}',wakeupip='{$wakeupip}',FixedIPAddr='{$FixedIPAddr}' WHERE ID='{$siteid}'"; } $q = new mysql(); $q->BuildTables(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $sock = new sockets(); $sock->getFrameWork("cmd.php?artica-meta-openvpn-sites=yes"); $sock = new sockets(); $sock->getFrameWork("services.php?openvpn=yes"); }
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:16px;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 = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{public_ip_addr}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["LISTEN_PORT"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}:{public_ip_addr}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["LISTEN_PROTO"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{protocol}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong></p>"; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = "<p class=text-error style='font-size:18px'><strong>{MISSING_PARAMETER}</strong><br>{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong></p>"; } $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}"; } if (!$tcp_ip->isValid($vpn->main_array["GLOBAL"]["PUBLIC_IP"])) { $vpn->main_array["GLOBAL"]["PUBLIC_IP"] = "0.0.0.0"; } $ahref_edit = "<a href=\"javascript:blur();\" OnClick=\"Loadjs('index.openvpn.server.php');\" style='font-size:16px;text-decoration:underline'>"; $button_edit = button("{change_settings}", "Loadjs('index.openvpn.server.php')", 34); if ($vpn->main_array["GLOBAL"]["LOCAL_BIND"] == null) { $vpn->main_array["GLOBAL"]["LOCAL_BIND"] = "{none}"; } $openvpn_local = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{openvpn_local}</a>:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["LOCAL_BIND"]}</a></td>\n\t\t\t</tr>"; $mandatories = "<table style='width:99%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{listen_port}:</a></td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px;width:850px'>{$vpn->main_array["GLOBAL"]["LISTEN_PORT"]} {$vpn->main_array["GLOBAL"]["LISTEN_PROTO"]}</a></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:20px'>{public_ip_addr}</a>:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px;'>{$vpn->main_array["GLOBAL"]["PUBLIC_IP"]}:{$CLIENT_NAT_PORT}</a></td>\n\t\t\t<tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{password}:</a></td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px'>*****</a></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:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{enable_authentication}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px;;width:850px'>{$LDAP_AUTH}</td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{EnableOpenVPNEndUserPage}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$EnableOpenVPNEndUserPage}</td>\n\t\t<td> </td>\n\t<tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{reverse_proxy}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$proxy}</td>\n\t<tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{from_ip_address}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["IP_START"]}</td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{netmask}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["NETMASK"]}</a></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{openvpn_access_interface}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["IPTABLES_ETH"]}</a></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{wake_up_ip}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$wake_up_ip}</a></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:20px'>{BRIDGE_ETH}:</td>\n\t\t<td width=1% nowrap>{$nics}</td>\n\t\t<td align='left' style='font-weight:bold;font-size:20px' 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:16px;padding:3px") . "</td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{BRIDGE_ADDR}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap >" . Field_text('BRIDGE_ADDR', $vpn->main_array["GLOBAL"]["BRIDGE_ADDR"], 'width:120px;font-size:16px;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:20px'>{VPN_DHCP_FROM}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap>" . Field_text('VPN_DHCP_FROM', $vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"], 'width:120px;font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{VPN_DHCP_TO}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap>" . Field_text('VPN_DHCP_TO', $vpn->main_array["GLOBAL"]["VPN_DHCP_TO"], 'width:120px;font-size:16px;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; } if ($vpn->main_array["GLOBAL"]["ENABLE_SERVER"] != 1) { $status = FATAL_ERROR_SHOW_128("<strong style='font-size:22px'>{OPENVPN_NOT_ENABLED}</strong><hr>\n\t\t\t{OPENVPN_NOT_ENABLED_TEXT}\n\t\t\t") . "<center style='margin:30px'>" . button("{enable_service}", "Loadjs('index.openvpn.enable.progress.php')", 42) . "</center>"; } if ($status == null) { $button_apply = button("{OPENVPN_APPLY_CONFIG}", "Loadjs('index.openvpn.enable.progress.php')", 34) . " | "; } $html = "\n<div style='font-size:28px;margin-bottom:30px'>{OPENVPN_SERVER_SETTINGS}</div>\n{$status}\n<div style='width:98%' class=form>\n\n\n<div id='OPENVPN_SERVER_SETTINGS'>\n<div style='text-align:right'>{$button_script}</div>\n{$mandatories}\n{$mode}\n<div style='margin-top:15px;text-align:right;font-size:34px'><hr>{$button_apply}{$button_edit}</div>\t\n</div>\n"; $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 }
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=" <tr> <td class=legend style='font-size:13px'>$ahref_edit{openvpn_local}</a>:</td> <td style='font-size:13px'>$ahref_edit{$vpn->main_array["GLOBAL"]["LOCAL_BIND"]}</a></td> <td> </td> </tr>"; $mandatories="<table style='width:100%' class=form> <tr> <td class=legend style='font-size:13px'>$ahref_edit{listen_port}:</a></td> <td style='font-size:13px'>$ahref_edit{$vpn->main_array["GLOBAL"]["LISTEN_PORT"]} {$vpn->main_array["GLOBAL"]["LISTEN_PROTO"]}</a></td> <td> </td> </tr> $openvpn_local <tr> <td class=legend style='font-size:13px'>$ahref_edit{public_ip_addr}</a>:</td> <td style='font-size:13px;'>$ahref_edit{$vpn->main_array["GLOBAL"]["PUBLIC_IP"]}:$CLIENT_NAT_PORT</a></td> <td> </td> <tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{password}:</a></td> <td style='font-size:13px'>$ahref_edit*****</a></td> <td> </td> <tr> </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> <tr> <td class=legend style='font-size:13px'>$ahref_edit{enable_authentication}</a>:</td> <td style='font-size:13px'>$ahref_edit{$LDAP_AUTH}</td> <td> </td> <tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{EnableOpenVPNEndUserPage}</a>:</td> <td style='font-size:13px'>$ahref_edit{$EnableOpenVPNEndUserPage}</td> <td> </td> <tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{reverse_proxy}</a>:</td> <td style='font-size:13px'>$ahref_edit$proxy</td> <td> </td> <tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{from_ip_address}</a>:</td> <td style='font-size:13px'>$ahref_edit{$vpn->main_array["GLOBAL"]["IP_START"]}</td> <td> </td> <tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{netmask}</a>:</td> <td style='font-size:13px'>$ahref_edit{$vpn->main_array["GLOBAL"]["NETMASK"]}</a></td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{openvpn_access_interface}</a>:</td> <td style='font-size:13px'>$ahref_edit{$vpn->main_array["GLOBAL"]["IPTABLES_ETH"]}</a></td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>$ahref_edit{wake_up_ip}</a>:</td> <td style='font-size:13px'>$ahref_edit$wake_up_ip</a></td> <td> </td> </tr> </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=" <div style='width:100%;margin-bottom:5px'> <table style='width:100%'> <tr> <td valign='top'> <div id='nicvpninfo' style='float:right;margin:5px;'>".ShowIPConfig($vpn->main_array["GLOBAL"]["BRIDGE_ETH"])."</div> </td> <td valign='top'> <div class=explain>{SERVER_MODE_TAP}</div> </td> </tr> </table> </div> <table style='width:100%'> <tr> <td class=legend nowrap style='font-size:13px'>{BRIDGE_ETH}:</td> <td width=1% nowrap>$nics</td> <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> <tr> <tr> <td class=legend nowrap style='font-size:13px'>{BRIDGE_ADDR}:</td> <td width=1% nowrap>" . Field_text('BRIDGE_ADDR',$vpn->main_array["GLOBAL"]["BRIDGE_ADDR"],'width:120px;font-size:13px;padding:3px')."</td> <td> </td> </tr> <tr> <td class=legend nowrap style='font-size:13px'>{VPN_DHCP_FROM}:</td> <td width=1% nowrap>" . Field_text('VPN_DHCP_FROM',$vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"],'width:120px;font-size:13px;padding:3px')."</td> <td> </td> </tr> <tr> <td class=legend nowrap style='font-size:13px'>{VPN_DHCP_TO}:</td> <td width=1% nowrap>" . Field_text('VPN_DHCP_TO',$vpn->main_array["GLOBAL"]["VPN_DHCP_TO"],'width:120px;font-size:13px;padding:3px')."</td> <td> </td> </tr> <tr> <td colspan=3 align='right'><hr>". button("{apply}","SaveServerSettings()")."</td> </tr> </table> "; $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=" <table style='width:100%'> <tr> <td valign='top'> <div id='OPENVPN_SERVER_SETTINGS'> <table style='width:100%'> <tr> <td valign='top' style='padding-right:5px;border-right:5px solid #CCCCCC'>$script$status$schedule</td> <td valign='top'> <div style='font-size:16px'>{service_parameters}</div> $mandatories$mode</td> </tr> </table> </div> </td> </tr> </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 }