]> git.gsnw.org Git - m0n0chwall.git/commitdiff
Import m0n0wall 1.2 files.
authormkasper <mkasper@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Sun, 8 Jan 2006 10:38:35 +0000 (10:38 +0000)
committermkasper <mkasper@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Sun, 8 Jan 2006 10:38:35 +0000 (10:38 +0000)
git-svn-id: https://svn.m0n0.ch/wall/trunk@25 e36fee2c-cc09-0410-a7cc-ebac5c6737de

36 files changed:
captiveportal/radius_accounting.inc
phpconf/config.xml
phpconf/inc/config.inc
phpconf/inc/filter.inc
phpconf/inc/functions.inc
phpconf/inc/globals.inc
phpconf/inc/interfaces.inc
phpconf/inc/openvpn.inc [deleted file]
phpconf/inc/services.inc
phpconf/inc/system.inc
phpconf/rc.bootup
phpconf/rc.newwanip
webgui/diag_arp.php
webgui/diag_ping.php
webgui/diag_traceroute.php
webgui/fbegin.inc
webgui/firewall_nat_out.php
webgui/firewall_rules.php
webgui/guiconfig.inc
webgui/interfaces_assign.php
webgui/interfaces_opt.php
webgui/interfaces_wan.php
webgui/license.php
webgui/plus_d.gif [new file with mode: 0644]
webgui/services_dhcp.php
webgui/services_dhcp_relay.php
webgui/services_proxyarp_edit.php
webgui/services_wol.php
webgui/services_wol_edit.php
webgui/status.php
webgui/status_ovpn.php [deleted file]
webgui/vpn_ipsec_edit.php
webgui/vpn_openvpn_cli.php [deleted file]
webgui/vpn_openvpn_cli_edit.php [deleted file]
webgui/vpn_openvpn_srv.php [deleted file]
webgui/vpn_openvpn_srv_edit.php [deleted file]

index 14264f6cf1c7be046614da2712d2d753c6b494a1..3459efd1a84cdead7a2fcfd38beeadfae9aca122 100644 (file)
        // * now sends Framed-IP-Address (client IP)
        // * now sends Called-Station-ID (NAS IP)
        // * now sends Calling-Station-ID (client IP)
+
+       // This version of radius_accounting.inc has been modified by
+       // Jonathan De Graeve <jonathan@imelda.be>. Changes made include:
+       // - RFC2869 (Radius Extensions)
+       // * now sends Acct-Input-Gigawords
+       // * now sends Acct-Output-Gigawords
+
 */
 
 function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip) {
@@ -60,6 +67,9 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
        if ($debug)
            echo "<br>radius-port: $radiusport<br>radius-host: $radiusip<br>username: $username<hr>\n";
 
+       /* Initialise rand function, make it more random */
+       srand((double)microtime() * 1000000);
+
        $thisidentifier=rand()%256;
 
        $length=4+                              // header
@@ -135,7 +145,7 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
        // See RFC2866 for this.
 }
 
-function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$interimupdate=false) {
+function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$interimupdate=false, $radius_term_cause = 1) {
        $sharedsecret=$radiuskey ;
        # $debug = 1 ;
 
@@ -143,17 +153,19 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        if(!$nasHostname[0])
                $nasHostname[0] = "quewall" ;
 
-       $input_pkts = $input_bytes = $output_pkts = $output_bytes = 0 ;
+       $input_pkts = $input_bytes = $input_gigawords = $output_pkts = $output_bytes = $output_gigawords = 0 ;
 
        exec("/sbin/ipfw show {$ruleno}", $ipfw) ;      
        preg_match("/(\d+)\s+(\d+)\s+(\d+)\s+skipto/", $ipfw[0], $matches) ;
        $input_pkts = $matches[2] ;
-       $input_bytes = $matches[3] ;
+       $input_bytes = remainder($matches[3]) ;
+       $input_gigawords = gigawords($matches[3]) ;
 
        unset($matches) ;
        preg_match("/(\d+)\s+(\d+)\s+(\d+)\s+skipto/", $ipfw[1], $matches) ;
        $output_pkts = $matches[2] ;
-       $output_bytes = $matches[3] ;
+       $output_bytes = remainder($matches[3]) ;
+       $output_gigawords = gigawords($matches[3]) ;
 
        $fd = @fsockopen("udp://$radiusip",$radiusport,$errno,$errstr,3) ;
        if(!$fd) 
@@ -173,6 +185,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        if ($debug)
            echo "<br>radius-port: $radiusport<br>radius-host: $radiusip<br>username: $username<hr>\n";
 
+       /* Initialise rand function, make it more random */
+       srand((double)microtime() * 1000000);
+
        $thisidentifier=rand()%256;
 
        $length=4+                              // header
@@ -189,8 +204,10 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                6+                              // Session time
                6+                              // input bytes
                6+                              // input packets
+               6+                              // input gigawords
                6+                              // output bytes
                6+                              // output packets
+               6+                              // output gigawords
                2+strlen($nas_ip_address)+              //Called-Station-ID
                2+strlen($clientip)+    //Calling-Station-ID
 
@@ -201,9 +218,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        else
                $acctstatustype = 2;
 
-       //          v   v   v     v   v   v     v     v     v     1   1  1  1  1  1  1  v
-       // Line #   1   2   3     4   5   6     7     8     9     0   1  2  3  4  5  6  E
-       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
+       //          v   v   v     v   v   v     v     v     v     1   1  1  1  1  1  1  1  1  v
+       // Line #   1   2   3     4   5   6     7     8     9     0   1  2  3  4  5  6  7  8  E
+       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            0,0,0,0,                                            // authcode
            6,6,0,0,0,1,                                        // service type
@@ -214,12 +231,14 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                40,6,0,0,0,$acctstatustype,                     // Acct Status Type
                45,6,0,0,0,1,                                           // Acct RADIUS Authenticated
                44,2+strlen($sessionid),$sessionid,     // Acct Session ID
-               49,6,1,         // Acct Terminate = User Request
+               49,6,$radius_term_cause,                // Acct Terminate = User Request
                46,6,time() - $start_time,                      // Session Time
                42,6,$input_bytes,      // Input Octets
                47,6,$input_pkts,       // Input Packets
+               52,6,$input_gigawords,  // Input Gigawords
                43,6,$output_bytes, // Output Octets
                48,6,$output_pkts,      // Output Packets
+               53,6,$output_gigawords, // Output Gigawords
                30,2+strlen($nas_ip_address),$nas_ip_address,   //Called-Station-ID
                31,2+strlen($clientip),$clientip,                               //Calling-Station-ID
 
@@ -229,9 +248,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        /* Generate Accounting Request Authenticator */
        $RA = md5($data.$radiuskey) ;
 
-       //          v   v v     v   v   v     v     v     v     1   1  1  1  1  1  1  v
-       // Line #   1   2 3     4   5   6     7     8     9     0   1  2  3  4  5  6  E
-       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
+       //          v   v v     v   v   v     v     v     v     1   1  1  1  1  1  1  1  1  v
+       // Line #   1   2 3     4   5   6     7     8     9     0   1  2  3  4  5  6  7  8  E
+       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            $RA,                                                // authcode
            6,6,0,0,0,1,                                        // service type
@@ -242,12 +261,14 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                40,6,0,0,0,$acctstatustype,                     // Acct Status Type
                45,6,0,0,0,1,                                           // Acct RADIUS Authenticated
                44,2+strlen($sessionid),$sessionid,     // Acct Session ID
-               49,6,1,         // Acct Terminate = User Request
+               49,6,$radius_term_cause,                // Acct Terminate = User Request
                46,6,time() - $start_time,                      // Session Time
                42,6,$input_bytes,      // Input Octets
                47,6,$input_pkts,       // Input Packets
+               52,6,$input_gigawords,  // Input Gigawords
                43,6,$output_bytes, // Output Octets
                48,6,$output_pkts,      // Output Packets
+               53,6,$output_gigawords, // Output Gigawords
                30,2+strlen($nas_ip_address),$nas_ip_address,   //Called-Station-ID
                31,2+strlen($clientip),$clientip,                               //Calling-Station-ID
 
@@ -287,4 +308,21 @@ function get_nas_ip() {
        return $config['interfaces']['wan']['ipaddr'];
 }
 
+function gigawords($bytes) {
+
+       /* We use BCMath functions since normal integers don't work with so large numbers */
+       $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , 2147483647) ;
+
+       return $gigawords;
+}
+
+function remainder($bytes) {
+
+       /* Calculate the bytes we are going to send to the radius. */
+       $bytes = bcmod($bytes, 2147483647);
+
+       return $bytes;
+}
+
+
 ?>
index 309e8a252fd766e72a8e3f1706f91d71b9a6e235..85a1c12e3643f05465d8fdd0ec3ad28ce3109c7a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!-- m0n0wall default system configuration -->
 <m0n0wall>
-       <version>1.5</version>
+       <version>1.6</version>
        <lastchange></lastchange>
        <system>
                <hostname>m0n0wall</hostname>
                <!--
                <ondemand/>
                <timeout></timeout>
+               <dnsnosec/>
                -->
        </pppoe>
        <pptp>
                <remote></remote>
                <!--
                <ondemand/>
+               <local-ip></local-ip>
+               <remote-ip></remote-ip>
                <timeout></timeout>
                -->
        </pptp>
                </user>
                -->
        </pptpd>
-       <ovpn>
-               <!--
-               <server>
-                       <enable/>
-                       <ca_cert></ca_cert>
-                       <srv_cert></srv_cert>
-                       <srv_key></srv_key>
-                       <dh_param></dh_param>
-                       <verb></verb>
-                       <tun_iface></tun_iface>
-                       <port></port>
-                       <bind_iface></bind_iface>
-                       <cli2cli/>
-                       <maxcli></maxcli>
-                       <prefix></prefix>
-                       <ipblock></ipblock>
-                       <crypto></crypto>
-                       <dupcn/>
-                       <psh_options>
-                               <redir></redir>
-                               <redir_loc></redir_loc>
-                               <rte_delay></rte_delay>
-                               <ping></ping>
-                               <pingrst></pingrst>
-                               <pingexit></pingexit>
-                               <inact></inact>
-                       </psh_options>
-               </server>
-               <client>
-                       <tunnel></tunnel>
-                       <ca_cert></ca_cert>
-                       <cli_cert></cli_cert>
-                       <cli_key></cli_key>
-                       <type></type>
-                       <tunnel>
-                               <if></if>
-                               <proto></proto>
-                               <cport></cport>
-                               <saddr></saddr>
-                               <sport></sport>
-                               <crypto></crypto>
-                       </tunnel>
-               </client>
-               -->
-       </ovpn>
        <dnsmasq>
                <enable/>
                <!--
index d49948cdcb01ff84afda80ee9ec101cd64d5350e..71f4b264f7c005cf294f8acd1088ffc411ca5525 100644 (file)
@@ -519,6 +519,38 @@ function convert_config() {
                $config['version'] = "1.5";
        }
        
+       /* convert 1.5 -> 1.6 */
+       if ($config['version'] == "1.5") {
+       
+               /* Remove OpenVPN configuration */
+               unset($config['ovpn']);
+               
+               /* Remove OpenVPN interfaces */
+               for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
+                       if (isset($config['interfaces']['opt' . $i]['ovpn'])) {
+                       
+                               unset($config['interfaces']['opt' . $i]);
+
+                               /* shift down other OPTn interfaces to get rid of holes */
+                               $j = $i + 1;
+                               
+                               /* look at the following OPTn ports */
+                               while (is_array($config['interfaces']['opt' . $j])) {
+                                       $config['interfaces']['opt' . ($j - 1)] =
+                                               $config['interfaces']['opt' . $j];
+                                       
+                                       if ($config['interfaces']['opt' . ($j - 1)]['descr'] == "OPT" . $j)
+                                               $config['interfaces']['opt' . ($j - 1)]['descr'] = "OPT" . ($j - 1);
+                                       
+                                       unset($config['interfaces']['opt' . $j]);
+                                       $j++;
+                               }
+                       }
+               }
+
+               $config['version'] = "1.6";
+       }
+       
        write_config();
        
        if ($g['booting'])
index b6fe7382b1104dca16822bcef8c0228ee110c37f..a85da2e5743e6ebe768ab8b90c4b715b14691f27 100644 (file)
@@ -195,7 +195,7 @@ function filter_nat_rules_generate() {
                for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                        $optcfg = $config['interfaces']['opt' . $i];
                        
-                       if (isset($optcfg['enable']) && !$optcfg['bridge'] && !isset($optcfg['ovpn'])) {
+                       if (isset($optcfg['enable']) && !$optcfg['bridge']) {
                                $optsa = gen_subnet($optcfg['ipaddr'], $optcfg['subnet']);
                                $natrules .= filter_nat_rules_generate_if($wanif, 
                                        $optsa . "/" . $optcfg['subnet'], "", null);
@@ -300,7 +300,6 @@ function filter_rules_generate() {
                if (isset($oc['enable']) && $oc['if']) {
                        $oic = array();
                        $oic['if'] = $oc['if'];
-                       $oic['ovpn'] = $oc['ovpn'];
                        
                        if ($oc['bridge']) {
                                if (!strstr($oc['bridge'], "opt") || 
@@ -413,11 +412,6 @@ block in $log quick on $wanif from $lansa/$lansn to any
 EOD;
 
        foreach ($optcfg as $oc) {
-               if (isset($oc['ovpn'])) {
-                       /* exclude OpenVPN tunneling interfaces */
-                       /* $ovpnclient = true; */
-                       continue;
-               }
                if (!$oc['bridge'])
                        $ipfrules .= "block in $log quick on $wanif from {$oc['sa']}/{$oc['sn']} to any\n";
        }
@@ -463,7 +457,7 @@ EOD;
        /* OPT spoof check */
        foreach ($optcfg as $on => $oc) {
                /* omit for bridged interfaces when the filtering bridge is on */
-               if ($oc['ip'] && (!$oc['bridge'] || !isset($config['bridge']['filteringbridge'])) && $oc['sa'] != "0.0.0.0")
+               if ($oc['ip'] && (!$oc['bridge'] || !isset($config['bridge']['filteringbridge'])))
                        $ipfrules .= filter_rules_spoofcheck_generate($on, $oc['if'], $oc['sa'], $oc['sn'], $log);
        }
        
index 8435ea1b2534109638f931e589a7308f8f696649..a23a37a2b7b8db669070c123521f687038db5c80 100644 (file)
@@ -36,6 +36,5 @@ require_once("filter.inc");
 require_once("shaper.inc");
 require_once("vpn.inc");
 require_once("captiveportal.inc");
-require_once("openvpn.inc");
 
 ?>
index f6db4170474a59b98135417c4f29a4a878f5e674..14be2c81fab3370d321ebb469cb209049f78527f 100644 (file)
@@ -47,7 +47,7 @@ $g = array(
     "n_pptp_units" => 16,
     "pptp_subnet" => 28,
     "debug" => false,
-    "latest_config" => "1.5",
+    "latest_config" => "1.6",
     "nopccard_platforms" => array("wrap", "net48xx"),
     "wireless_regex" => "/^(wi|ath|an)/"
 );
index 80d823de2f8be905705d21758beb8925df43348e..0dc5e5e5bdc7b71932831883c4a540216b02b394 100644 (file)
@@ -235,12 +235,6 @@ function interfaces_optional_configure_if($opti) {
                                $cmd .= " mediaopt " . escapeshellarg($optcfg['mediaopt']);
                        mwexec($cmd);
                }
-               
-               /* OpenVPN configuration? */
-               if (isset($optcfg['ovpn'])) {
-                       if (strstr($if, "tap"))
-                               ovpn_link_tap();
-               }
        
                $addflags = "";
                if (strpos($optcfg['if'], "fxp") !== false)
@@ -533,10 +527,17 @@ pppoe:
 EOD;
        
        if (isset($pppoecfg['ondemand'])) {
-               $mpdconf .= <<<EOD
-       set iface addrs 10.0.0.1 10.0.0.2
+               if (isset($pppoecfg['local-ip']) && isset($pppoecfg['remote-ip'])) {
+                       $mpdconf .= <<<EOD
+       set iface addrs {$pppoecfg['local-ip']} {$pppoecfg['remote-ip']}
+
+EOD;
+               } else {
+                       $mpdconf .= <<<EOD
+       set iface addrs 192.0.2.112 192.0.2.113
 
 EOD;
+               }
        }
        
        $mpdconf .= <<<EOD
@@ -557,9 +558,14 @@ EOD;
        if (isset($config['system']['dnsallowoverride'])) {
                $mpdconf .= <<<EOD
        set ipcp enable req-pri-dns
+
+EOD;
+               if (!isset($config['pppoe']['dnsnosec'])) {
+                       $mpdconf .= <<<EOD
        set ipcp enable req-sec-dns
 
 EOD;
+               }
        }
        
        $mpdconf .= <<<EOD
diff --git a/phpconf/inc/openvpn.inc b/phpconf/inc/openvpn.inc
deleted file mode 100644 (file)
index b39bd03..0000000
+++ /dev/null
@@ -1,862 +0,0 @@
-<?php
-/*
-       openvpn.inc
-       
-       Copyright (C) 2004 Peter Curran (peter@closeconsultants.com).
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-       
-/* include all configuration functions */
-require_once("globals.inc");
-require_once("config.inc");
-require_once("functions.inc");
-
-function ovpn_configure($reconfigure) {
-       global $config;
-       if (is_array($config['ovpn']['server']))
-               ovpn_config_server($reconfigure);
-       if (is_array($config['ovpn']['client']))
-               ovpn_config_client();
-       return;
-}
-
-function ovpn_link_tap() {
-       /* Add a reference to the tap KLM.  If ref count = 1, load it */
-       global $g;
-       
-       if (!is_file($g['vardb_path'] ."/ovpn_tap_link")){
-               $link_count = 1;
-               mwexec("/sbin/kldload if_tap");
-               $fd = fopen($g['vardb_path'] ."/ovpn_tap_link", 'w');
-       }
-       else {
-               $fd = fopen($g['vardb_path'] ."/ovpn_tap_link", 'r+');
-               $link_count = fread($fd);
-               $link_count ++;
-       }
-       fwrite($fd, $link_count);
-       fclose($fd);
-       return true;
-}
-
-function ovpn_unlink_tap() {
-       /* Remove a reference to the tap KLM.  If ref count = 0, unload it */
-       global $g;
-       
-       if (!is_file($g['vardb_path'] ."/ovpn_tap_link"))
-               return false;  //no file, no links so why are we called?
-               
-       $fd = fopen($g['vardb_path'] ."/ovpn_tap_link", 'r+');
-       $link_count = fread($fd);
-       $link_count --;
-       fwrite($fd, $link_count);
-       fclose($fd);
-               
-       if ($link_count == 0)
-               mwexec("/sbin/kldunload if_tap");
-       return true;
-}
-
-/*****************************/        
-/*  Server related functions */
-/*****************************/
-
-function getnxt_server_if($type) {
-       /* find the first available device of type $type */
-       global $config;
-       $a_server = $config['ovpn']['server']['tunnel'];
-       $max = ($type == 'tun') ? 17 : 4;
-       for ($i = 0; $i < $max ; $i++) {
-               $hit = false;
-               foreach ($a_server as $server) {
-                       if ($server['tun_iface'] == $type . $i) {
-                               $hit = true;
-                               break;
-                       }
-               }
-               if (!$hit)
-                       return $type . $i;
-       }
-       return false;
-}
-
-function getnxt_server_port() {
-       /* Get first unused port */
-       global $config;
-       $a_server = $config['ovpn']['server']['tunnel'];
-       $port = 1194;
-       while (true) {
-               $hit = false;
-               foreach ($a_server as $server) {
-                       if ($server['port'] == $port) {
-                               $hit = true;
-                               break;
-                       }
-               }
-               if (!$hit)
-                       if (!ovpn_port_inuse_client($port))
-                               return $port;
-               $port++;
-       }
-       return false; /* should never get here */
-}
-
-/* Configure the server */
-function ovpn_config_server($reconfigure) {
-       global $config, $g;
-
-       foreach ($config['ovpn']['server']['tunnel'] as $id => $server) {
-               /* get tunnel interface */
-               $tun = $server['tun_iface'];
-                       
-               /* kill any running openvpn daemon */
-               killbypid($g['varrun_path']."/ovpn_srv_{$tun}.pid");
-
-               if (isset($server['enable'])) {
-
-                       if ($g['booting'])
-                               echo "Starting OpenVPN server $id... ";
-
-                       /* send SIGUSR1 to running openvpn daemon */
-                       if ( $reconfigure == "true" && isset($server['dynip'])) {
-                               sigkillbypid($g['varrun_path']."/ovpn_srv_{$tun}.pid", "SIGUSR1");
-                               continue;
-                       }
-
-                       /* Remove old certs & keys */
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_ca_cert_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_cert_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_key_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_dh_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem");
-                       unlink_if_exists("{$g['varetc_path']}/ovpn_srv_up_{$tun}.pem");
-                       unlink_if_exists("{$g['varetc_path']}/ovpn_cli_up_{$tun}.pem");
-
-                       /* Copy the TLS-Server certs & keys to disk */
-                       $fd = fopen("{$g['vardb_path']}/ovpn_ca_cert_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($server['ca_cert'])."\n");
-                               fclose($fd);    
-                       }
-                       $fd = fopen("{$g['vardb_path']}/ovpn_srv_cert_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($server['srv_cert'])."\n");
-                               fclose($fd);    
-                       }
-                       touch ("{$g['vardb_path']}/ovpn_srv_key_{$tun}.pem");
-                       chmod ("{$g['vardb_path']}/ovpn_srv_key_{$tun}.pem", 0600);
-                       $fd = fopen("{$g['vardb_path']}/ovpn_srv_key_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($server['srv_key'])."\n");
-                               fclose($fd);    
-                       }
-                       $fd = fopen("{$g['vardb_path']}/ovpn_dh_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($server['dh_param'])."\n");
-                               fclose($fd);    
-                       }
-
-                       touch ("{$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem");
-                       chmod ("{$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem", 0600);
-                       $fd = fopen("{$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($server['pre-shared-key'])."\n");
-                               fclose($fd);    
-                       }
-
-                       /* Start the openvpn daemon */
-                       mwexec("/usr/local/sbin/openvpn " . ovpn_srv_config_generate($id));
-
-                       if ($g['booting'])
-                               /* Send the boot message */
-                               echo "done\n";
-               }
-               else {
-                       if (!$g['booting']){
-                               /* stop any processes, unload the tap module */
-                               /* Remove old certs & keys */
-                               ovpn_server_kill($tun);
-
-                               if ($server['type'] == "tap")
-                                       ovpn_unlink_tap();
-                       }
-               }
-       }
-       return 0;
-}
-
-/* Kill off a running server process */
-function ovpn_server_kill($tun) {
-       global $g;
-       
-       killbypid("{$g['varrun_path']}/ovpn_srv_{$tun}.pid");
-
-       /* Remove old certs & keys */
-       unlink_if_exists("{$g['vardb_path']}/ovpn_ca_cert_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_cert_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_key_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_dh_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem");
-
-       return 0;
-}
-
-/* Generate the config for a OpenVPN server */
-function ovpn_srv_config_generate($id) {
-       global $config, $g;
-       $server = $config['ovpn']['server']['tunnel'][$id];
-
-       /* get tunnel interface */
-       $tun = $server['tun_iface'];
-
-       /* get optional interface name */
-       $iface = ovpn_get_opt_interface($tun);
-
-       /* First the generic stuff:
-               - We are a server
-               - We are a TLS Server (for authentication)
-               - We will run without privilege
-       */
-       $ovpn_config = "--daemon --user nobody --group nobody --verb {$server['verb']} --persist-tun --persist-key --status /var/log/openvpn_{$tun}.log 60 ";
-
-       /* pid file */
-       $ovpn_config .= "--writepid {$g['varrun_path']}/ovpn_srv_{$tun}.pid ";
-       
-       /* interface */
-       $ovpn_config .= "--dev {$server['tun_iface']} ";
-       
-       /* port */
-       $ovpn_config .= "--port {$server['port']} ";
-
-       /* Set protocol being used (p = udp (default), tcp-server)
-       if ($server['proto'] == 'tcp') {
-               $ovpn_config .= "--proto tcp-server ";
-       }
-       
-       /* Interface binding - 1 or all */
-       if ($server['bind_iface'] != 'all') {
-               if ($ipaddr = ovpn_get_ip($server['bind_iface']))
-                       $ovpn_config .= "--local $ipaddr ";
-               else
-                       return "Interface bridged";
-       }
-
-       /* are we using dynamic ip addresses? */
-       if (isset($server['dynip']))
-               $ovpn_config .= "--persist-remote-ip ";
-       
-       /* Client to client routing (off by default) */
-       if (isset($server['cli2cli']))
-               $ovpn_config .= "--client-to-client ";
-       
-       /* Set maximum simultaneous clients */
-       $ovpn_config .= "--max-clients {$server['maxcli']} ";
-        
-       /* bridging enabled? */
-       if (($ifname = $config['interfaces'][$iface]['bridge']) && $server['type'] == "tap") {
-               $gateway = $config['interfaces'][$ifname]['ipaddr'];
-               $netmask = gen_subnet_mask($config['interfaces'][$ifname]['subnet']);
-               $poolstart = $server['ipblock'];
-               $poolend = gen_subnet_max($server['ipblock'], $server['prefix']);
-
-               $ovpn_config .= "--server-bridge $gateway $netmask $poolstart $poolend ";
-
-               $lastdigits = substr($tun, 3) + 2;
-               $ovpn_srv_up = "/sbin/ifconfig " . $tun . " 127.0.0." . $lastdigits . "/32\n";
-
-               $fd = fopen("{$g['varetc_path']}/ovpn_srv_up_{$tun}.sh", "w");
-               if ($fd) {
-                       fwrite($fd, $ovpn_srv_up);
-                       fclose($fd);    
-                       chmod ("{$g['varetc_path']}/ovpn_srv_up_{$tun}.sh", 0755);
-                       $ovpn_config .= "--up /var/etc/ovpn_srv_up_{$tun}.sh ";
-               }
-       } else {
-               /* New --server macro simplifies config */
-               $netmask = gen_subnet_mask($server['prefix']);
-
-               $ovpn_config .= "--server {$server['ipblock']} {$netmask} ";
-       }
-       
-       /* TLS-Server params */
-       $ovpn_config .= "--ca {$g['vardb_path']}/ovpn_ca_cert_{$tun}.pem ";
-       $ovpn_config .= "--cert {$g['vardb_path']}/ovpn_srv_cert_{$tun}.pem ";
-       $ovpn_config .= "--key {$g['vardb_path']}/ovpn_srv_key_{$tun}.pem ";
-       $ovpn_config .= "--dh {$g['vardb_path']}/ovpn_dh_{$tun}.pem ";
-       
-       /* TLS auth */
-       if (isset($server['tlsauth']))
-               $ovpn_config .= "--tls-auth {$g['vardb_path']}/ovpn_srv_psk_{$tun}.pem 0 ";
-       
-       /* Data channel encryption cipher*/
-       $ovpn_config .= "--cipher {$server['crypto']} ";
-       
-       /* Duplicate CNs */
-       if (isset($server['dupcn']))
-               $ovpn_config .= "--duplicate-cn ";
-               
-       /* Client push - redirect gateway */
-       if (isset($server['psh_options']['redir'])){
-               if (isset($server['psh_options']['redir_loc']))
-                       $ovpn_config .= "--push \"redirect-gateway local\" ";
-               else
-                       $ovpn_config .= "--push \"redirect-gateway\" ";
-       }
-                       
-       /* Client push - route delay */
-       if (isset($server['psh_options']['rte_delay']))
-               $ovpn_config .= "--push \"route-delay {$server['psh_options']['rte_delay_int']}\" ";
-               
-       /* Client push - ping (note we set both server and client) */
-       if (isset ($server['psh_options']['ping'])){
-               $conflict = true;
-               $interval = $server['psh_options']['ping_int'];
-               $ovpn_config .= "--ping {$server['psh_options']['ping_int']} ";
-               $ovpn_config .= "--push \"ping {$server['psh_options']['ping_int']}\" ";
-       }
-       
-       /* Client push - ping-restart (note server uses 2 x client interval) */
-       if (isset ($server['psh_options']['pingrst'])){
-               $conflict = true;
-               $interval = $server['psh_options']['pingrst_int'];
-               $ovpn_config .= "--ping-restart " . ($interval * 2) . " ";
-               $ovpn_config .= "--push \"ping-restart $interval\" ";
-       }
-       
-       /* Client push - ping-exit (set on client) */
-       if (isset ($server['psh_options']['pingexit'])){
-               $conflict = true;
-               $ovpn_config .= "--ping-exit {$server['psh_options']['pingexit_int']} ";
-               $ovpn_config .= "--push \"ping-exit {$server['psh_options']['pingexit_int']}\" ";
-       }
-       
-       /* Client push - inactive (set on client) */
-       if (isset ($server['psh_options']['inact'])){
-               $ovpn_config .= "--inactive {$server['psh_options']['inact_int']} ";
-               $ovpn_config .= "--push \"inactive {$server['psh_options']['inact_int']}\" ";
-       }
-       
-       if (!isset($conflict))
-               $ovpn_config .= "--keepalive 10 60 ";
-
-       //trigger_error("OVPN: $ovpn_config", E_USER_NOTICE);
-       return $ovpn_config;
-}
-
-/* Define an OVPN Server tunnel interface in the interfaces array and assign a name */
-function ovpn_server_iface(){
-       global $config, $g;
-       
-       foreach ($config['ovpn']['server']['tunnel'] as $id => $server) {
-               if (isset($server['enable'])) {
-
-                       /* get tunnel interface */
-                       $tun = $server['tun_iface'];
-                       
-                       $i = 1;
-                       while (true) {
-                               $ifname = 'opt' . $i;
-                               if (is_array($config['interfaces'][$ifname])) {
-                                       if ((isset($config['interfaces'][$ifname]['ovpn']))
-                                            && ($config['interfaces'][$ifname]['ovpn'] == "server_{$tun}"))
-                                               /* Already an interface defined - overwrite */
-                                               break;
-                               }
-                               else {
-                                       /* No existing entry, this is first unused */
-                                       $config['interfaces'][$ifname] = array();
-                                       break;
-                               }
-                               $i++;
-                       }
-                       $config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
-                       $config['interfaces'][$ifname]['if'] = $server['tun_iface'];
-                       $config['interfaces'][$ifname]['ipaddr'] = long2ip( ip2long($server['ipblock']) + 1);
-                       $config['interfaces'][$ifname]['subnet'] = $server['prefix'];
-                       $config['interfaces'][$ifname]['enable'] = isset($server['enable']) ? true : false;
-                       $config['interfaces'][$ifname]['ovpn'] = "server_{$tun}";
-
-                       write_config();
-               }
-       }
-       return "OpenVPN server interface defined";
-}
-
-/* Delete a server interface definition */
-function ovpn_server_iface_del($tun) {
-       global $config;
-
-       for ($i = 1; is_array($config['interfaces']['opt' . $i]); $i++) {
-               $ifname = 'opt' . $i;
-               if ((isset($config['interfaces'][$ifname]['ovpn']))
-                    && ($config['interfaces'][$ifname]['if'] == "$tun")) {
-                       unset($config['interfaces'][$ifname]);
-                       break;
-               }
-       }
-
-
-       /* shift down other OPTn interfaces to get rid of holes */
-       $i++;
-
-       /* look at the following OPTn ports */
-       while (is_array($config['interfaces']['opt' . $i])) {
-               $config['interfaces']['opt' . ($i - 1)] =
-                       $config['interfaces']['opt' . $i];
-
-               unset($config['interfaces']['opt' . $i]);
-               $i++;
-       }
-}
-
-
-/****************************/
-/* Client related functions */
-/****************************/
-
-function getnxt_client_if($type) {
-       /* find the first available device of type $type */
-       global $config;
-       $max = ($type == 'tun') ? 17 : 4;
-       for ($i = 0; $i < $max; $i++) {
-               $hit = false;
-               foreach ($a_client as $client) {
-                       if ($client['if'] == $type . $i) {
-                               $hit = true;
-                               break;
-                       }
-               }
-               if (!$hit)
-                       return $type . $i;
-       }
-        return false;
-}
-
-function getnxt_client_port() {
-        /* Get first unused port */
-       global $config;
-       $a_client = $config['ovpn']['client']['tunnel'];
-       $port = 1194;
-       while (true) {
-               $hit = false;
-               foreach ($a_client as $client) {
-                       if ($client['port'] == $port) {
-                               $hit = true;
-                               break;
-                       }
-               }
-               if (!$hit)
-                       if (!ovpn_port_inuse_server($port))
-                               return $port;
-               $port++;
-       }
-       return false; /* should never get here */
-}
-
-/* Port in use */
-function ovpn_port_inuse_client($port){
-       global $config;
-       $a_client = $config['ovpn']['client']['tunnel'];
-       foreach ($a_client as $client) {
-               if ($client['port'] == $port) {
-                       return true;
-               }
-       }
-       return false;
-}
-
-function ovpn_config_client() {
-       /* Boot time configuration */
-       global $config, $g;
-       
-       foreach ($config['ovpn']['client']['tunnel'] as $id => $client) {
-
-               /* get tunnel interface */
-               $tun = $client['if'];
-
-               /* kill any running openvpn daemon */
-               killbypid($g['varrun_path']."/ovpn_cli_{$tun}.pid");
-
-               if (isset($client['enable'])) {
-       
-                       if ($g['booting'])
-                               echo "Starting OpenVPN client $id... ";
-               
-                       /* Remove old certs & keys */
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_ca_cert_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_cert_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_key_{$tun}.pem");
-                       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem");
-                       unlink_if_exists("{$g['varetc_path']}/ovpn_cli_up_{$tun}.pem");
-               
-                       /* Copy the TLS-Client certs & keys to disk */
-                       $fd = fopen("{$g['vardb_path']}/ovpn_cli_ca_cert_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($client['ca_cert'])."\n");
-                               fclose($fd);    
-                       }
-                       else
-                               trigger_error("OVPN: No open for CA", E_USER_NOTICE);
-                       $fd = fopen("{$g['vardb_path']}/ovpn_cli_cert_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($client['cli_cert'])."\n");
-                               fclose($fd);    
-                       }
-                       touch ("{$g['vardb_path']}/ovpn_cli_key_{$tun}.pem");
-                       chmod ("{$g['vardb_path']}/ovpn_cli_key_{$tun}.pem", 0600);
-                       $fd = fopen("{$g['vardb_path']}/ovpn_cli_key_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($client['cli_key'])."\n");
-                               fclose($fd);    
-                       }
-                       touch ("{$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem");
-                       chmod ("{$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem", 0600);
-                       $fd = fopen("{$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem", "w");
-                       if ($fd) {
-                               fwrite($fd, base64_decode($client['pre-shared-key'])."\n");
-                               fclose($fd);    
-                       }
-                               
-                       /* Start openvpn for this client */
-                       mwexec("/usr/local/sbin/openvpn " . ovpn_cli_config_generate($id));
-               
-                       if ($g['booting'])
-                               /* Send the boot message */
-                               echo "done\n";
-               }
-               else {
-                       if (!$g['booting']){
-                               /* stop any processes, unload the tap module */
-                               /* Remove old certs & keys */
-                               ovpn_client_kill($tun);
-
-                               if ($client['type'] == "tap")
-                                       ovpn_unlink_tap();
-                       }
-               }
-       }
-       return 0;
-       
-}
-
-/* Kill off a running client process */
-function ovpn_client_kill($tun) {
-       global $g;
-       
-       killbypid("{$g['varrun_path']}/ovpn_cli_{$tun}.pid");
-       
-       /* Remove old certs & keys */
-       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_ca_cert_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_cert_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_key_{$tun}.pem");
-       unlink_if_exists("{$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem");
-
-       return 0;
-}
-
-/* Generate the config for a OpenVPN client */
-function ovpn_cli_config_generate($id) {
-       /* configure the named client */
-       global $config, $g;
-       $client = $config['ovpn']['client']['tunnel'][$id];
-
-       /* get tunnel interface */
-       $tun = $client['if'];
-       
-       /* get optional interface name */
-       $iface = ovpn_get_opt_interface($tun);
-
-       /* Client support in 2.0 is very simple */
-       $ovpn_config = "--client --daemon --verb 1 --status /var/log/openvpn_{$tun}.log 60 ";
-       
-       /* pid file */
-       $ovpn_config .= "--writepid {$g['varrun_path']}/ovpn_cli_{$tun}.pid ";
-       
-       /* interface */
-       $ovpn_config .= "--dev {$client['if']} ";
-       
-       /* protocol */
-       /* Set protocol being used (p = udp (default), tcp-client)
-       if ($client['proto'] == 'tcp') {
-               $ovpn_config .= "--proto tcp-client ";
-       }
-       
-       /* port */
-       $ovpn_config .= "--lport {$client['port']} ";
-       
-       /* server location */
-       $ovpn_config .= "--remote {$client['saddr']} {$client['sport']} ";
-       
-       /* bridging enabled? */
-       if (($ifname = $config['interfaces'][$iface]['bridge']) && $client['type'] == "tap") {
-               $lastdigits = substr($tun, 3) + 2;
-               $ovpn_srv_up = "/sbin/ifconfig " . $tun . " 127.0.0." . $lastdigits . "/32\n";
-
-               $fd = fopen("{$g['varetc_path']}/ovpn_cli_up_{$tun}.sh", "w");
-               if ($fd) {
-                       fwrite($fd, $ovpn_cli_up);
-                       fclose($fd);    
-                       chmod ("{$g['varetc_path']}/ovpn_cli_up_{$tun}.sh", 0755);
-                       $ovpn_config .= "--up /var/etc/ovpn_cli_up_{$tun}.sh ";
-               }
-       }
-
-       /* TLS-Client params */
-       $ovpn_config .= "--ca {$g['vardb_path']}/ovpn_cli_ca_cert_{$tun}.pem ";
-       $ovpn_config .= "--cert {$g['vardb_path']}/ovpn_cli_cert_{$tun}.pem ";
-       $ovpn_config .= "--key {$g['vardb_path']}/ovpn_cli_key_{$tun}.pem ";
-
-       /* TLS auth */
-       if (isset($client['tlsauth']))
-               $ovpn_config .= "--tls-auth {$g['vardb_path']}/ovpn_cli_psk_{$tun}.pem 1 ";
-
-       /* Data channel encryption cipher*/
-       $ovpn_config .= "--cipher {$client['crypto']} ";
-       
-       //trigger_error("OVPN: $ovpn_config", E_USER_NOTICE);
-       return $ovpn_config;
-}
-
-/* Define an OVPN tunnel interface in the interfaces array for each client */
-function ovpn_client_iface(){
-       global $config;
-               
-       foreach ($config['ovpn']['client']['tunnel'] as $id => $client) {
-               if (isset($client['enable'])) {
-
-                       /* get tunnel interface */
-                       $tun = $client['if'];
-
-                       $i = 1;
-                       while (true) {
-                               $ifname = 'opt' . $i;
-                               if (is_array($config['interfaces'][$ifname])) {
-                                       if ((isset($config['interfaces'][$ifname]['ovpn']))
-                                            && ($config['interfaces'][$ifname]['ovpn'] == "client_{$tun}"))
-                                               /* Already an interface defined - overwrite */
-                                               break;
-                               }
-                               else {
-                                       /* No existing entry, this is first unused */
-                                       $config['interfaces'][$ifname] = array();
-                                       break;
-                               }
-                               $i++;
-                       }
-                       $config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
-                       $config['interfaces'][$ifname]['if'] = $client['if'];
-                       $config['interfaces'][$ifname]['ipaddr'] = "0.0.0.0";
-                       $config['interfaces'][$ifname]['subnet'] = "0";
-                       $config['interfaces'][$ifname]['enable'] = isset($client['enable']) ? true : false;
-                       $config['interfaces'][$ifname]['ovpn'] = "client_{$tun}";
-                       write_config();
-               }
-       }
-       return "OpenVPN client interfaces defined";
-}
-
-/* Delete a client interface definition */
-function ovpn_client_iface_del($tun) {
-       global $config;
-
-       for ($i = 1; is_array($config['interfaces']['opt' . $i]); $i++) {
-               $ifname = 'opt' . $i;
-               if ((isset($config['interfaces'][$ifname]['ovpn']))
-                    && ($config['interfaces'][$ifname]['if'] == "$tun")) {
-                       unset($config['interfaces'][$ifname]);
-                       break;
-               }
-       }
-
-
-       /* shift down other OPTn interfaces to get rid of holes */
-       $i++;
-
-       /* look at the following OPTn ports */
-       while (is_array($config['interfaces']['opt' . $i])) {
-               $config['interfaces']['opt' . ($i - 1)] =
-                       $config['interfaces']['opt' . $i];
-
-               unset($config['interfaces']['opt' . $i]);
-               $i++;
-       }
-}
-
-
-/******************/
-/* Misc functions */
-
-/* Calculate the last address in a range given the start and /prefix */
-function ovpn_calc_end($start, $prefix){
-
-       $first = ip2long($start);
-       $last = pow(2,(32 - $prefix)) - 1 + $first;
-       return long2ip($last);
-}
-
-/* Calculate a mask given a /prefix */
-function ovpn_calc_mask($prefix){
-
-       return long2ip(ip2long("255.255.255.255") - (pow( 2, (32 - $prefix)) - 1));
-}
-
-/* Port in use */
-function ovpn_port_inuse_server($port){
-       global $config;
-       $a_server = $config['ovpn']['server']['tunnel'];
-       foreach ($a_server as $server) {
-               if ($server['port'] == $port) {
-                       return true;
-               }
-       }
-       return false;
-}
-
-/* Read in a file from the $_FILES array */
-function ovpn_get_file($file){
-       global $g;
-       
-       if (!is_uploaded_file($_FILES[$file]['tmp_name'])){
-               trigger_error("Bad file upload".$_FILES[$file]['error'], E_USER_NOTICE);
-               return NULL;
-       }
-       $contents = file_get_contents($_FILES[$file]['tmp_name']);
-       return $contents;
-}
-
-
-/* Get the IP address of a specified interface */
-function ovpn_get_ip($iface){
-       global $config;
-       
-       if ($iface == 'wan')
-               return get_current_wan_address();
-               
-       if ($config['interfaces'][$iface]['bridge'])
-               /* No bridging (yet) */
-               return false;
-       return $config['interfaces'][$iface]['ipaddr'];
-}
-       
-       
-/* Get a list of the cipher options supported by OpenVPN */
-function ovpn_get_cipher_list(){
-       
-/*     exec("/usr/local/sbin/openvpn --show-ciphers", $raw);
-       print_r ($raw);
-       
-       $ciphers = preg_grep('/ bit default key /', $raw);
-       
-       for($i = 0; $i <count($ciphers); $i++){
-               $tmp = explode(' ',$ciphers[$i]);
-               $cipher_list["$tmp[0]"] = "{$tmp[0]} ({$tmp[1]} {$tmp[2]})";
-       }
-*/
-       $cipher_list = array('DES-CBC' => 'DES-CBC (64 bit)',
-                            'RC2-CBC' => 'RC2-CBC (128 bit)',
-                            'DES-EDE-CBC' => 'DES-EDE-CBC (128 bit)',
-                            'DES-EDE3-CBC' => 'DES-EDE3-CBC (192 bit)',
-                            'DESX-CBC' => 'DESX-CBC (192 bit)',
-                            'BF-CBC' => 'BF-CBC (128 bit)',
-                            'RC2-40-CBC' => 'RC2-40-CBC (40 bit)',
-                            'CAST5-CBC' => 'CAST5-CBC (128 bit)',
-                            'RC5-CBC' => 'RC5-CBC (128 bit)',
-                            'RC2-64-CBC' => 'RC2-64-CBC (64 bit)',
-                            'AES-128-CBC' => 'AES-128-CBC (128 bit)',
-                            'AES-192-CBC' => 'AES-192-CBC (192 bit)',
-                            'AES-256-CBC' => 'AES-256-CBC (256 bit)');
-       return $cipher_list;
-}
-               
-       
-/* Get optional interface */
-/* needs tunneling interface (tun0, tun1, tap0, ...) */
-/* returns optional interface name (opt2, opt3, ...) */
-function ovpn_get_opt_interface($tun){
-       global $config;
-
-       for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
-               $ifname = 'opt' . $i;
-
-               if (isset($config['interfaces']['opt' . $i]['ovpn']))
-                       if ($config['interfaces'][$ifname]['if'] == "$tun")
-                                return $ifname;
-       }
-       /* not found? */
-       return false;
-}
-
-/* Build a list of the current real interfaces */
-function ovpn_real_interface_list(){
-       global $config;
-       
-       $interfaces = array('all' => 'ALL',
-                           'lan' => 'LAN',
-                           'wan' => 'WAN');
-       for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
-               if (isset($config['interfaces']['opt' . $i]['ovpn']))
-                       /* Hide our own interface */
-                       break;
-               if (isset($config['interfaces']['opt' . $i]['enable']))
-                       $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
-       }
-       return $interfaces;
-}
-
-       
-/* lock openvpn information, decide that the lock file is stale after
-   10 seconds */
-function ovpn_lock() {
-       
-       global $g;
-       
-       $lockfile = "{$g['varrun_path']}/ovpn.lock";
-       
-       $n = 0;
-       while ($n < 10) {
-               /* open the lock file in append mode to avoid race condition */
-               if ($fd = fopen($lockfile, "x")) {
-                       /* succeeded */
-                       fclose($fd);
-                       return;
-               } else {
-                       /* file locked, wait and try again */
-                       sleep(1);
-                       $n++;
-               }
-       }
-}
-
-/* unlock configuration file */
-function ovpn_unlock() {
-       
-       global $g;
-       
-       $lockfile = "{$g['varrun_path']}/ovpn.lock";
-       
-       if (file_exists($lockfile))
-               unlink($lockfile);
-}
-
-?>
index 5434c77dec61e428049c3018c16c80a457205256..d27fe6a9cdd6a01588e483cd99e4d488a9606781 100644 (file)
@@ -375,7 +375,7 @@ function services_dnsmasq_configure() {
                
                if (isset($config['dnsmasq']['domainoverrides']) && is_array($config['dnsmasq']['domainoverrides'])) {
                        foreach($config['dnsmasq']['domainoverrides'] as $override) {
-                               $args .= escapeshellarg(' --server=/' . $override['domain'] . '/' . $override['ip']);
+                               $args .= " " . escapeshellarg('--server=/' . $override['domain'] . '/' . $override['ip']);
                        }
                }
 
index 32e3e447ad56ea75c9b2dc9707ecd93dfb4dac06..4c397b122a70e40b7bd000921a8b0d299f9de2c3 100644 (file)
@@ -554,7 +554,7 @@ function system_set_harddisk_standby() {
                if (is_numeric($standby)) {
                        // Sync the disk(s)
                        mwexec('/bin/sync');
-                       if (!mwexec('/sbin/sysctl hw.ata.suspend=' . ((int)$standby))) {
+                       if (!mwexec('/sbin/sysctl hw.ata.suspend=' . ((int)$standby*60))) {
                                // Reinitialize ATA-drives
                                mwexec('/usr/local/sbin/atareinit');
                                if ($g['booting']) {
index 50dcfafbf3d0fe57eb97a7d9ffc781be231f6b8c..f3ef1d9b2b03f7b05074f1301d09a3f325f75907 100644 (file)
@@ -87,9 +87,6 @@
        
        /* set up Optional interfaces */
        interfaces_optional_configure();
-               
-       /* start OpenVPN server & clients */
-       ovpn_configure(false);
        
        /* resync ipfilter */
        filter_resync();
index 93eab34a3fa23e97f7a0fcd1184bfd1f13e334be..6868cfdc171cdb4928664d0be758eee26ba607e7 100644 (file)
@@ -62,9 +62,6 @@
        
        /* reconfigure IPsec tunnels */
        vpn_ipsec_configure(true);
-       
-       /* reconfigure OpenVPN tunnels */
-       ovpn_configure(true);
        
        /* regenerate resolv.conf if DNS overrides are allowed or the BigPond
           client is enabled */
index 57271f4870607be5e7cc3e5d450f294ee73bf805..8d55eb6e1dce13bcdbb0688ed97074348c61fdc6 100644 (file)
 $pgtitle = array("Diagnostics", "ARP table");
 require("guiconfig.inc");
 
+$id = $_GET['id'];
+if (isset($_POST['id']))
+        $id = $_POST['id'];
+
+if ($_GET['act'] == "del") {
+       if (isset($id)) {
+               /* remove arp entry from arp table */
+               mwexec("/usr/sbin/arp -d " . escapeshellarg($id));
+
+               /* redirect to avoid reposting form data on refresh */
+               header("Location: diag_arp.php");
+               exit;
+       } else {
+               /* remove all entries from arp table */
+               mwexec("/usr/sbin/arp -d -a");
+
+               /* redirect to avoid reposting form data on refresh */
+               header("Location: diag_arp.php");
+               exit;
+       }
+}
+
+$resolve = isset($config['syslog']['resolve']);
 ?>
+
 <?php include("fbegin.inc"); ?>
 
 <?php
@@ -166,14 +190,16 @@ foreach ($rawdata as $line) {
 
 function getHostName($mac,$ip)
 {
-       global $dhcpmac, $dhcpip;
+       global $dhcpmac, $dhcpip, $resolve;
        
        if ($dhcpmac[$mac])
                return $dhcpmac[$mac];
        else if ($dhcpip[$ip])
                return $dhcpip[$ip];
-       else 
-               return "&nbsp;";        
+       else if ($resolve) 
+               return gethostbyaddr($ip);
+       else
+               return "&nbsp;";
 }
 
 ?>
@@ -186,14 +212,31 @@ function getHostName($mac,$ip)
     <td class="listhdr">Interface</td>
     <td class="list"></td>
   </tr>
-<?php foreach ($data as $entry): ?>
+<?php $i = 0; foreach ($data as $entry): ?>
   <tr>
     <td class="listlr"><?=$entry['ip'];?></td>
     <td class="listr"><?=$entry['mac'];?></td>
     <td class="listr"><?=getHostName($entry['mac'], $entry['ip']);?></td>
     <td class="listr"><?=$hwif[$entry['interface']];?></td>
+    <td valign="middle" nowrap class="list"><a href="diag_arp.php?act=del&id=<?=$entry['ip'];?>"><img src="x.gif" title="delete arp entry" width="17" height="17" border="0"></a></td>
+  </tr>
+<?php $i++; endforeach; ?>
+  <tr> 
+    <td></td>
+  </tr> 
+  <tr> 
+    <td class="list" colspan="4"></td>
+    <td class="list"><a href="diag_arp.php?act=del"><img src="x.gif" title="remove all entries from arp table" width="17" height="17" border="0"></a></td>
+  </tr>
+  <tr>
+    <td colspan="4">
+      <span class="vexpl"><span class="red"><strong>Hint:<br>
+      </strong></span>IP addresses are resolved to hostnames if
+      &quot;Resolve IP addresses to hostnames&quot; 
+      is checked on the <a href="diag_logs_settings.php">
+      Diagnostics: Logs</a> page.</span>
+    </td>
   </tr>
-<?php endforeach; ?>
 </table>
 
 <?php include("fend.inc"); ?>
index 89ef3b448653e56156a1e2ffc1ce16cf4f390b6f..f4e6c0a3c3af655d8853bfbaecea7ade4a6a2fc2 100644 (file)
@@ -29,7 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
-$pgtitle = array("Diagnostics", "Ping");
+$pgtitle = array("Diagnostics", "Ping/Traceroute");
 require("guiconfig.inc");
 
 define('MAX_COUNT', 10);
@@ -85,6 +85,15 @@ function get_interface_addr($ifdescr) {
 }
 ?>
 <?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+  <tr><td class="tabnavtbl">
+  <ul id="tabnav">
+       <li class="tabact">Ping</li>
+       <li class="tabinact"><a href="diag_traceroute.php">Traceroute</a></li>
+  </ul>
+  </td></tr>
+  <tr> 
+    <td class="tabcont">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
                        <form action="diag_ping.php" method="post" name="iform" id="iform">
                          <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -144,4 +153,5 @@ function get_interface_addr($ifdescr) {
                                </tr>
                        </table>
 </form>
+</td></tr></table>
 <?php include("fend.inc"); ?>
index 8c36e23d2f24228470c09c5f1f5315390aa74260..69a534dbdbd95f7127a9b1fa438416ecbe602706 100644 (file)
@@ -29,7 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
-$pgtitle = array("Diagnostics", "Traceroute");
+$pgtitle = array("Diagnostics", "Ping/Traceroute");
 require("guiconfig.inc");
 
 
@@ -53,16 +53,26 @@ if ($_POST) {
                $do_traceroute = true;
                $host = $_POST['host'];
                $ttl = $_POST['ttl'];
-
+               $resolve = $_POST['resolve'];
        }
 }
 if (!isset($do_traceroute)) {
        $do_traceroute = false;
        $host = '';
        $ttl = DEFAULT_TTL;
+       $resolve = false;
 }
 ?>
 <?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+  <tr><td class="tabnavtbl">
+  <ul id="tabnav">
+       <li class="tabinact"><a href="diag_ping.php">Ping</a></li>
+       <li class="tabact">Traceroute</li>
+  </ul>
+  </td></tr>
+  <tr> 
+    <td class="tabcont">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
                        <form action="diag_traceroute.php" method="post" name="iform" id="iform">
                          <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -80,6 +90,12 @@ if (!isset($do_traceroute)) {
                                        <?php endfor; ?>
                                        </select></td>
                                </tr>
+                                 <tr> 
+                                       <td valign="top" class="vtable">&nbsp;</td>
+                                       <td class="vtable"> <input name="resolve" type="checkbox" id="resolve" value="yes" <?php if ($resolve) echo "checked"; ?>>
+                                         <strong>Resolve IP addresses to hostnames</strong><br>
+                                       </td>
+                                 </tr>
                                <tr>
                                  <td width="22%" valign="top">&nbsp;</td>
                                  <td width="78%"> 
@@ -93,7 +109,7 @@ if (!isset($do_traceroute)) {
                                        echo("<br><strong>Traceroute output:</strong><br>");
                                        echo('<pre>');
                                        ob_end_flush();
-                                       system("/usr/sbin/traceroute -w 2 -m " . escapeshellarg($ttl) . " " . escapeshellarg($host));
+                                       system("/usr/sbin/traceroute " . ($resolve ? "" : "-n ") . "-w 2 -m " . escapeshellarg($ttl) . " " . escapeshellarg($host));
                                        echo('</pre>');
                                }
                                ?>
@@ -101,4 +117,5 @@ if (!isset($do_traceroute)) {
                                </tr>
                        </table>
 </form>
+</td></tr></table>
 <?php include("fend.inc"); ?>
index ff8d3c87565bb933343d5a0911e489918b24dde8..d885f291661300039b72e668132d7630bb96d311 100644 (file)
@@ -104,13 +104,9 @@ function showhide(tspan, tri) {
               <strong>VPN</strong><br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/vpn_ipsec.php" class="navlnk">IPsec</a><br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/vpn_pptp.php" class="navlnk">PPTP</a><br>
-              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/vpn_openvpn_srv.php" class="navlnk">OpenVPN</a><br>
               <strong>Status</strong><br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/index.php" class="navlnk">System</a><br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/status_interfaces.php" class="navlnk">Interfaces</a><br>
-                         <?php if (is_array($config['ovpn']['server']['tunnel'])): ?>
-              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/status_ovpn.php" class="navlnk">OpenVPN</a><br>
-                 <?php endif; ?>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/status_graph.php" class="navlnk">Traffic graph</a><br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/status_wireless.php" class="navlnk">Wireless</a><br>
                          <?php if (isset($config['captiveportal']['enable'])): ?>
@@ -143,8 +139,7 @@ endif;
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_logs.php" class="navlnk">Logs</a><br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_dhcp_leases.php" class="navlnk">DHCP leases</a><br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_ipsec_sad.php" class="navlnk">IPsec</a><br>
-                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_ping.php" class="navlnk">Ping</a><br>
-                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_traceroute.php" class="navlnk">Traceroute</a><br>
+                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_ping.php" class="navlnk">Ping/Traceroute</a><br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_arp.php" class="navlnk">ARP table</a><br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_ipfstat.php" class="navlnk">Firewall states</a><br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/diag_resetstate.php" class="navlnk">Reset state</a><br>
index c1fe4e5e04f627438078c4a352c0bb9dc6bbeb16..e4a5da552ddc09f0fc295b097cc5a222c154511b 100644 (file)
@@ -106,7 +106,10 @@ if ($_GET['act'] == "del") {
                       rules will be automatically generated anymore. Instead, only the mappings
                       you specify below will be used. With advanced outbound NAT disabled,
                       a mapping is automatically created for each interface's subnet
-                      (except WAN).</span> If you use target addresses other than the WAN interface's IP address, then depending on<span class="vexpl"> the way your WAN connection is setup, you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span><br>
+                      (except WAN) and any mappings specified below will be ignored.</span>
+                      If you use target addresses other than the WAN interface's IP address,
+                      then depending on<span class="vexpl"> the way your WAN connection is setup,
+                      you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span><br>
                       <br>
                       You may enter your own mappings below.</p>
                     </td>
index 9686a01a8fe5bea7db6d0b73aad5bb1d7a8f5fea..31739863446917ab3c6a1272a3f5a2661ad6ccfe 100644 (file)
@@ -161,10 +161,15 @@ function fr_bgcolor(id) {
 }
 function fr_insline(id, on) {
        var row = document.getElementById('fr' + id);
+       var prevrow;
        if (id != 0) {
-               var prevrow = document.getElementById('fr' + (id-1));
+               prevrow = document.getElementById('fr' + (id-1));
        } else {
-               var prevrow = document.getElementById('frheader');
+               if (<?php if (($if == "wan") && isset($config['interfaces']['wan']['blockpriv'])) echo "true"; else echo "false"; ?>) {
+                       prevrow = document.getElementById('frrfc1918');
+               } else {
+                       prevrow = document.getElementById('frheader');
+               }
        }
        
        var cells = row.getElementsByTagName("td");
@@ -224,6 +229,30 @@ function fr_insline(id, on) {
                   <td width="22%" class="listhdr">Description</td>
                   <td width="10%" class="list"></td>
                                </tr>
+<?php if (($if == "wan") && isset($config['interfaces']['wan']['blockpriv'])): ?>
+                <tr valign="top" id="frrfc1918">
+                  <td class="listt"></td>
+                  <td class="listt" align="center"><img src="block.gif" width="11" height="11" border="0"></td>
+                  <td class="listlr" style="background-color: #e0e0e0">*</td>
+                  <td class="listr" style="background-color: #e0e0e0">RFC 1918 networks</td>
+                  <td class="listr" style="background-color: #e0e0e0">*</td>
+                  <td class="listr" style="background-color: #e0e0e0">*</td>
+                  <td class="listr" style="background-color: #e0e0e0">*</td>
+                  <td class="listbg" style="background-color: #e0e0e0">Block private networks</td>
+                  <td valign="middle" nowrap class="list">
+                                   <table border="0" cellspacing="0" cellpadding="1">
+                                       <tr>
+                                         <td><img src="left_d.gif" width="17" height="17" title="move selected rules before this rule"></td>
+                                         <td><a href="interfaces_wan.php#rfc1918"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
+                                       </tr>
+                                       <tr>
+                                         <td align="center" valign="middle"></td>
+                                         <td><img src="plus_d.gif" title="add a new rule based on this one" width="17" height="17" border="0"></td>
+                                       </tr>
+                                       </table>
+                                 </td>
+                               </tr>
+<?php endif; ?>
                                <?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
                                        $filterent = $a_filter[$i];
                                        if ($filterent['interface'] != $if)
index a1796eed3b3bd5f2813ea3021654f3e15362c777..24e61bd17efc81e98b8f42b443fdd412604a96de 100644 (file)
@@ -56,8 +56,6 @@ $d_firmwarelock_path = $g['varrun_path'] . "/firmware.lock";
 $d_sysrebootreqd_path = $g['varrun_path'] . "/sysreboot.reqd";
 $d_passthrumacsdirty_path = $g['varrun_path'] . "/passthrumacs.dirty";
 $d_allowedipsdirty_path = $g['varrun_path'] . "/allowedips.dirty";
-$d_ovpnclidirty_path = $g['varrun_path'] . "/ovpnclient.dirty";
-$d_ovpnsrvdirty_path = $g['varrun_path'] . "/ovpnserver.dirty";
 
 if (file_exists($d_firmwarelock_path)) {
        if (!$d_isfwfile) {
index 53f1c2614e607fdcb4ae34c470e880042fbd394f..578f4277aedcde58438e92dfc42de99cfd30fc91 100644 (file)
@@ -197,10 +197,6 @@ if ($_GET['act'] == "add") {
        <td class="list">&nbsp;</td>
   </tr>
   <?php foreach ($config['interfaces'] as $ifname => $iface):
-       /* we don't want to see the OpenVPN tun interfaces */
-       if (isset($iface['ovpn']))
-               continue;
-
        if ($iface['descr'])
                $ifdescr = $iface['descr'];
        else
index 8f3322827c0e79fd3c6d244e4c93cbcb27216fc7..58c6aa73cc1663c225c1fe2f6593aa86adbff945 100644 (file)
@@ -47,8 +47,6 @@ $pconfig['ipaddr'] = $optcfg['ipaddr'];
 $pconfig['subnet'] = $optcfg['subnet'];
 $pconfig['enable'] = isset($optcfg['enable']);
 
-$pgtitle = array("Interfaces", "Optional $index (" . htmlspecialchars($optcfg['descr']) . ")");
-
 /* Wireless interface? */
 if (isset($optcfg['wireless'])) {
        require("interfaces_wlan.inc");
@@ -124,7 +122,7 @@ if ($_POST) {
                $optcfg['subnet'] = $_POST['subnet'];
                $optcfg['bridge'] = $_POST['bridge'];
                $optcfg['enable'] = $_POST['enable'] ? true : false;
-                       
+
                write_config();
                
                $retval = 0;
@@ -142,13 +140,42 @@ if ($_POST) {
                $savemsg = get_std_save_message($retval);
        }
 }
+
+$pgtitle = array("Interfaces", "Optional $index (" . htmlspecialchars($optcfg['descr']) . ")");
 ?>
+
 <?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
        var endis;
-       endis = !((document.iform.bridge.selectedIndex == 0) || enable_over);
+       endis = !(document.iform.enable.checked || enable_over);
+       document.iform.descr.disabled = endis;
+       document.iform.ipaddr.disabled = endis;
+       document.iform.subnet.disabled = endis;
+       document.iform.bridge.disabled = endis;
+
+       if (document.iform.mode) {
+                document.iform.mode.disabled = endis;
+                document.iform.ssid.disabled = endis;
+                document.iform.channel.disabled = endis;
+                document.iform.stationname.disabled = endis;
+                document.iform.wep_enable.disabled = endis;
+                document.iform.key1.disabled = endis;
+                document.iform.key2.disabled = endis;
+                document.iform.key3.disabled = endis;
+                document.iform.key4.disabled = endis;
+       }
+}
+function bridge_change(enable_over) {
+       var endis;
+
+       if (document.iform.enable.checked || enable_over) {
+               endis = !((document.iform.bridge.selectedIndex == 0) || enable_over);
+       } else {
+               endis = true;
+       }
+
        document.iform.ipaddr.disabled = endis;
        document.iform.subnet.disabled = endis;
 }
@@ -183,7 +210,7 @@ function ipaddr_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vtable">&nbsp;</td>
                   <td width="78%" class="vtable">
-<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
+<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false);bridge_change(false)">
                     <strong>Enable Optional <?=$index;?> interface</strong></td>
                                </tr>
                 <tr> 
@@ -202,7 +229,7 @@ function ipaddr_change() {
                                <tr> 
                   <td width="22%" valign="top" class="vncellreq">Bridge with</td>
                   <td width="78%" class="vtable">
-                                       <select name="bridge" class="formfld" id="bridge" onChange="enable_change(false)">
+                                       <select name="bridge" class="formfld" id="bridge" onChange="bridge_change(false)">
                                        <option <?php if (!$pconfig['bridge']) echo "selected";?> value="">none</option>
                       <?php $opts = array('lan' => "LAN", 'wan' => "WAN");
                                                for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
@@ -237,7 +264,7 @@ function ipaddr_change() {
                   <td width="22%" valign="top">&nbsp;</td>
                   <td width="78%"> 
                     <input name="index" type="hidden" value="<?=$index;?>"> 
-                                 <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> 
+                                 <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true);bridge_change(true)"> 
                   </td>
                 </tr>
                 <tr> 
@@ -255,6 +282,7 @@ function ipaddr_change() {
 <script language="JavaScript">
 <!--
 enable_change(false);
+bridge_change(false);
 //-->
 </script>
 <?php else: ?>
index b89b0d617e0435abc35ca7888799f9d7399df74b..bf9d389188ab9c74c2dad432c58fab9fb6ed86c3 100644 (file)
@@ -614,15 +614,15 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td valign="middle">&nbsp;</td>
-                  <td class="vtable"> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>> 
+                  <td class="vtable">
+                <a name="rfc1918"></a><input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>> 
                     <strong>Block private networks</strong><br>
-                    When set, this option blocks traffic from IP addresses that 
-                    are reserved for private<br>
-                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as 
-                    well as loopback addresses<br>
-                    (127/8). You should generally leave this option turned on, 
-                    unless your WAN network<br>
-                    lies in such a private address space, too.</td>
+                                       When set, this option blocks traffic from IP addresses
+                                       that are reserved for private networks as per RFC 1918
+                                       (10/8, 172.16/12, 192.168/16) as well as loopback addresses
+                                       (127/8). You should generally leave this option turned on, 
+                                       unless your WAN network lies in such a private address space,
+                                       too.</td>
                 </tr>
                 <tr> 
                   <td width="100" valign="top">&nbsp;</td>
index 812201e7977829183800433b692ea0f21a1090d1..6138d5bcbf47b530a1356638cf081ed5a0aa5453 100644 (file)
@@ -80,7 +80,7 @@ require("guiconfig.inc");
               <br>
               Peter Allgeyer (<a href="mailto:allgeyer@web.de">allgeyer@web.de</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">&quot;reject&quot; type filter rules; dial-on-demand; WAN connect/disconnect; auto-add proxy ARP </font></em><br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">firewall log filtering; DynDNS server/port; OpenVPN improvements</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">firewall log filtering; DynDNS server/port; Diag: ARP improvements</font></em><br>
               <br>
               Thierry Lechat (<a href="mailto:dev@lechat.org">dev@lechat.org</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">SVG-based traffic grapher</font></em><br>
@@ -110,9 +110,6 @@ require("guiconfig.inc");
               Audun Larsen (<a href="mailto:larsen@xqus.com">larsen@xqus.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">CPU/memory usage display</font></em><br>
                          <br>
-              Peter Curran (<a href="mailto:peter@closeconsultants.com">peter@closeconsultants.com</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">OpenVPN support</font></em><br>
-                         <br>
               Pavel A. Grodek (<a href="mailto:pg@abletools.com">pg@abletools.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Traffic shaper packet loss rate/queue size</font></em><br>
                          <br>
@@ -134,8 +131,11 @@ require("guiconfig.inc");
               Joe Suhre (<a href="mailto:jsuhre@nullconcepts.com">jsuhre@nullconcepts.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">DNS forwarder domain overriding</font></em><br>
                          <br>
-              Paul Taylor (<a href="mailto:paultaylor@winndixie.com">paultaylor@winndixie.com</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">ARP table, Traceroute and Filter state pages</font></em></p>
+              Paul Taylor (<a href="mailto:paultaylor@winn-dixie.com">paultaylor@winn-dixie.com</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">ARP table, Traceroute and Filter state pages</font></em><br>
+                         <br>
+              Jonathan De Graeve (<a href="mailto:Jonathan.De.Graeve@imelda.be">Jonathan.De.Graeve@imelda.be</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">captive portal RADIUS accounting gigawords</font></em></p>
             <hr size="1">
             <p>m0n0wall is based upon/includes various free software packages, 
               listed below.<br>
diff --git a/webgui/plus_d.gif b/webgui/plus_d.gif
new file mode 100644 (file)
index 0000000..9edce44
Binary files /dev/null and b/webgui/plus_d.gif differ
index d2b182e3bf023d18bd904f6a82135fac000206a0..4f1b60d025bd15ec2a6c130b8fa19c7b0f6a147f 100644 (file)
@@ -41,7 +41,7 @@ $iflist = array("lan" => "LAN");
 for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        $oc = $config['interfaces']['opt' . $i];
        
-       if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge']) && (!$oc['ovpn'])) {
+       if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) {
                $iflist['opt' . $i] = $oc['descr'];
        }
 }
index 22807d270559b0e5778fc373efb4d5af1a2f0b47..337c0edfba49030734dcab7dc24178b0a9d0cbbd 100644 (file)
@@ -62,7 +62,7 @@ $iflist = array("lan" => "LAN");
 for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        $oc = $config['interfaces']['opt' . $i];
        
-       if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge']) && (!$oc['ovpn'])) {
+       if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) {
                $iflist['opt' . $i] = $oc['descr'];
        }
 }
index 033e2e1918ee23d9e9b34ac39a85b9a3ca7a1853..d5a08835c0270f635a12204bcc611dada5fcb025 100644 (file)
@@ -168,7 +168,6 @@ function typesel_change() {
                                        <select name="interface" class="formfld">
                       <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
-                                               if (!isset($config['interfaces']['opt' . $i]['ovpn']))
                                                        $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
                                          }
                                          foreach ($interfaces as $iface => $ifacename): ?>
index ce0d735adf917db8311b9b51f1c3ba67d1ac8481..abcb16ac708d9bb05258a25cc252dc57556efbc9 100644 (file)
@@ -88,8 +88,7 @@ if ($_GET['act'] == "del") {
                       <?php $interfaces = array('lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                            if (isset($config['interfaces']['opt' . $i]['enable']) &&
-                                                       !$config['interfaces']['opt' . $i]['bridge'] &&
-                                                       !$config['interfaces']['opt' . $i]['ovpn'])
+                                                       !$config['interfaces']['opt' . $i]['bridge'])
                                                        $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
                                          }
                                          foreach ($interfaces as $iface => $ifacename): ?>
index 99e17f05cceba034da5bc7dba99f55eb341da2a0..3e25b04be7c6854daf39099ba3a6041602d8ce0b 100644 (file)
@@ -94,8 +94,7 @@ if ($_POST) {
                       <?php $interfaces = array('lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                            if (isset($config['interfaces']['opt' . $i]['enable']) &&
-                                                       !$config['interfaces']['opt' . $i]['bridge'] &&
-                                                       !$config['interfaces']['opt' . $i]['ovpn'])
+                                                       !$config['interfaces']['opt' . $i]['bridge'])
                                                        $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
                                          }
                                          foreach ($interfaces as $iface => $ifacename): ?>
index d160acc11fb76240fc5d35e2b5847b9bbe8422b0..9ad8f98402a037ef9b1d7f721e765b92a45e6807 100644 (file)
@@ -30,8 +30,6 @@ function doCmdT($title, $command, $isstr) {
                                        /* remove password tag contents */
                                        $line = preg_replace("/<password>.*?<\\/password>/", "<password>xxxxx</password>", $line);
                                        $line = preg_replace("/<pre-shared-key>.*?<\\/pre-shared-key>/", "<pre-shared-key>xxxxx</pre-shared-key>", $line);
-                                       $line = preg_replace("/<srv_key>.*?<\\/srv_key>/", "<srv_key>xxxxx</srv_key>", $line);
-                                       $line = preg_replace("/<cli_key>.*?<\\/cli_key>/", "<cli_key>xxxxx</cli_key>", $line);
                                        $line = str_replace("\t", "    ", $line);
                                        echo htmlspecialchars($line,ENT_NOQUOTES);
                                }
diff --git a/webgui/status_ovpn.php b/webgui/status_ovpn.php
deleted file mode 100644 (file)
index deebdb5..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/local/bin/php
-<?php 
-/*
-       status_ovpn.php
-       part of m0n0wall (http://m0n0.ch/wall)
-       
-       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
-       Copyright (C) 2005 Peter Allgeyer <allgeyer@web.de>.
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$pgtitle = array("Status", "OpenVPN");
-require("guiconfig.inc");
-
-$client_list = array();
-$virtip_list = array();
-
-function dump_log($type) {
-       global $g, $config;
-
-       unset($client_list);
-       $client_list = array();
-
-       unset($virtip_list);
-       $virtip_list = array();
-                       
-       $max = ($type == 'tun') ? 17 : 4;
-       for ($i = 0; $i < $max; $i++) {
-               if (file_exists("/var/log/openvpn_{$type}{$i}.log")) {
-
-                       unset($string);
-                       unset($logarr);
-                       
-                       exec("/bin/cat /var/log/openvpn_{$type}{$i}.log", $logarr);
-       
-                       foreach ($logarr as $logent) {
-                               $logent = preg_split("/,/", $logent, 5);
-                               $string = preg_split("/:/", $logent[1]);
-
-                               /* search for ip address in second column */
-                               if (isset($string[0]) && is_ipaddr($string[0]))
-                                       array_push($client_list, $logent);
-                               
-                               /* search for ip address in first column */
-                               else if (is_ipaddr($logent[0]))
-                                       array_push($virtip_list, $logent);
-                       }
-               }
-       }
-
-       if (count($client_list > 1)) {
-               foreach ($client_list as $cent) {
-                       echo "<tr>\n";
-                       echo "<td class=\"listlr\" nowrap>" . htmlspecialchars($cent[0]) . "</td>\n";
-                       echo "<td class=\"listr\">" . htmlspecialchars($cent[1]) . "</td>\n";
-
-                       unset($found);
-                       if (isset($virtip_list)) {
-                               foreach ($virtip_list as $vent) {
-                                       if ($cent[1] == $vent[2]) {
-                                               $found = 1;
-                                               echo "<td class=\"listr\">" . htmlspecialchars($vent[0]) . "&nbsp;</td>\n";
-                                       }
-                               }
-                       }
-                       if (!isset($found))
-                               echo "<td class=\"listr\" align=\"center\">--</td>\n";
-                               
-                       $date = preg_split("/\s+/", $cent[4]);
-                       echo "<td class=\"listr\">" . htmlspecialchars($date[1]) . " " . htmlspecialchars($date[2]) . " " . htmlspecialchars($date[3]) . "</td>\n";
-                       echo "<td class=\"listr\">" . htmlspecialchars($cent[2]) . "</td>\n";
-                       echo "<td class=\"listr\">" . htmlspecialchars($cent[3]) . "</td>\n";
-                       echo "</tr>\n";
-               }
-       }
-}
-
-?>
-<?php include("fbegin.inc"); ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
-  <td colspan="6" class="listtopic"> 
-           OpenVPN status entries</td>
-       </tr>
-        <tr>
-         <td class="listhdrr">Common Name</td>
-         <td class="listhdrr">Real Address</td>
-         <td class="listhdrr">Virtual Address</td>
-         <td class="listhdrr">Connected Since</td>
-         <td class="listhdrr">Bytes Received</td>
-         <td class="listhdr">Bytes Sent</td>
-       </tr>
-       <?php dump_log(tun); ?>
-       <?php dump_log(tap); ?>
-</table>
-<br>
-<strong class="red">Note:<br>
-</strong>Please note that status entries are updated once every minute only.
-So don't bother about entries on this page being possibly too old!
-<?php include("fend.inc"); ?>
index e61df9e371aa1702b5f37bf39342fb61fdea1a37..cb1a302395adc4c3e55f6926787394a1bf374a81 100644 (file)
@@ -328,7 +328,6 @@ function methodsel_change() {
                   <td width="78%" class="vtable"><select name="interface" class="formfld">
                       <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
-                                               if (!$config['interfaces']['opt' . $i]['ovpn'])
                                                        $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
                                          }
                                          foreach ($interfaces as $iface => $ifacename): ?>
diff --git a/webgui/vpn_openvpn_cli.php b/webgui/vpn_openvpn_cli.php
deleted file mode 100644 (file)
index 80786f3..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/local/bin/php
-<?php 
-/*
-       vpn_openvpn_cli.php
-
-       Copyright (C) 2004 Peter Curran (peter@closeconsultants.com).
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$pgtitle = array("VPN", "OpenVPN");
-require("guiconfig.inc");
-require_once("openvpn.inc");
-
-if (!is_array($config['ovpn']))
-       $config['ovpn'] = array();
-if (!is_array($config['ovpn']['client'])){
-       $config['ovpn']['client'] =  array();
-       $config['ovpn']['client']['tunnel'] =  array();
-}
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
-       $id = $_POST['id'];
-
-$ovpncli =& $config['ovpn']['client']['tunnel'];
-
-if ($_POST['apply']) {
-               $retval = 0;
-               if (file_exists($d_sysrebootreqd_path)) {
-                       /* Rewrite interface definitions */
-                       $retval = ovpn_client_iface();
-               }
-               else{
-                       ovpn_lock();
-                       $retval = ovpn_config_client();
-                       ovpn_unlock();
-               }
-               if (file_exists($d_ovpnclidirty_path))
-                       unlink($d_ovpnclidirty_path);
-               $savemsg = get_std_save_message($retval);       
-}
-
-if ($_GET['act'] == "del") {
-       if ($ovpncli[$id]) {
-               $ovpnent = $ovpncli[$id];
-               unset($ovpncli[$id]);
-
-               /* Kill running processes */
-               /* Remove old certs & keys */
-               ovpn_client_kill($ovpnent['if']);
-
-               /* Remove interface from list of optional interfaces */
-               ovpn_client_iface_del($ovpnent['if']);
-
-               write_config();
-               touch($d_sysrebootreqd_path);
-               header("Location: vpn_openvpn_cli.php");
-               exit;
-       }
-}
-?>
-<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if (file_exists($d_sysrebootreqd_path) && !file_exists($d_ovpnclidirty_path)) print_info_box(get_std_save_message(0)); ?>
-<form action="vpn_openvpn_cli.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
-<?php if (file_exists($d_ovpnclidirty_path)): ?><p>
-<?php print_info_box_np("The OpenVPN client configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
-<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
-<?php endif; ?>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
-  <ul id="tabnav">             
-       <li class="tabinact1"><a href="vpn_openvpn_srv.php">Server</a></li>
-       <li class="tabact">Client</li>
-  </ul>
-  </td></tr>
-  <tr>
-  <td class="tabcont">
-  <strong><span class="red">WARNING: This feature is experimental and modifies your optional interface configuration.
-  Backup your configuration before using OpenVPN, and restore it before upgrading.<br>
-&nbsp;  <br>
-    </span></strong>
-    <table width="100%" border="0" cellpadding="0" cellspacing="0">
-       <tr>
-         <td width="10%" class="listhdrr">Interface</td>
-         <td width="5%" class="listhdrr">Protocol</td>
-         <td width="15%" class="listhdrr">Socket</td>
-         <td width="15%" class="listhdrr">Server address</td>
-         <td width="5%" class="listhdrr" align="center">Version</td>
-         <td width="40%" class="listhdr">Description</td>
-         <td width="10%" class="list"></td>
-       </tr>
-       
-       <?php $i = 0; foreach ($ovpncli as $client):
-                                       if (!isset($client['enable'])) {
-                                               $spans = "<span class=\"gray\">";
-                                               $spane = "</span>";
-                                       } else {
-                                               $spans = $spane = "";
-                                       }
-       ?>
-       
-       <tr>
-         <td class="listlr"><?=$spans;?>
-               <?= $config['interfaces'][ovpn_get_opt_interface($client['if'])]['descr'] . " (" . $client['if'] . ")";?>
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= strtoupper($client['proto']);?>     
-          <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= "0.0.0.0:" . $client['port'];?>     
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= $client['saddr'].":".$client['sport'];?>
-         <?=$spane;?></td>
-         <td align="middle" class="listr"><?=$spans;?>
-               <?= $client['ver'];?>
-         <?=$spane;?></td>
-          <td class="listbg"><?=$spans;?>
-               <?= htmlspecialchars($client['descr']);?>&nbsp;
-         <?=$spane;?></td>
-         <td valign="middle" nowrap class="list"> <a href="vpn_openvpn_cli_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit client configuration" width="17" height="17" border="0"></a>
-                &nbsp;<a href="vpn_openvpn_cli.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this client configuration?')"><img src="x.gif" title="delete client configuration" width="17" height="17" border="0"></a></td>
-       </tr>
-       <?php $i++; endforeach; ?>
-       <tr> 
-         <td class="list" colspan="6">&nbsp;</td>
-         <td class="list"> <a href="vpn_openvpn_cli_edit.php"><img src="plus.gif" title="add client configuration" width="17" height="17" border="0"></a></td>
-       </tr>
-    </table>
-  </td>
-</tr>
-</table>
-</form>
-<?php include("fend.inc"); ?>
diff --git a/webgui/vpn_openvpn_cli_edit.php b/webgui/vpn_openvpn_cli_edit.php
deleted file mode 100644 (file)
index fa7fa12..0000000
+++ /dev/null
@@ -1,397 +0,0 @@
-#!/usr/local/bin/php
-<?php 
-/*
-       vpn_openvpn_cli_edit.php
-
-       Copyright (C) 2004 Peter Curran (peter@closeconsultants.com).
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$pgtitle = array("VPN", "OpenVPN", "Edit client");
-require("guiconfig.inc");
-require_once("openvpn.inc");
-
-if (!is_array($config['ovpn']))
-       $config['ovpn'] = array();
-if (!is_array($config['ovpn']['client'])){
-       $config['ovpn']['client'] =  array();
-       $config['ovpn']['client']['tunnel'] = array();
-}
-
-
-$ovpncli =& $config['ovpn']['client']['tunnel'];
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
-       $id = $_POST['id'];
-
-if (isset($id) && $ovpncli[$id]) {
-       $pconfig = $config['ovpn']['client']['tunnel'][$id];
-       if (isset($ovpncli[$id]['pull']))
-               $pconfig['pull'] = true;
-}
-else {
-       /* creating - set defaults */
-       $pconfig = array();
-       $pconfig['type'] = 'tun';
-       $pconfig['proto'] = 'udp';
-       $pconfig['sport'] = '1194';
-       $pconfig['ver'] = '2';
-       $pconfig['crypto'] = 'BF-CBC';
-       $pconfig['pull'] = true;
-       $pconfig['enable'] = true;
-}
-
-if (isset($_POST['pull'])) {
-
-       /* Called from form */
-       unset($input_errors);
-
-       /* input validation */
-       $reqdfields = explode(" ", "type saddr sport");
-       $reqdfieldsn = explode(",", "Tunnel type,Address,Port");
-
-       do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-       /* valid Port */
-       if (($_POST['sport'] && !is_port($_POST['sport'])))
-               $input_errors[] = "The server's port must be an integer between 1 and 65535 (default 1194).";
-
-       /* valid FQDN or IP address */
-       if (($_POST['saddr'] && !is_ipaddr($_POST['saddr']) && !is_domain($_POST['saddr'])))
-               $input_errors[] = "The server name contains invalid characters.";
-
-       if (is_null($_POST['ca_cert']))
-               $input_errors[] = "You must provide a CA certificate file";
-       elseif (!strstr($_POST['ca_cert'], "BEGIN CERTIFICATE") || !strstr($_POST['ca_cert'], "END CERTIFICATE"))
-               $input_errors[] = "The CA certificate does not appear to be valid.";
-               
-       if (is_null($_POST['cli_cert']))
-               $input_errors[] = "You must provide a client certificate file";
-       elseif (!strstr($_POST['cli_cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cli_cert'], "END CERTIFICATE"))
-               $input_errors[] = "The client certificate does not appear to be valid.";
-               
-       if (is_null($_POST['cli_key']))
-               $input_errors[] = "You must provide a client key file";
-       elseif (!strstr($_POST['cli_key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['cli_key'], "END RSA PRIVATE KEY"))
-               $input_errors[] = "The client key does not appear to be valid.";
-
-       if (isset($_POST['tlsauth']) && empty($_POST['pre-shared-key']))
-               $input_errors[] = "You must provide a pre-shared secret file";
-       if (!empty($_POST['pre-shared-key']))
-               if (!strstr($_POST['pre-shared-key'], "BEGIN OpenVPN Static key") || !strstr($_POST['pre-shared-key'], "END OpenVPN Static key"))
-                       $input_errors[] = "Pre-shared secret does not appear to be valid.";
-                                
-       if (isset($id)) {
-               /* Editing an existing entry */
-               $ovpnent = $ovpncli[$id];
-
-               if ( $ovpncli[$id]['sport'] != $_POST['sport'] ||
-                       $ovpncli[$id]['proto'] != $_POST['proto'] ) {
-
-                       /* some entries changed */
-                       for ($i = 0; isset($config['ovpn']['client']['tunnel'][$i]); $i++) {
-                               $current = &$config['ovpn']['client']['tunnel'][$i];
-
-                               if ($current['sport'] == $_POST['sport'])
-                                       if ($current['proto'] == $_POST['proto'])
-                                               $input_errors[] = "You already have this combination for port and protocol settings. You can't use it twice";
-                       }
-               }
-
-               /* Test Server type hasn't changed */
-               if ($ovpnent['type'] != $_POST['type']) {
-                       $input_errors[] = "Delete this interface first before changing the type of the tunnel to " . strtoupper($_POST['type']) .".";
-                       /* Temporarily disabled */
-                       /*
-                        * $nxt_if = getnxt_client_if($_POST['type']);
-                        * if (!$nxt_if)
-                        *      $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
-                        * else
-                        *      $ovpnent['if'] = $nxt_if;
-                        */
-
-                       /* Need to reboot in order to create interfaces cleanly */
-                       /* touch($d_sysrebootreqd_path); */
-               }
-               /* Has the enable/disable state changed? */
-               if (isset($ovpnent['enable']) && isset($_POST['disabled'])) {
-                       touch($d_ovpnclidirty_path);
-               }
-               if (!isset($ovpnent['enable']) && !isset($_POST['disabled'])) {
-                       touch($d_ovpnclidirty_path);
-               }
-       } else {
-               /* Creating a new entry */
-               $ovpnent = array();
-               $nxt_if = getnxt_client_if($_POST['type']);
-               if (!$nxt_if)
-                       $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
-               else
-                       $ovpnent['if'] = $nxt_if;
-
-               $ovpnent['port'] = getnxt_client_port();
-
-               /* I think we have to reboot to have the interface created cleanly */
-               touch($d_sysrebootreqd_path);
-       }
-
-       if (!$input_errors) {
-
-               $ovpnent['enable'] = isset($_POST['disabled']) ? false : true;
-               $ovpnent['type'] = $_POST['type'];
-               $ovpnent['proto'] = $_POST['proto'];
-               $ovpnent['sport'] = $_POST['sport'];
-               $ovpnent['ver'] = $_POST['ver'];
-               $ovpnent['saddr'] = $_POST['saddr'];
-               $ovpnent['descr'] = $_POST['descr'];
-               $ovpnent['ca_cert'] = $pconfig['ca_cert'];
-               $ovpnent['cli_cert'] = $pconfig['cli_cert'];
-               $ovpnent['cli_key'] = $pconfig['cli_key'];
-               $ovpnent['crypto'] = $_POST['crypto'];
-               $ovpnent['pull'] = true; //This is a fixed config for this version
-               $ovpnent['tlsauth'] = false;
-
-               unset($ovpnent['pre-shared-key']);
-               if ($_POST['tlsauth']) {
-                       $ovpnent['tlsauth'] = true;
-                       $ovpnent['pre-shared-key'] = base64_encode($_POST['pre-shared-key']); 
-               }
-
-               $ovpnent['ca_cert'] = base64_encode($_POST['ca_cert']);
-               $ovpnent['cli_cert'] = base64_encode($_POST['cli_cert']);
-               $ovpnent['cli_key'] = base64_encode($_POST['cli_key']);
-
-               if (isset($id) && $ovpncli[$id]){
-                       $ovpncli[$id] = $ovpnent;
-               }
-               else{
-                       $ovpncli[] = $ovpnent;
-               }
-               
-               write_config();
-               touch($d_ovpnclidirty_path);
-
-               header("Location: vpn_openvpn_cli.php");
-               exit;
-       } else {
-               $pconfig = $_POST;
-
-               $pconfig['enable'] = "true";
-               if (isset($_POST['disabled']))
-                       unset($pconfig['enable']);
-
-               if ($_POST['tlsauth'])
-                       $pconfig['pre-shared-key'] = base64_encode($_POST['pre-shared-key']); 
-
-               $pconfig['ca_cert'] = base64_encode($_POST['ca_cert']);
-               $pconfig['cli_cert'] = base64_encode($_POST['cli_cert']);
-               $pconfig['cli_key'] = base64_encode($_POST['cli_key']);
-       }
-}
-
-?>
-<?php include("fbegin.inc"); ?>
-<script language="JavaScript">
-function enable_change(enable_over) {
-       var endis;
-       endis = !(document.iform.tlsauth.checked || enable_over);
-
-       document.iform.psk.disabled = endis;
-}
-
-//-->
-</script>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<form action="vpn_openvpn_cli_edit.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
-  <table width="100%" border="0" cellpadding="6" cellspacing="0">
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Disabled</td>
-      <td width="78%" class="vtable"> 
-        <input name="disabled" type="checkbox" id="disabled" value="yes" <?php if (!isset($pconfig['enable'])) echo "checked"; ?>>
-        <strong>Disable this client</strong><br>
-        <span class="vexpl">Set this option to disable this client without removing it from the list.</span>
-      </td>
-    </tr>
-       
-    <tr> 
-      <td colspan="2" class="list" height="12"></td>
-    </tr>
-    
-    <tr>
-      <td colspan="2" valign="top" class="listtopic">Server information</td>
-    </tr>
-    <tr>
-      <td valign="top" class="vncellreq">Tunnel type</td>
-      <td class="vtable">
-          <input name="type" type="radio" class="formfld" value="tun" <?php if ($pconfig['type'] == 'tun') echo "checked"; ?>> TUN&nbsp;
-<input name="type" type="radio" class="formfld" value="tap" <?php if ($pconfig['type'] == 'tap') echo "checked"; ?>> TAP</td>
-    </tr> 
-    
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Tunnel protocol</td>
-      <td width="78%" class="vtable">
-<input name="proto" type="radio" class="formfld" value="udp" <?php if ($pconfig['proto'] == 'udp') echo "checked"; ?>> UDP&nbsp;
-<input name="proto" type="radio" class="formfld" value="tcp" <?php if ($pconfig['proto'] == 'tcp') echo "checked"; ?>> TCP<br>
-       <span class="vexpl">Important: These settings must match the server's configuration.</span></td>
-     </tr>
-    
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Port</td>
-      <td width="78%" class="vtable">
-        <input name="sport" type="text" class="formfld" size="5" maxlength="5" value="<?=htmlspecialchars($pconfig['sport']);?>"><br>
-        Enter the server's port number (default is 1194).</td>
-    </tr>
-    
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Address</td>
-      <td width="78%" class="vtable"> 
-       <input name="saddr" type="text" class="formfld" size="20" maxlength="255" value="<?=htmlspecialchars($pconfig['saddr']);?>">
-       <br>
-       Enter the server's IP address or FQDN.</td>
-    </tr>
-    
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Version</td>
-      <td width="78%" class="vtable"> 
-        <input name="ver" type="radio" class="formfld" value="2" <?php if ($pconfig['ver'] == '2') echo "checked"; ?>> 2.0&nbsp;
-       <input name="ver" type="radio" class="formfld" value="1" <?php if ($pconfig['ver'] == '1') echo "checked"; ?>> 1.x
-       <br>
-       Specify which version of the OpenVPN protocol the server runs.</td>
-    </tr>
-    
-    <tr> 
-      <td width="22%" valign="top" class="vncell">Description</td>
-      <td width="78%" class="vtable"> 
-        <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> 
-        <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td>
-    </tr>
-    
-    <tr> 
-      <td colspan="2" class="list" height="12"></td>
-    </tr>
-    
-    <tr> 
-      <td colspan="2" valign="top" class="listtopic">Client configuration</td>
-    </tr>
-    
-    <tr> 
-      <td width="22%" valign="top" class="vncell">Interface</td>
-      <td width="78%" class="vtable">
-        <strong>Auto</strong>
-      </td>
-    </tr>
-    
-    <tr>
-      <td width="22%" valign="top" class="vncell">Port</td>
-      <td width="78%" class="vtable">
-       <strong>Auto</strong>
-      </td>
-    </tr>
-     
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">CA certificate</td>
-      <td width="78%" class="vtable"> 
-      <textarea name="ca_cert" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['ca_cert']));?></textarea>
-      <br>      
-      Paste a CA certificate in X.509 PEM format here.</td>
-    </tr>
-               
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">Client certificate</td>
-      <td width="78%" class="vtable">
-        <textarea name="cli_cert" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['cli_cert']));?></textarea>
-        <br>
-        Paste a client certificate in X.509 PEM format here.</td>
-     </tr>
-     
-     <tr> 
-       <td width="22%" valign="top" class="vncellreq">Client key</td>
-       <td width="78%" class="vtable"> 
-         <textarea name="cli_key" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['cli_key']));?></textarea>
-         <br>Paste the client RSA private key here.</td>
-     </tr>
-     
-        
-      <tr>
-        <td width="22%" valign="top" class="vncell">Crypto</td>
-        <td width="78%" class="vtable">
-          <select name="crypto" class="formfld">
-           <?php $cipher_list = ovpn_get_cipher_list();
-           foreach($cipher_list as $key => $value){
-           ?>
-             <option value="<?= $key ?>" <?php if ($pconfig['crypto'] == $key) echo "selected"; ?>>
-               <?= $value ?>
-             </option>
-           <?php
-           }
-           ?>
-         </select>
-         <br>
-         Select the data channel encryption cipher.  This must match the setting on the server.
-       </td>
-      </tr>
-
-      <tr>
-        <td width="22%" valign="top" class="vncell">TLS auth</td>
-        <td width="78%" class="vtable">
-         <input name="tlsauth" type="checkbox" value="yes" <?php if (isset($pconfig['tlsauth'])) echo "checked";?> onClick="enable_change(false)">
-         <strong>TLS auth</strong><br>
-          The tls-auth directive adds an additional HMAC signature to all SSL/TLS handshake packets for integrity verification.</td>
-      </tr>
-
-      <tr> 
-       <td width="22%" valign="top" class="vncell">Pre-shared secret</td>
-       <td width="78%" class="vtable">
-         <textarea name="pre-shared-key" id="psk" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['pre-shared-key']));?></textarea>
-         <br>
-         Paste your own pre-shared secret here.</td>
-      </tr>
-
-     <tr>
-       <td width="22%" valign="top" class="vncellreq">Options</td>
-       <td width="78%" class="vtable">
-         <input type="checkbox" name="pull" value="yes" <?php if ($pconfig['pull']) echo "checked"; ?>> 
-         Client-pull</td>
-     </tr>
-     
-     <tr> 
-       <td width="22%" valign="top">&nbsp;</td>
-       <td width="78%"> 
-         <input name="Submit" type="submit" class="formbtn" value="Save"> 
-         <?php if (isset($id)): ?>
-         <input name="id" type="hidden" value="<?=$id;?>"> 
-         <?php endif; ?>
-       </td>
-     </tr>
-   </table>
-</form>
-<script language="JavaScript">
-<!--
-enable_change(false);
-//-->
-</script>
-<?php include("fend.inc"); ?>
diff --git a/webgui/vpn_openvpn_srv.php b/webgui/vpn_openvpn_srv.php
deleted file mode 100644 (file)
index 2f4f9b7..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/local/bin/php
-<?php 
-/*
-       vpn_openvpn_srv.php
-
-       Copyright (C) 2004 Peter Curran (peter@closeconsultants.com).
-       Copyright (C) 2005 Peter Allgeyer (allgeyer@web.de).
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$pgtitle = array("VPN", "OpenVPN");
-require("guiconfig.inc");
-require_once("openvpn.inc");
-
-if (!is_array($config['ovpn']))
-       $config['ovpn'] = array();
-if (!is_array($config['ovpn']['server'])){
-       $config['ovpn']['server'] =  array();
-       $config['ovpn']['server']['tunnel'] =  array();
-}
-
-$ovpnsrv = &$config['ovpn']['server']['tunnel'];
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
-        $id = $_POST['id'];
-
-
-if ($_POST['apply']) {
-               $retval = 0;
-               if (file_exists($d_sysrebootreqd_path)) {
-                       /* Rewrite interface definitions */
-                       $retval = ovpn_server_iface();
-               }
-               else{
-                       ovpn_lock();
-                       $retval = ovpn_server_iface();
-                       $retval = ovpn_config_server(false);
-                       ovpn_unlock();
-               }
-               if (file_exists($d_ovpnsrvdirty_path))
-                       unlink($d_ovpnsrvdirty_path);
-               $savemsg = get_std_save_message($retval);       
-}
-
-if ($_GET['act'] == "del") {
-       if ($ovpnsrv[$id]) {
-               $ovpnent = $ovpnsrv[$id];
-               unset($ovpnsrv[$id]);
-                                                                             
-               /* Kill running processes */
-               /* Remove old certs & keys */
-               ovpn_server_kill($ovpnent['tun_iface']);
-
-               /* Remove interface from list of optional interfaces */
-               ovpn_server_iface_del($ovpnent['tun_iface']);
-
-               write_config();
-               touch($d_sysrebootreqd_path);
-               header("Location: vpn_openvpn_srv.php");
-               exit;
-       }
-}
-?>
-<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if (file_exists($d_sysrebootreqd_path) && !file_exists($d_ovpnsrvdirty_path)) print_info_box(get_std_save_message(0)); ?>
-<form action="vpn_openvpn_srv.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
-<?php if (file_exists($d_ovpnsrvdirty_path)): ?><p>
-<?php print_info_box_np("The OpenVPN server configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
-<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
-<?php endif; ?>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
-  <ul id="tabnav">             
-       <li class="tabact">Server</li>
-       <li class="tabinact"><a href="vpn_openvpn_cli.php">Client</a></li>
-  </ul>
-  </td></tr>
-  <tr>
-  <td class="tabcont">
-  <strong><span class="red">WARNING: This feature is experimental and modifies your optional interface configuration.
-  Backup your configuration before using OpenVPN, and restore it before upgrading.<br>
-&nbsp;  <br>
-    </span></strong>
-    <table width="100%" border="0" cellpadding="0" cellspacing="0">
-       <tr>
-         <td width="5%" class="listhdrr">Interface</td>
-         <td width="5%" class="listhdrr">Protocol</td>
-         <td width="5%" class="listhdrr">Socket</td>
-         <td width="25%" class="listhdrr">IP Block</td>
-         <td width="15%" class="listhdrr">Crypto</td>
-         <td width="35%" class="listhdr">Description</td>
-         <td width="10%" class="list"></td>
-       </tr>
-       
-       <?php $i = 0; foreach ($ovpnsrv as $server):
-                                       if (!isset($server['enable'])) {
-                                               $spans = "<span class=\"gray\">";
-                                               $spane = "</span>";
-                                       } else {
-                                               $spans = $spane = "";
-                                       }
-                                       
-               if ($server['bind_iface'] == 'all')
-                       $ipaddr = "0.0.0.0";
-               else
-                       $ipaddr = ovpn_get_ip($server['bind_iface']);
-       ?>
-       
-       <tr>
-         <td class="listlr"><?=$spans;?>
-               <?= $config['interfaces'][ovpn_get_opt_interface($server['tun_iface'])]['descr'] . " (" . $server['tun_iface'] . ")";?> 
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= strtoupper($server['proto']);?>     
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= $ipaddr.":".$server['port'];?>
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= $server['ipblock']."/".$server['prefix'];?> 
-         <?=$spane;?></td>
-         <td class="listr"><?=$spans;?>
-               <?= $server['crypto'];?>        
-         <?=$spane;?></td>
-          <td class="listbg"><?=$spans;?>
-               <?= htmlspecialchars($server['descr']);?>&nbsp;
-         <?=$spane;?></td>
-         <td valign="middle" nowrap class="list"> <a href="vpn_openvpn_srv_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit server configuration" width="17" height="17" border="0"></a>
-                &nbsp;<a href="vpn_openvpn_srv.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this server configuration?')"><img src="x.gif" title="delete server configuration" width="17" height="17" border="0"></a></td>
-       </tr>
-       <?php $i++; endforeach; ?>
-       <tr> 
-         <td class="list" colspan="6">&nbsp;</td>
-         <td class="list"> <a href="vpn_openvpn_srv_edit.php"><img src="plus.gif" title="add server configuration" width="17" height="17" border="0"></a></td>
-       </tr>
-    </table>
-  </td>
-</tr>
-</table>
-</form>
-<?php include("fend.inc"); ?>
diff --git a/webgui/vpn_openvpn_srv_edit.php b/webgui/vpn_openvpn_srv_edit.php
deleted file mode 100644 (file)
index d284390..0000000
+++ /dev/null
@@ -1,560 +0,0 @@
-#!/usr/local/bin/php
-<?php 
-/*
-       vpn_openvpn_srv_edit.php
-
-       Copyright (C) 2004 Peter Curran (peter@closeconsultants.com).
-       Copyright (C) 2005 Peter Allgeyer (allgeyer@web.de).
-       All rights reserved.
-       
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are met:
-       
-       1. Redistributions of source code must retain the above copyright notice,
-          this list of conditions and the following disclaimer.
-       
-       2. Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in the
-          documentation and/or other materials provided with the distribution.
-       
-       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$pgtitle = array("VPN", "OpenVPN", "Edit server");
-require("guiconfig.inc");
-require_once("openvpn.inc");
-
-if (!is_array($config['ovpn']))
-       $config['ovpn'] = array();
-if (!is_array($config['ovpn']['server'])){
-       $config['ovpn']['server'] =  array();
-       $config['ovpn']['server']['tunnel'] = array();
-}
-
-$ovpnsrv =& $config['ovpn']['server']['tunnel'];
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
-       $id = $_POST['id'];
-
-if (isset($id) && $ovpnsrv[$id]) {
-       $pconfig = $config['ovpn']['server']['tunnel'][$id];
-       if (isset($ovpnsrv[$id]['enable']))
-               $pconfig['enable'] = true;
-} else {
-       /* creating - set defaults */
-       $pconfig = array();
-       $pconfig['type'] = "tun";
-       $pconfig['psh_options'] = array();
-       /* Initialise with some sensible defaults */
-       if ($config['ovpn']['server']['tunnel'])
-               $pconfig['port'] = getnxt_server_port();
-       else
-               $port = 1194;
-       $pconfig['proto'] = 'udp';
-       $pconfig['maxcli'] = 25;
-       $pconfig['crypto'] = 'BF-CBC';
-       $pconfig['dupcn'] = true;
-       $pconfig['verb'] = 1;
-       $pconfig['enable'] = true;
-}
-
-
-if ($_POST) {
-
-       unset($input_errors);
-
-       /* input validation */
-       $reqdfields = explode(" ", "type bind_iface ipblock");
-       $reqdfieldsn = explode(",", "Tunnel type,Interface binding,IP address block start");
-
-       do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-       
-       /* valid IP */
-       if (($_POST['ipblock'] && !is_ipaddr($_POST['ipblock'])))
-               $input_errors[] = "A valid IP address must be specified.";
-               
-       /* valid Port */
-       if (($_POST['port'] && !is_port($_POST['port'])))
-               $input_errors[] = "The server port must be an integer between 1 and 65535.";
-       
-       /* check if dynip is set correctly */
-       if ($_POST['dynip'] && $_POST['bind_iface'] != 'all')
-               $input_errors[] = "Dynamic IP address can only be set with interface binding set to ALL.";
-
-       /* Sort out the cert+key files */
-       if (empty($_POST['ca_cert']))
-               $input_errors[] = "You must provide a CA certificate file";
-       elseif (!strstr($_POST['ca_cert'], "BEGIN CERTIFICATE") || !strstr($_POST['ca_cert'], "END CERTIFICATE"))
-               $input_errors[] = "The CA certificate does not appear to be valid.";
-
-       if (empty($_POST['srv_cert']))
-               $input_errors[] = "You must provide a server certificate file";
-       elseif (!strstr($_POST['srv_cert'], "BEGIN CERTIFICATE") || !strstr($_POST['srv_cert'], "END CERTIFICATE"))
-               $input_errors[] = "The server certificate does not appear to be valid.";
-
-       if (empty($_POST['srv_key']))
-               $input_errors[] = "You must provide a server key file";
-       elseif (!strstr($_POST['srv_key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['srv_key'], "END RSA PRIVATE KEY"))
-               $input_errors[] = "The server key does not appear to be valid.";
-
-       if (empty($_POST['dh_param']))
-               $input_errors[] = "You must provide a DH parameters file";
-       elseif (!strstr($_POST['dh_param'], "BEGIN DH PARAMETERS") || !strstr($_POST['dh_param'], "END DH PARAMETERS"))
-               $input_errors[] = "The DH parameters do not appear to be valid.";
-                               
-       if (isset($_POST['tlsauth']) && empty($_POST['pre-shared-key']))
-               $input_errors[] = "You must provide a pre-shared secret file";
-       if (!empty($_POST['pre-shared-key']))
-               if (!strstr($_POST['pre-shared-key'], "BEGIN OpenVPN Static key") || !strstr($_POST['pre-shared-key'], "END OpenVPN Static key"))
-                       $input_errors[] = "Pre-shared secret does not appear to be valid.";
-                               
-       if ($_POST['psh_pingrst'] && $_POST['psh_pingexit'])
-               $input_errors[] = "Ping-restart and Ping-exit are mutually exclusive and cannot be used together";
-
-       if ($_POST['psh_rtedelay'] && !is_numeric($_POST['psh_rtedelay_int']))
-               $input_errors[] = "Route-delay needs a numerical interval setting.";
-
-       if ($_POST['psh_inact'] && !is_numeric($_POST['psh_inact_int']))
-               $input_errors[] = "Inactive needs a numerical interval setting.";
-
-       if ($_POST['psh_ping'] && !is_numeric($_POST['psh_ping_int']))
-               $input_errors[] = "Ping needs a numerical interval setting.";
-                       
-       if ($_POST['psh_pingexit'] && !is_numeric($_POST['psh_pingexit_int']))
-               $input_errors[] = "Ping-exit needs a numerical interval setting.";
-
-       if ($_POST['psh_pingrst'] && !is_numeric($_POST['psh_pingrst_int']))
-               $input_errors[] = "Ping-restart needs a numerical interval setting.";
-
-
-       /* need a test here to make sure prefix and max_clients are coherent */
-
-       /* need a test here to make sure protocol:ip:port isn't used twice */
-
-       /* Editing an existing entry? */
-       if (isset($id) && $ovpnsrv[$id]) {
-               $ovpnent = $ovpnsrv[$id];
-
-               if ( $ovpnent['bind_iface'] != $_POST['bind_iface'] ||
-                    $ovpnent['port'] != $_POST['port'] ||
-                    $ovpnent['proto'] != $_POST['proto'] ) {
-
-                       /* some entries changed */
-                       for ($i = 0; isset($config['ovpn']['server']['tunnel'][$i]); $i++) {
-                               $current = &$config['ovpn']['server']['tunnel'][$i];
-
-                               if ($current['bind_iface'] == $_POST['bind_iface'] || $current['bind_iface'] == 'all')
-                                       if ($current['port'] == $_POST['port'])
-                                               if ($current['proto'] == $_POST['proto'])
-                                                       $input_errors[] = "You already have this combination for Interface binding, port and protocol settings. You can't use it twice";
-                       }
-               }
-
-               /* Test Server type hasn't changed */
-               if ($ovpnent['type'] != $_POST['type']) {
-                       $input_errors[] = "Delete this interface first before changing the type of the tunnel to " . strtoupper($_POST['type']) .".";
-
-                       /* Temporarily disabled */
-                       /*
-                        * $nxt_if = getnxt_server_if($_POST['type']);
-                        * if (!$nxt_if)
-                        *              $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
-                        * else
-                        *      $ovpnent['tun_iface'] = $nxt_if;
-                        */
-                        /* Need to reboot in order to create interfaces cleanly */
-                        /* touch($d_sysrebootreqd_path); */
-               }
-               /* Has the enable/disable state changed? */
-               if (isset($ovpnent['enable']) && isset($_POST['disabled'])) {
-                       /* status changed to disabled */
-                       touch($d_ovpnsrvdirty_path);
-               }
-               if (!isset($ovpnent['enable']) && !isset($_POST['disabled'])) {
-                       /* status changed to enable */
-                       /* touch($d_sysrebootreqd_path); */
-                       touch($d_ovpnsrvdirty_path);
-               }
-       } else {
-               /* Creating a new entry */
-               $ovpnent = array();
-               $nxt_if = getnxt_server_if($_POST['type']);
-               if (!$nxt_if)
-                       $input_errors[] = "Run out of devices for a tunnel of type {$_POST['type']}";
-               else
-                       $ovpnent['tun_iface'] = $nxt_if;
-               $ovpnent['port'] = getnxt_server_port();
-               /* I think we have to reboot to have the interface created cleanly */
-               touch($d_sysrebootreqd_path);
-       }
-
-       if (!$input_errors) {
-
-               $ovpnent['enable'] = isset($_POST['disabled']) ? false : true;
-               $ovpnent['bind_iface'] = $_POST['bind_iface'];
-               $ovpnent['port'] = $_POST['port'];
-               $ovpnent['proto'] = $_POST['proto'];
-               $ovpnent['type'] = $_POST['type'];
-               
-               /* convert IP address block to a correct network IP address */
-               $ipblock = gen_subnet($_POST['ipblock'], $_POST['prefix']);
-               $ovpnent['ipblock'] = $ipblock;
-
-               $ovpnent['prefix'] = $_POST['prefix'];
-               $ovpnent['descr'] = $_POST['descr'];
-               $ovpnent['verb'] = $_POST['verb'];
-               $ovpnent['maxcli'] = $_POST['maxcli'];
-               $ovpnent['crypto'] = $_POST['crypto'];
-               $ovpnent['cli2cli'] = $_POST['cli2cli'] ? true : false;
-               $ovpnent['dupcn'] = $_POST['dupcn'] ? true : false;
-               $ovpnent['dynip'] = $_POST['dynip'] ? true : false;
-               $ovpnent['tlsauth'] = false;
-
-               unset($ovpnent['pre-shared-key']);
-               if ($_POST['tlsauth']) {
-                       $ovpnent['tlsauth'] = true;
-                       $ovpnent['pre-shared-key'] = base64_encode($_POST['pre-shared-key']);   
-               }
-
-               $ovpnent['psh_options']['redir'] = $_POST['psh_redir'] ? true : false;
-               $ovpnent['psh_options']['redir_loc'] = $_POST['psh_redir_loc'] ? true : false;
-               $ovpnent['psh_options']['rtedelay'] = $_POST['psh_rtedelay'] ? true : false;
-               $ovpnent['psh_options']['inact'] = $_POST['psh_inact'] ? true : false;
-               $ovpnent['psh_options']['ping'] = $_POST['psh_ping'] ? true : false;
-               $ovpnent['psh_options']['pingrst'] = $_POST['psh_pingrst'] ? true : false;
-               $ovpnent['psh_options']['pingexit'] = $_POST['psh_pingexit'] ? true : false;
-
-               unset($ovpnent['psh_options']['rtedelay_int']);
-               unset($ovpnent['psh_options']['inact_int']);
-               unset($ovpnent['psh_options']['ping_int']);
-               unset($ovpnent['psh_options']['pingrst_int']);
-               unset($ovpnent['psh_options']['pingexit_int']);
-
-               if ($_POST['psh_rtedelay_int'])
-                       $ovpnent['psh_options']['rtedelay_int'] = $_POST['psh_rtedelay_int'];
-               if ($_POST['psh_inact_int'])
-                       $ovpnent['psh_options']['inact_int'] = $_POST['psh_inact_int'];
-               if ($_POST['psh_ping_int'])
-                       $ovpnent['psh_options']['ping_int'] = $_POST['psh_ping_int'];
-               if ($_POST['psh_pingrst_int'])
-                       $ovpnent['psh_options']['pingrst_int'] = $_POST['psh_pingrst_int'];
-               if ($_POST['psh_pingexit_int'])
-                       $ovpnent['psh_options']['pingexit_int'] = $_POST['psh_pingexit_int'];
-               
-               $ovpnent['ca_cert'] = base64_encode($_POST['ca_cert']);
-               $ovpnent['srv_cert'] = base64_encode($_POST['srv_cert']);
-               $ovpnent['srv_key'] = base64_encode($_POST['srv_key']);
-               $ovpnent['dh_param'] = base64_encode($_POST['dh_param']);       
-
-               if (isset($id) && $ovpnsrv[$id])
-                       $ovpnsrv[$id] = $ovpnent;
-               else
-                       $ovpnsrv[] = $ovpnent;
-
-               write_config();
-               touch($d_ovpnsrvdirty_path);
-
-               header("Location: vpn_openvpn_srv.php");
-               exit;
-       } else {
-
-               $pconfig = $_POST;
-
-               $pconfig['enable'] = "true";
-               if (isset($_POST['disabled']))
-                       unset($pconfig['enable']);
-
-               if ($_POST['tlsauth'])
-                       $pconfig['pre-shared-key'] = base64_encode($_POST['pre-shared-key']);   
-
-               $pconfig['ca_cert'] = base64_encode($_POST['ca_cert']);
-               $pconfig['srv_cert'] = base64_encode($_POST['srv_cert']);
-               $pconfig['srv_key'] = base64_encode($_POST['srv_key']);
-               $pconfig['dh_param'] = base64_encode($_POST['dh_param']);
-
-               $pconfig['psh_options']['redir'] = $_POST['psh_redir'];
-               $pconfig['psh_options']['redir_loc'] = $_POST['psh_redir_loc'];
-               $pconfig['psh_options']['rtedelay'] = $_POST['psh_rtedelay'];
-               $pconfig['psh_options']['inact'] = $_POST['psh_inact'];
-               $pconfig['psh_options']['ping'] = $_POST['psh_ping'];
-               $pconfig['psh_options']['pingrst'] = $_POST['psh_pingrst'];
-               $pconfig['psh_options']['pingexit'] = $_POST['psh_pingexit'];
-
-               $pconfig['psh_options']['rtedelay_int'] = $_POST['psh_rtedelay_int'];
-               $pconfig['psh_options']['inact_int'] = $_POST['psh_inact_int'];
-               $pconfig['psh_options']['ping_int'] = $_POST['psh_ping_int'];
-               $pconfig['psh_options']['pingrst_int'] = $_POST['psh_pingrst_int'];
-               $pconfig['psh_options']['pingexit_int'] = $_POST['psh_pingexit_int'];
-       }
-}
-
-
-?>
-<?php include("fbegin.inc"); ?>
-<script language="JavaScript">
-function type_change() {
-       switch (document.iform.bind_iface.selectedIndex) {
-               /* ALL */
-               case 0:
-                       document.iform.dynip.disabled = 0;
-                       break;
-               default:
-                       document.iform.dynip.disabled = 1;
-       }
-}
-function enable_change(enable_over) {
-       var endis;
-       endis = !(document.iform.tlsauth.checked || enable_over);
-        
-        document.iform.psk.disabled = endis;
-}
-
-//-->
-</script>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if (file_exists($d_sysrebootreqd_path)) print_info_box(get_std_save_message(0)); ?>
-
-<form action="vpn_openvpn_srv_edit.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
-<strong><span class="red">WARNING: This feature is experimental and modifies your optional interface configuration.
-  Backup your configuration before using OpenVPN, and restore it before upgrading.<br>&nbsp;<br>
-</span></strong>
-<table width="100%" border="0" cellpadding="6" cellspacing="0">
-  <tr>
-    <td width="22%" valign="top" class="vncellreq">Disabled</td>
-    <td width="78%" class="vtable">
-      <input name="disabled" type="checkbox" value="yes" <?php if (!isset($pconfig['enable'])) echo "checked"; ?>>
-      <strong>Disable this server</strong><br>
-        <span class="vexpl">Set this option to disable this server without removing it from the list.</span>
-    </td>
-   </tr>
-   
-   <tr>
-     <td width="22%" valign="top" class="vncellreq">Tunnel type</td>
-     <td width="78%" class="vtable">
-       <input type="radio" name="type" class="formfld" value="tun" <?php if ($pconfig['type'] == 'tun') echo "checked"; ?>>
-          TUN&nbsp;
-       <input type="radio" name="type" class="formfld" value="tap" <?php if ($pconfig['type'] == 'tap') echo "checked"; ?>>
-          TAP
-      </td>
-    </tr>
-
-    <tr>
-      <td width="22%" valign="top" class="vncell">OpenVPN protocol/port</td>
-      <td width="78%" class="vtable">
-       <input type="radio" name="proto" class="formfld" value="udp" <?php if ($pconfig['proto'] == 'udp') echo "checked"; ?>>
-           UDP&nbsp;
-        <input type="radio" name="proto" class="formfld" value="tcp" <?php if ($pconfig['proto'] == 'tcp') echo "checked"; ?>>
-           TCP<br><br>
-        Port: 
-        <input name="port" type="text" class="formfld" size="5" maxlength="5" value="<?= $pconfig['port']; ?>"><br>
-        Enter the port number to use for the server (default is 1194).</td>
-    </tr>
-    
-    <tr>
-      <td width="22%" valign="top" class="vncellreq">Interface binding</td>
-      <td width="78%" class="vtable">
-       <select name="bind_iface" class="formfld" onchange="type_change()">
-        <?php 
-       $interfaces = ovpn_real_interface_list();
-       foreach ($interfaces as $key => $iface):
-        ?>
-       <option value="<?=$key;?>" <?php if ($key == $pconfig['bind_iface']) echo "selected"; ?>> <?= $iface;?>
-        </option>
-        <?php endforeach;?>
-        </select>
-        <span class="vexpl"><br>
-        Choose an interface for the OpenVPN server to listen on.</span></td>
-    </tr>
-               
-    <tr>
-      <td width="22%" valign="top" class="vncell">Dynamic IP address</td>
-      <td width="78%" class="vtable">
-       <input name="dynip" type="checkbox" value="yes" <?php if (isset($pconfig['dynip'])) echo "checked"; ?>>
-       <strong>Dynamic IP address</strong><br>
-       Set this option to on, if your IP addresses are being assigned dynamically. Can only be used with interface binding set to ALL.</td>
-    </tr>
-        
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">VPN client address pool</td>
-      <td width="78%" class="vtable"> 
-        <input name="ipblock" type="text" class="formfld" size="20" value="<?=htmlspecialchars($pconfig['ipblock']);?>">
-        / 
-        <select name="prefix" class="formfld">
-          <?php for ($i = 29; $i > 19; $i--): ?>
-          <option value="<?=$i;?>" <?php if ($i == $pconfig['prefix']) echo "selected"; ?>>
-            <?=$i;?>
-          </option>
-          <?php endfor; ?>
-        </select>
-        <br>
-        Enter the IP address block for the OpenVPN server and clients to use.<br>
-        <br>
-       Maximum number of simultaneous clients: 
-       <input name="maxcli" type="text" class="formfld" size="3" maxlength="3" value="<?=htmlspecialchars($pconfig['maxcli']);?>">
-       </td>
-    </tr>
-
-    <tr> 
-      <td width="22%" valign="top" class="vncell">Description</td>
-      <td width="78%" class="vtable"> 
-        <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> 
-        <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td>
-    </tr>
-    
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">CA certificate</td>
-      <td width="78%" class="vtable"> 
-      <textarea name="ca_cert" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['ca_cert']));?></textarea>
-      <br>
-      Paste a CA certificate in X.509 PEM format here.</td>
-    </tr>
-               
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">Server certificate</td>
-      <td width="78%" class="vtable">
-        <textarea name="srv_cert" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['srv_cert']));?></textarea>
-        <br>
-        Paste a server certificate in X.509 PEM format here.</td>
-    </tr>
-     
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">Server key</td>
-      <td width="78%" class="vtable"> 
-        <textarea name="srv_key" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['srv_key']));?></textarea>
-        <br>Paste the server RSA private key here.</td>
-    </tr>
-      
-    <tr> 
-      <td width="22%" valign="top" class="vncellreq">DH parameters</td>
-      <td width="78%" class="vtable"> 
-       <textarea name="dh_param" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['dh_param']));?></textarea>
-       <br>          
-         Paste the Diffie-Hellman parameters in PEM format here.</td>
-    </tr>
-      
-    <tr>
-      <td width="22%" valign="top" class="vncell">Crypto</td>
-      <td width="78%" class="vtable">
-       <select name="crypto" class="formfld">
-         <?php $cipher_list = ovpn_get_cipher_list();
-               foreach($cipher_list as $key => $value){
-         ?>
-               <option value="<?= $key ?>" <?php if ($pconfig['crypto'] == $key) echo "selected"; ?>>
-               <?= $value ?>
-               </option>
-         <?php
-           }
-         ?>
-         </select>
-         <br>
-       Select a data channel encryption cipher.</td>
-    </tr>
-      
-    <tr>
-      <td width="22%" valign="top" class="vncell">TLS auth</td>
-      <td width="78%" class="vtable">
-       <input name="tlsauth" type="checkbox" value="yes" <?php if (isset($pconfig['tlsauth'])) echo "checked";?> onClick="enable_change(false)">
-       <strong>TLS auth</strong><br>
-       The tls-auth directive adds an additional HMAC signature to all SSL/TLS handshake packets for integrity verification.</td>
-    </tr>
-
-    <tr> 
-      <td width="22%" valign="top" class="vncell">Pre-shared secret</td>
-      <td width="78%" class="vtable">
-       <textarea name="pre-shared-key" id="psk" cols="65" rows="4" class="formpre"><?=htmlspecialchars(base64_decode($pconfig['pre-shared-key']));?></textarea>
-       <br>
-       Paste your own pre-shared secret here.</td>
-    </tr>
-
-    <tr>
-      <td width="22%" valign="top" class="vncell">Internal routing mode</td>
-      <td width="78%" class="vtable">
-       <input name="cli2cli" type="checkbox" value="yes" <?php if (isset($pconfig['cli2cli'])) echo "checked"; ?>>
-       <strong>Enable client-to-client routing</strong><br>
-       If this option is on, clients are allowed to talk to each other.</td>
-    </tr>
-      
-    <tr>
-      <td width="22%" valign="top" class="vncell">Client authentication</td>
-      <td width="78%" class="vtable">
-       <input name="dupcn" type="checkbox" value="yes" <?php if (isset($pconfig['dupcn'])) echo "checked"; ?>>
-        <strong>Permit duplicate client certificates</strong><br>
-       If this option is on, clients with duplicate certificates will not be disconnected.</td>
-    </tr>
-        
-    <tr>
-      <td width="22%" valign="top" class="vncell">Client-push options</td>
-      <td width="78%" class="vtable">
-           <table border="0" cellspacing="0" cellpadding="0">
-             <tr>
-            <td><input type="checkbox" name="psh_redir" value="yes" <?php if (isset($pconfig['psh_options']['redir'])) echo "checked"; ?>>
-            Redirect-gateway</td>
-            <td>&nbsp;</td>
-            <td><input type="checkbox" name="psh_redir_loc" value="yes" <?php if (isset($pconfig['psh_options']['redir_loc'])) echo "checked"; ?>>
-              Local</td>
-               </tr>
-          <tr>
-            <td><input type="checkbox" name="psh_rtedelay" value="yes" <?php if (isset($pconfig['psh_options']['rtedelay'])) echo "checked"; ?>> Route-delay</td>
-            <td width="16">&nbsp;</td>
-            <td><input type="text" name="psh_rtedelay_int" class="formfld" size="4" value="<?= $pconfig['psh_options']['rtedelay_int']?>"> seconds</td>
-          </tr>
-          <tr>
-            <td><input type="checkbox" name="psh_inact" value="yes" <?php if (isset($pconfig['psh_options']['inact'])) echo "checked"; ?>>
-    Inactive</td>
-            <td>&nbsp;</td>
-            <td><input type="text" name="psh_inact_int" class="formfld" size="4" value="<?= $pconfig['psh_options']['inact_int']?>">
-    seconds</td>
-          </tr>
-          <tr>
-            <td><input type="checkbox" name="psh_ping" value="yes" <?php if (isset($pconfig['psh_options']['ping'])) echo "checked"; ?>> Ping</td>
-            <td>&nbsp;</td>
-            <td>Interval: <input type="text" name="psh_ping_int" class="formfld" size="4" value="<?= $pconfig['psh_options']['ping_int']?>"> seconds</td>
-          </tr>
-          <tr>
-            <td><input type="checkbox" name="psh_pingexit" value="yes" <?php if (isset($pconfig['psh_options']['pingexit'])) echo "checked"; ?>> Ping-exit</td>
-            <td>&nbsp;</td>
-            <td>Interval: <input type="text" name="psh_pingexit_int" class="formfld" size="4" value="<?= $pconfig['psh_options']['pingexit_int']?>"> seconds</td>
-          </tr>
-          <tr>
-            <td><input type="checkbox" name="psh_pingrst" value="yes" <?php if (isset($pconfig['psh_options']['pingrst'])) echo "checked"; ?>> Ping-restart</td>
-            <td>&nbsp;</td>
-            <td>Interval: <input type="text" name="psh_pingrst_int" class="formfld" size="4" value="<?= $pconfig['psh_options']['pingrst_int']?>"> seconds</td>
-          </tr>
-        </table></td>
-    </tr>
-    <tr>
-      <td width="22%" valign="top">&nbsp;</td>
-      <td width="78%">
-        <input name="Submit" type="submit" class="formbtn" value="Save">
-        <input name="verb" type="hidden" value="<?=$pconfig['verb'];?>"> 
-        <?php if (isset($id)): ?>
-        <input name="id" type="hidden" value="<?=$id;?>"> 
-        <?php endif; ?>
-      </td>
-    </tr>
-    <tr>
-      <td width="22%" valign="top">&nbsp;</td>
-      <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
-        </strong></span>Changing any settings on this page will disconnect all clients!</span>
-      </td>
-    </tr>
-</table>
-</form>
-<script language="JavaScript">
-<!--
-type_change();
-enable_change(false);
-
-//-->
-</script>
-<?php include("fend.inc"); ?>