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

41 files changed:
captiveportal/index.php
captiveportal/radius_accounting.inc
phpconf/inc/captiveportal.inc
phpconf/inc/system.inc
phpconf/inc/vpn.inc
phpconf/inc/xmlparse.inc
phpconf/rc.bootup
webgui/diag_ipsec_sad.php
webgui/diag_ipsec_spd.php
webgui/diag_logs_filter.php
webgui/diag_logs_settings.php
webgui/firewall_aliases.php
webgui/firewall_nat.php
webgui/firewall_nat_1to1.php
webgui/firewall_nat_out.php
webgui/firewall_nat_server.php
webgui/firewall_shaper.php
webgui/firewall_shaper_pipes.php
webgui/firewall_shaper_queues.php
webgui/guiconfig.inc
webgui/interfaces_vlan.php
webgui/license.php
webgui/services_captiveportal.php
webgui/services_captiveportal_ip.php
webgui/services_captiveportal_mac.php
webgui/services_captiveportal_users.php
webgui/services_dhcp.php
webgui/services_dnsmasq.php
webgui/services_proxyarp.php
webgui/services_wol.php
webgui/status_captiveportal.php
webgui/system_advanced.php
webgui/system_routes.php
webgui/vpn_ipsec.php
webgui/vpn_ipsec_ca.php [new file with mode: 0644]
webgui/vpn_ipsec_ca_edit.php [new file with mode: 0644]
webgui/vpn_ipsec_edit.php
webgui/vpn_ipsec_keys.php
webgui/vpn_ipsec_mobile.php
webgui/vpn_openvpn_cli.php
webgui/vpn_pptp_users.php

index 28cecd3e3e31d6714a8576ca0dbb7c5d2d0c34a4..7b08eb83e31426b64e03ba0ae0327711ec1e9807 100644 (file)
@@ -74,7 +74,7 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
                                                                                  $radiusservers[0]['key']);
                if ($auth_val == 2) {
                        captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"LOGIN");
-                       $sessionid = portal_allow($clientip, $clientmac, $_POST['auth_user']);
+                       $sessionid = portal_allow($clientip, $clientmac, $_POST['auth_user'], $_POST['auth_pass']);
                        if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
                                $auth_val = RADIUS_ACCOUNTING_START($_POST['auth_user'],
                                                                                                        $sessionid,
@@ -173,7 +173,7 @@ function portal_mac_fixed($clientmac) {
        return FALSE ;
 }      
 
-function portal_allow($clientip,$clientmac,$clientuser) {
+function portal_allow($clientip,$clientmac,$clientuser,$password = "") {
 
        global $orig_host, $orig_request, $g, $config;
 
@@ -245,7 +245,9 @@ function portal_allow($clientip,$clientmac,$clientuser) {
                        fwrite($fd, join(",", $cpent) . "\n");
                }
                /* write in this new entry */
-               fwrite($fd, time().",{$ruleno},{$clientip},{$clientmac},{$clientuser},{$sessionid}\n") ;
+               /* encode password in Base64 just in case it contains commas */
+               $bpassword = base64_encode($password);
+               fwrite($fd, time().",{$ruleno},{$clientip},{$clientmac},{$clientuser},{$sessionid},{$bpassword}\n") ;
                fclose($fd);
        }
        
index 4000fcc7d5d60b606a245bf1b2fe279196b07213..14264f6cf1c7be046614da2712d2d753c6b494a1 100644 (file)
@@ -135,7 +135,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) {
+function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$interimupdate=false) {
        $sharedsecret=$radiuskey ;
        # $debug = 1 ;
 
@@ -147,13 +147,13 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
 
        exec("/sbin/ipfw show {$ruleno}", $ipfw) ;      
        preg_match("/(\d+)\s+(\d+)\s+(\d+)\s+skipto/", $ipfw[0], $matches) ;
-       $output_pkts = $matches[2] ;
-       $output_bytes = $matches[3] ;
+       $input_pkts = $matches[2] ;
+       $input_bytes = $matches[3] ;
 
        unset($matches) ;
        preg_match("/(\d+)\s+(\d+)\s+(\d+)\s+skipto/", $ipfw[1], $matches) ;
-       $input_pkts = $matches[2] ;
-       $input_bytes = $matches[3] ;
+       $output_pkts = $matches[2] ;
+       $output_bytes = $matches[3] ;
 
        $fd = @fsockopen("udp://$radiusip",$radiusport,$errno,$errstr,3) ;
        if(!$fd) 
@@ -196,6 +196,11 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
 
                6;                      //Framed-IP-Address
 
+       if ($interimupdate)
+               $acctstatustype = 3;
+       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",
@@ -206,7 +211,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
            32,2+strlen($nasHostname[0]),$nasHostname[0],       // nasIdentifier
            5,6,0,0,0,0,                                                // nasPort
            61,6,0,0,0,15,                                              // nasPortType = Ethernet
-               40,6,0,0,0,2,                                           // Acct Status Type = Stop
+               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
@@ -234,7 +239,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
            32,2+strlen($nasHostname[0]),$nasHostname[0],       // nasIdentifier
            5,6,0,0,0,0,                                                // nasPort
            61,6,0,0,0,15,                                              // nasPortType = Ethernet
-               40,6,0,0,0,2,                                           // Acct Status Type = Stop
+               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
index d02363c29eea8c37aa2f08fde443a2465ed7af74..52e878d415e164fed4760f16b4b39db83092fe01 100644 (file)
@@ -36,6 +36,7 @@
        
 /* include all configuration functions */
 require_once("functions.inc");
+require_once("radius_authentication.inc");
 require_once("radius_accounting.inc") ;
 
 function captiveportal_configure() {
@@ -222,6 +223,7 @@ EOD;
                
        } else {
                killbypid("{$g['varrun_path']}/mini_httpd.cp.pid");
+               killbypid("{$g['varrun_path']}/mini_httpd.cps.pid");
                killbypid("{$g['varrun_path']}/minicron.pid");
 
                captiveportal_radius_stop_all();
@@ -324,7 +326,8 @@ EOD;
 }
 
 /* remove clients that have been around for longer than the specified amount of time */
-/* db file structure: timestamp,ipfw_rule_no,clientip,clientmac,username,sessionid */
+/* db file structure: timestamp,ipfw_rule_no,clientip,clientmac,username,sessionid,password */
+/* (password is in Base64 and only saved when reauthentication is enabled) */
 function captiveportal_prune_old() {
        
        global $g, $config;
@@ -340,7 +343,7 @@ function captiveportal_prune_old() {
        else
                $idletimeout = 0;
        
-       if (!$timeout && !$idletimeout)
+       if (!$timeout && !$idletimeout && !isset($config['captiveportal']['reauthenticate']))
                return;
        
        captiveportal_lock();
@@ -372,6 +375,55 @@ function captiveportal_prune_old() {
                        captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "TIMEOUT");
                        unset($cpdb[$i]);
                }
+               
+               /* do periodic RADIUS reauthentication? */
+               if (!$timedout && isset($config['captiveportal']['reauthenticate']) &&
+                       ($radiusservers !== false)) {
+               
+                       if (isset($config['captiveportal']['radacct_enable'])) {
+                               if ($config['captiveportal']['reauthenticateacct'] == "stopstart") {
+                                       /* stop and restart accounting */
+                                       RADIUS_ACCOUNTING_STOP($cpdb[$i][1], // ruleno
+                                                                                  $cpdb[$i][4], // username
+                                                                                  $cpdb[$i][5], // sessionid
+                                                                                  $cpdb[$i][0], // start time
+                                                                                  $radiusservers[0]['ipaddr'],
+                                                                                  $radiusservers[0]['acctport'],
+                                                                                  $radiusservers[0]['key'],
+                                                                                  $cpdb[$i][2]); //clientip
+                                       exec("/sbin/ipfw zero {$cpdb[$i][1]}");
+                                       RADIUS_ACCOUNTING_START($cpdb[$i][4],
+                                                                                       $cpdb[$i][5],
+                                                                                       $radiusservers[0]['ipaddr'],
+                                                                                       $radiusservers[0]['acctport'],
+                                                                                       $radiusservers[0]['key'],
+                                                                                       $cpdb[$i][2]);
+                               } else if ($config['captiveportal']['reauthenticateacct'] == "interimupdate") {
+                                       RADIUS_ACCOUNTING_STOP($cpdb[$i][1], // ruleno
+                                                                                  $cpdb[$i][4], // username
+                                                                                  $cpdb[$i][5], // sessionid
+                                                                                  $cpdb[$i][0], // start time
+                                                                                  $radiusservers[0]['ipaddr'],
+                                                                                  $radiusservers[0]['acctport'],
+                                                                                  $radiusservers[0]['key'],
+                                                                                  $cpdb[$i][2], //clientip
+                                                                                  true);
+                               }
+                       }
+               
+                       /* check this user against RADIUS again */
+                       $auth_val = RADIUS_AUTHENTICATION($cpdb[$i][4],
+                                                                                 base64_decode($cpdb[$i][6]),
+                                                                                 $radiusservers[0]['ipaddr'],
+                                                                                 $radiusservers[0]['port'],
+                                                                                 $radiusservers[0]['key']);
+                       
+                       if ($auth_val == 3) {
+                               captiveportal_disconnect($cpdb[$i], $radiusservers);
+                               captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "RADIUS_DISCONNECT");
+                               unset($cpdb[$i]);
+                       }
+               }
        }
        
        /* write database */
index 700e03936203ed9fab9f2867a9273e2df165414b..28b547239f1b9c6687bfd8cca336cc0449f0697d 100644 (file)
@@ -568,4 +568,14 @@ function system_set_harddisk_standby() {
        }
 }
 
+function system_polling_configure() {
+       global $config, $g;
+       
+       if (isset($config['system']['polling'])) {
+               mwexec("/sbin/sysctl kern.polling.enable=1");
+       } else {
+               mwexec("/sbin/sysctl kern.polling.enable=0");
+       }
+}
+
 ?>
index 8ce9373a2d5cf6ab99787af80e91e16922a91b77..b89f2392363b9a2e266a12189a06fdc4e2f99d91 100644 (file)
@@ -132,9 +132,34 @@ function vpn_ipsec_configure($ipchg = false) {
                        }
                                
                        $racoonconf = "path pre_shared_key \"{$g['varetc_path']}/psk.txt\";\n\n";
-                       
+                       $racoonconf .= "path certificate  \"{$g['varetc_path']}\";\n\n";
+                       
+                       /* generate CA certificates files */
+                       $cacertnum = 0;
+                       if (is_array($ipseccfg['cacert']) && count($ipseccfg['cacert']))
+                               foreach ($ipseccfg['cacert'] as $cacert) {
+                                       ++$cacertnum;
+                                       if (isset($cacert['cert'])) {
+                                               $cert = base64_decode($cacert['cert']);
+                                               $x509cert = openssl_x509_parse(openssl_x509_read($cert));
+                                               if(is_array($x509cert) && isset($x509cert['hash'])) {
+                                                       $fd1 = fopen("{$g['varetc_path']}/{$x509cert['hash']}.0", "w");
+                                                       if (!$fd1) {
+                                                               printf("Error: cannot open {$x509cert['hash']}.0 in vpn.\n");
+                                                               return 1;
+                                                       }
+                                                       chmod("{$g['varetc_path']}/{$x509cert['hash']}.0", 0600);
+                                                       fwrite($fd1, $cert);
+                                                       fclose($fd1);
+                                               }
+                                       }
+                               }
+                                               
+                       $tunnelnumber = 0;
                        if (is_array($ipseccfg['tunnel']) && count($ipseccfg['tunnel']))
                                foreach ($ipseccfg['tunnel'] as $tunnel) {
+                               
+                               ++$tunnelnumber;
                        
                                if (isset($tunnel['disabled']))
                                        continue;
@@ -158,11 +183,68 @@ function vpn_ipsec_configure($ipchg = false) {
                                        $myidentt = "user_fqdn";
                                        $myident = $tunnel['p1']['myident']['ufqdn'];
                                }
-                       
+                               
+                               if (isset($tunnel['p1']['authentication_method'])) {
+                                       $authmethod = $tunnel['p1']['authentication_method'];
+                               } else {$authmethod = 'pre_shared_key';}
+                               
+                               $certline = ''; 
+                               
+                               if ($authmethod == 'rsasig') {
+                                       if ($tunnel['p1']['cert'] && $tunnel['p1']['private-key']) {
+                                               $cert = base64_decode($tunnel['p1']['cert']);
+                                               $private_key = base64_decode($tunnel['p1']['private-key']);
+                                       } else {
+                                               /* null certificate/key */
+                                               $cert = '';
+                                               $private_key = '';
+                                       }
+                                       
+                                       if ($tunnel['p1']['peercert']) 
+                                               $peercert = base64_decode($tunnel['p1']['peercert']);
+                                       else 
+                                               $peercert = '';
+                                       
+                                       $fd1 = fopen("{$g['varetc_path']}/server{$tunnelnumber}-signed.pem", "w");
+                                       if (!$fd1) {
+                                               printf("Error: cannot open server{$tunnelnumber}-signed.pem in vpn.\n");
+                                               return 1;
+                                       }
+                                       chmod("{$g['varetc_path']}/server{$tunnelnumber}-signed.pem", 0600);
+                                       fwrite($fd1, $cert);
+                                       fclose($fd1);
+                                       
+                                       $fd1 = fopen("{$g['varetc_path']}/server{$tunnelnumber}-key.pem", "w");
+                                       if (!$fd1) {
+                                               printf("Error: cannot open server{$tunnelnumber}-key.pem in vpn.\n");
+                                               return 1;
+                                       }
+                                       chmod("{$g['varetc_path']}/server{$tunnelnumber}-key.pem", 0600);
+                                       fwrite($fd1, $private_key);
+                                       fclose($fd1);
+
+                                       $certline = "certificate_type x509 \"server{$tunnelnumber}-signed.pem\" \"server{$tunnelnumber}-key.pem\";";
+                                       
+                                       if ($peercert!=''){
+                                               $fd1 = fopen("{$g['varetc_path']}/peer{$tunnelnumber}-signed.pem", "w");
+                                               if (!$fd1) {
+                                                       printf("Error: cannot open server{$tunnelnumber}-signed.pem in vpn.\n");
+                                                       return 1;
+                                               }
+                                               chmod("{$g['varetc_path']}/peer{$tunnelnumber}-signed.pem", 0600);
+                                               fwrite($fd1, $peercert);
+                                               fclose($fd1);           
+                                               $certline .= <<<EOD
+                                               
+       peers_certfile "peer{$tunnelnumber}-signed.pem";
+EOD;
+                                       }                                       
+                               } 
                                $racoonconf .= <<<EOD
 remote {$tunnel['remote-gateway']} \{
        exchange_mode {$tunnel['p1']['mode']};
        my_identifier {$myidentt} "{$myident}";
+       {$certline}
        peers_identifier address {$tunnel['remote-gateway']};
        initial_contact on;
        support_proxy on;
@@ -171,7 +253,7 @@ remote {$tunnel['remote-gateway']} \{
        proposal \{
                encryption_algorithm {$tunnel['p1']['encryption-algorithm']};
                hash_algorithm {$tunnel['p1']['hash-algorithm']};
-               authentication_method pre_shared_key;
+               authentication_method {$authmethod};
                dh_group {$tunnel['p1']['dhgroup']};
 
 EOD;
@@ -223,11 +305,52 @@ EOD;
                                        $myidentt = "user_fqdn";
                                        $myident = $tunnel['p1']['myident']['ufqdn'];
                                }
-                       
+                               
+                               if (isset($tunnel['p1']['authentication_method'])) {
+                                       $authmethod = $tunnel['p1']['authentication_method'];
+                               } else {$authmethod = 'pre_shared_key';}
+                               
+                               $certline = '';                                 
+                               if ($authmethod == 'rsasig') {
+                                       if ($tunnel['p1']['cert'] && $tunnel['p1']['private-key']) {
+                                               $cert = base64_decode($tunnel['p1']['cert']);
+                                               $private_key = base64_decode($tunnel['p1']['private-key']);
+                                       } else {
+                                               /* null certificate/key */
+                                               $cert = '';
+                                               $private_key = '';
+                                       }
+                                       
+                                       if ($tunnel['p1']['peercert']) 
+                                               $peercert = base64_decode($tunnel['p1']['peercert']);
+                                       else 
+                                               $peercert = '';
+                                       
+                                       $fd1 = fopen("{$g['varetc_path']}/server-mobile{$tunnelnumber}-signed.pem", "w");
+                                       if (!$fd1) {
+                                               printf("Error: cannot open server-mobile{$tunnelnumber}-signed.pem in vpn.\n");
+                                               return 1;
+                                       }
+                                       chmod("{$g['varetc_path']}/server-mobile{$tunnelnumber}-signed.pem", 0600);
+                                       fwrite($fd1, $cert);
+                                       fclose($fd1);
+                                       
+                                       $fd1 = fopen("{$g['varetc_path']}/server-mobile{$tunnelnumber}-key.pem", "w");
+                                       if (!$fd1) {
+                                               printf("Error: cannot open server-mobile{$tunnelnumber}-key.pem in vpn.\n");
+                                               return 1;
+                                       }
+                                       chmod("{$g['varetc_path']}/server-mobile{$tunnelnumber}-key.pem", 0600);
+                                       fwrite($fd1, $private_key);
+                                       fclose($fd1);
+
+                                       $certline = "certificate_type x509 \"server-mobile{$tunnelnumber}-signed.pem\" \"server-mobile{$tunnelnumber}-key.pem\";";
+                               }
                                $racoonconf .= <<<EOD
 remote anonymous \{
        exchange_mode {$tunnel['p1']['mode']};
        my_identifier {$myidentt} "{$myident}";
+       {$certline}
        initial_contact on;
        passive on;
        generate_policy on;
@@ -237,7 +360,7 @@ remote anonymous \{
        proposal \{
                encryption_algorithm {$tunnel['p1']['encryption-algorithm']};
                hash_algorithm {$tunnel['p1']['hash-algorithm']};
-               authentication_method pre_shared_key;
+               authentication_method {$authmethod};
                dh_group {$tunnel['p1']['dhgroup']};
 
 EOD;
index cd85866926c9fac927f7b64f924014a3dca1c7af..4cb37a96712f219fb5127bef49eef466609f2ceb 100644 (file)
@@ -32,7 +32,7 @@
 /* tags that are always to be handled as lists */
 $listtags = explode(" ", "rule user key dnsserver winsserver " .
        "encryption-algorithm-option hash-algorithm-option hosts tunnel onetoone " .
-       "staticmap route alias pipe queue shellcmd earlyshellcmd mobilekey " .
+       "staticmap route alias pipe queue shellcmd cacert earlyshellcmd mobilekey " .
        "servernat proxyarpnet passthrumac allowedip wolentry vlan");
 
 function startElement($parser, $name, $attrs) {
index 10f2e632983dd8e1c5dcc0717e31b3faa5c61325..8a06cfbbedf6a24e843817f2aaa8b5a2adf3ec90 100644 (file)
@@ -70,6 +70,9 @@
        /* establish ipfilter ruleset */
        filter_configure();
        
+       /* set up device polling */
+       system_polling_configure();
+       
        /* configure loopback interface */
        interfaces_loopback_configure();
        
        /* run any shell commands specified in config.xml */
        system_do_shell_commands();
        
+       /* enable HD standby */
+       system_set_harddisk_standby();
+       
        /* done */
        unlink("{$g['varrun_path']}/booting");
 ?>
index 2b2b649b582ad4af6fbd43c41d1db62f903ccc97..45377be7897716849c49c3c7bd094267b379743f 100644 (file)
@@ -116,7 +116,7 @@ foreach ($sad as $sa): ?>
                        $args .= "&proto=" . rawurlencode($sa['proto']);
                        $args .= "&spi=" . rawurlencode("0x" . $sa['spi']);
                ?>
-                 <a href="diag_ipsec_sad.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security association?')"><img src="x.gif" width="17" height="17" border="0"></a>
+                 <a href="diag_ipsec_sad.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security association?')"><img src="x.gif" title="delete SA" width="17" height="17" border="0"></a>
                </td>
                                
        </tr>
index 48b2f34296a2fc3cff0317afd235bebcc32fd667..74db3997fa9c77edda9d3ace23d24fe0c3582de9 100644 (file)
@@ -118,7 +118,7 @@ foreach ($spd as $sp): ?>
                        $args .= "&dst=" . rawurlencode($sp['dst']);
                        $args .= "&dir=" . rawurlencode($sp['dir']);
                ?>
-                 <a href="diag_ipsec_spd.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security policy?')"><img src="x.gif" width="17" height="17" border="0"></a>
+                 <a href="diag_ipsec_spd.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security policy?')"><img src="x.gif" title="delete SP" width="17" height="17" border="0"></a>
                </td>
                                
        </tr>
index 2e827acdcf92bd4e42112e0d40a7413b4def3c69..e8d37ed81391d13b59cb3f4a10398dc07caff788 100644 (file)
 $pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
+$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IPv6 IGMP any");
+
 $nentries = $config['syslog']['nentries'];
+$resolve = $config['syslog']['resolve'];
+
 if (!$nentries)
        $nentries = 50;
 
@@ -40,6 +44,48 @@ if ($_POST['clear']) {
        exec("/usr/sbin/clog -i -s 262144 /var/log/filter.log");
 }
 
+
+if (isset($_GET['act']) && preg_match("/^[pb]+$/", $_GET['act'])) {
+       $action = $_GET['act'];
+       $ifstring  .= "&act=$action";
+       $srcstring .= "&act=$action";
+       $dststring .= "&act=$action";
+       $prstring  .= "&act=$action";
+}
+
+if (isset($_GET['if']) && ($_GET['if'] != "")) {
+       $iface = $_GET['if'];
+       $actstring .= "&if=$iface";
+       $srcstring .= "&if=$iface";
+       $dststring .= "&if=$iface";
+       $prstring  .= "&if=$iface";
+}
+
+if (isset($_GET['pr']) && in_array($_GET['pr'], $protocols)) {
+       $proto = $_GET['pr'];
+       $actstring .= "&pr=$proto";
+       $ifstring  .= "&pr=$proto";
+       $srcstring .= "&pr=$proto";
+       $dststring .= "&pr=$proto";
+}
+
+if (isset($_GET['sp']) && (is_numeric($_GET['sp']))) {
+       $srcport = $_GET['sp'];
+       $actstring .= "&sp=$srcport";
+       $ifstring  .= "&sp=$srcport";
+       $dststring .= "&sp=$srcport";
+       $prstring  .= "&sp=$srcport";
+}
+
+if (isset($_GET['dp']) && (is_numeric($_GET['dp']))) {
+       $dstport = $_GET['dp'];
+       $actstring .= "&dp=$dstport";
+       $ifstring  .= "&dp=$dstport";
+       $srcstring .= "&dp=$dstport";
+       $prstring  .= "&dp=$dstport";
+}
+
+
 function dump_clog($logfile, $tail, $withorig = true) {
        global $g, $config;
 
@@ -62,7 +108,7 @@ function dump_clog($logfile, $tail, $withorig = true) {
 }
 
 function conv_clog($logfile, $tail) {
-       global $g, $config;
+       global $g, $config, $iface, $action, $proto, $srcport, $dstport;
        
        /* make interface/port table */
        $iftable = array();
@@ -76,7 +122,7 @@ function conv_clog($logfile, $tail) {
        exec("/usr/sbin/clog " . $logfile . " | tail {$sor} -n " . $tail, $logarr);
        
        $filterlog = array();
-       
+
        foreach ($logarr as $logent) {
                $logent = preg_split("/\s+/", $logent, 6);
                $ipfa = explode(" ", $logent[5]);
@@ -89,40 +135,58 @@ function conv_clog($logfile, $tail) {
                        $flent['count'] = substr($ipfa[$i], 0, -1);
                        $i++;
                }
-               if ($iftable[$ipfa[$i]])
+               if (!isset($iface) || ($iftable[$ipfa[$i]] && strstr($iface, $iftable[$ipfa[$i]])))
                        $flent['interface'] = $iftable[$ipfa[$i]];
-               else
+               else if (!isset($iface) || strstr($iface, $ipfa[$i]))
                        $flent['interface'] = $ipfa[$i];
+               else continue;
                $i += 2;
-               $flent['act'] = $ipfa[$i];
+               if (!isset($action) || strstr($action, $ipfa[$i]))
+                       $flent['act'] = $ipfa[$i];
+               else continue; 
                $i++;
-               $flent['src'] = format_ipf_ip($ipfa[$i]);
+               list($flent['src'], $flent['srcport']) = format_ipf_ip($ipfa[$i],$srcport);
+               if (!isset($flent['src'])) continue;
                $i += 2;
-               $flent['dst'] = format_ipf_ip($ipfa[$i]);
+               list($flent['dst'], $flent['dstport']) = format_ipf_ip($ipfa[$i],$dstport);
+               if (!isset($flent['dst'])) continue;
                $i += 2;
-               $flent['proto'] = strtoupper($ipfa[$i]);
-               
+               $protocol = strtoupper($ipfa[$i]);
+               if (!isset($proto) || ($proto == $protocol))
+                       $flent['proto'] = $protocol;
+               else continue;
+               if (isset($resolve)) {
+                       $flent['dst'] = gethostbyaddr($flent['dst']);
+                       $flent['src'] = gethostbyaddr($flent['src']);
+               }
+               if ($protocol == "ICMP") {
+                       $i += 5;
+                       $flent['dst'] = $flent['dst'] . ", type " . $ipfa[$i];
+               }
                $filterlog[] = $flent;
        }
        
        return $filterlog;
 }
 
-function format_ipf_ip($ipfip) {
+function format_ipf_ip($ipfip,$uport) {
        list($ip,$port) = explode(",", $ipfip);
        if (!$port)
-               return $ip;
-       
-       return $ip . ", port " . $port;
-}
+               return array($ip, "");
+
+       if ($uport == "" || ($uport == $port))
+               return array($ip . ", port " . $port, $port);
 
+       return;
+}
 ?>
+
 <?php include("fbegin.inc"); ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabinact1"><a href="diag_logs.php">System</a></li>
-    <li class="tabact">Firewall</li>
+    <li class="tabact"><a href="diag_logs_filter.php" style="color:black" title="reset filter and reload firewall logs page">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
     <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
@@ -139,13 +203,21 @@ function format_ipf_ip($ipfip) {
                            Last <?=$nentries;?> firewall log entries</td>
                        </tr>
                        <tr>
-                         <td width="10%" class="listhdrr">Act</td>
+                         <td width="10%" class="listhdrr"><a href="?<?=substr($actstring, 1);?>" style="color:black" title="reset action and reload firewall logs page">Act</a></td>
                          <td width="20%" class="listhdrr">Time</td>
-                         <td width="10%" class="listhdrr">If</td>
-                         <td width="20%" class="listhdrr">Source</td>
-                         <td width="20%" class="listhdrr">Destination</td>
-                         <td width="10%" class="listhdrr">Proto</td>
-                       </tr><?php foreach ($filterlog as $filterent): ?>
+                         <td width="10%" class="listhdrr"><a href="?<?=substr($ifstring, 1);?>" style="color:black" title="reset interface and reload firewall logs page">If</a></td>
+                         <td width="20%" class="listhdrr"><a href="?<?=substr($srcstring, 1);?>" style="color:black" title="reset source port entry and reload firewall logs page">Source</a></td>
+                         <td width="20%" class="listhdrr"><a href="?<?=substr($dststring, 1);?>" style="color:black" title="reset destination port entry and reload firewall logs page">Destination</a></td>
+                         <td width="10%" class="listhdrr"><a href="?<?=substr($prstring, 1);?>" style="color:black" title="reset protocol entry and reload firewall logs page">Proto</a></td>
+                       </tr>
+       <?php
+       $actstring .= '">';
+       $ifstring  .= '" style="color:black" title="click to select interface">';
+       $srcstring .= '" style="color:black" title="click to select source port">';
+       $dststring .= '" style="color:black" title="click to select destination port">';
+       $prstring  .= '" style="color:black" title="click to select protocol">';
+       ?>
+                        <?php foreach ($filterlog as $filterent): ?>
                        <tr>
                          <td class="listlr" nowrap>
                          <?php if (strstr(strtolower($filterent['act']), "p"))
@@ -153,15 +225,33 @@ function format_ipf_ip($ipfip) {
                                         else 
                                                $img = "block.gif";
                                ?>
-                         <img src="<?=$img;?>" width="11" height="11" align="absmiddle">
+                         <a href="?act=<?=$filterent['act'];?><?=$actstring;?><img src="<?=$img;?>" width="11" height="11" align="absmiddle" border="0" title="click to select action"></a>
                          <?php if ($filterent['count']) echo $filterent['count'];?></td>
                          <td class="listr" nowrap><?=htmlspecialchars($filterent['time']);?></td>
-                         <td class="listr" nowrap><?=htmlspecialchars($filterent['interface']);?></td>
-                         <td class="listr" nowrap><?=htmlspecialchars($filterent['src']);?></td>
-                         <td class="listr" nowrap><?=htmlspecialchars($filterent['dst']);?></td>
-                         <td class="listr" nowrap><?=htmlspecialchars($filterent['proto']);?></td>
+                         <td class="listr" nowrap>
+                           <a href="?if=<?=$filterent['interface'];?><?=$ifstring;?><?=htmlspecialchars($filterent['interface']);?></a></td>
+                         <td class="listr" nowrap>
+                           <a href="?sp=<?=htmlspecialchars($filterent['srcport']);?><?=$srcstring;?><?=htmlspecialchars($filterent['src']);?></a></td>
+                         <td class="listr" nowrap>
+                           <a href="?dp=<?=htmlspecialchars($filterent['dstport']);?><?=$dststring;?><?=htmlspecialchars($filterent['dst']);?></a></td>
+                         <td class="listr" nowrap>
+                           <a href="?pr=<?=htmlspecialchars($filterent['proto']);?><?=$prstring;?><?=htmlspecialchars($filterent['proto']);?></a></td>
                        </tr><?php endforeach; ?>
                     </table>
+               <br><table width="100%" border="0" cellspacing="0" cellpadding="0">
+                      <tr> 
+                        <td width="100%"><strong><span class="red">Note:</span></strong><br>
+                          There are many possibilities to filter this log.
+                          Just click on the accept (<img src="pass.gif">) or
+                         deny symbol (<img src="block.gif">) to filter for
+                         accepted or denied IP packets. Do the same for the desired
+                         interface, source/destination port or protocol. To deselect
+                         a selected filter entry, click on the column description above.
+                          To reset all filter entries and reload the firewall logs page,
+                         click on the &quot;Firewall&quot; tab below &quot;Diagnostics: Logs&quot;.
+                        </td>
+                     </tr>
+               </table>
 <?php else: ?>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
index 69b724f3296d66b6e5f93f3fee11627bd6ee6d06..c60f5d09f4dc1d1a4e553d5d5570deba4d54dbbe 100644 (file)
@@ -43,6 +43,7 @@ $pconfig['system'] = isset($config['syslog']['system']);
 $pconfig['enable'] = isset($config['syslog']['enable']);
 $pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
 $pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
+$pconfig['resolve'] = isset($config['syslog']['resolve']);
 
 if (!$pconfig['nentries'])
        $pconfig['nentries'] = 50;
@@ -73,6 +74,7 @@ if ($_POST) {
                $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
                $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
                $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
+               $config['syslog']['resolve'] = $_POST['resolve'] ? true : false;
                
                write_config();
                
@@ -154,6 +156,13 @@ function enable_change(enable_over) {
                           <strong>Show raw filter logs</strong><br>
                           Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information. </td>
                       </tr>
+                      <tr> 
+                        <td valign="top" class="vtable">&nbsp;</td>
+                        <td class="vtable"> <input name="resolve" type="checkbox" id="resolve" value="yes" <?php if ($pconfig['resolve']) echo "checked"; ?>>
+                          <strong>Resolve IP addresses to hostnames</strong><br>
+                          Hint: If this is checked, IP addresses in firewall logs are resolved to real hostnames where possible.<br>
+                          Warning: This can cause a huge delay in loading the firewall log page!</td>
+                      </tr>
                       <tr> 
                         <td width="22%" valign="top" class="vtable">&nbsp;</td>
                         <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
index 1cda7c1f84126b41f570779a01e7bbc646c9ad8b..24294214241331f5c5b69e71c52f34012958df1a 100644 (file)
@@ -94,13 +94,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg">
                     <?=htmlspecialchars($alias['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="firewall_aliases_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="firewall_aliases.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this alias? All elements that still use it will become invalid (e.g. filter rules)!')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="firewall_aliases_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit alias" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="firewall_aliases.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this alias? All elements that still use it will become invalid (e.g. filter rules)!')"><img src="x.gif" title="delete alias" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="3"></td>
-                  <td class="list"> <a href="firewall_aliases_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="firewall_aliases_edit.php"><img src="plus.gif" title="add alias" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
             </form>
index cb5845ee3b4ae2ed831e3a2337f933278c67832c..9c084e25b2a25800fe2903e410ac389682483278 100644 (file)
@@ -141,13 +141,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg"> 
                     <?=htmlspecialchars($natent['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" class="list" nowrap> <a href="firewall_nat_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="firewall_nat.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this rule?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" class="list" nowrap> <a href="firewall_nat_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="firewall_nat.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this rule?')"><img src="x.gif" title="delete rule" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="6"></td>
-                  <td class="list"> <a href="firewall_nat_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="firewall_nat_edit.php"><img src="plus.gif" title="add rule" width="17" height="17" border="0"></a></td>
                                </tr>
               </table><br>
                     <span class="vexpl"><span class="red"><strong>Note:<br>
index a2dfde9765bc274dc996a064052329ef2bc2b504..9aa91d72661340873a3ba735031f8d9df51c54fa 100644 (file)
@@ -120,13 +120,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg"> 
                     <?=htmlspecialchars($natent['descr']);?>&nbsp;
                   </td>
-                  <td class="list" nowrap> <a href="firewall_nat_1to1_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="firewall_nat_1to1.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list" nowrap> <a href="firewall_nat_1to1_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit mapping" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="firewall_nat_1to1.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" title="delete mapping" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="4"></td>
-                  <td class="list"> <a href="firewall_nat_1to1_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="firewall_nat_1to1_edit.php"><img src="plus.gif" title="add mapping" width="17" height="17" border="0"></a></td>
                                </tr>
               </table><br>
                                <span class="vexpl"><span class="red"><strong>Note:<br>
index ce38a59f99d8d1180323d62eb06d0660942f3d30..c1fe4e5e04f627438078c4a352c0bb9dc6bbeb16 100644 (file)
@@ -156,13 +156,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg"> 
                     <?=htmlspecialchars($natent['descr']);?>&nbsp;
                   </td>
-                  <td class="list" nowrap> <a href="firewall_nat_out_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="firewall_nat_out.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list" nowrap> <a href="firewall_nat_out_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit mapping" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="firewall_nat_out.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" title="delete mapping" width="17" height="17" border="0"></a></td>
                 </tr>
               <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="5"></td>
-                  <td class="list"> <a href="firewall_nat_out_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="firewall_nat_out_edit.php"><img src="plus.gif" title="add mapping" width="17" height="17" border="0"></a></td>
                 </tr>
               </table>
 </td>
index e4d33c91f4d50e1a7d9159c9d2b0c711ef2685b9..9c0998fadd2bb7559aab0a7bd01b1dcd6f1d5b50 100644 (file)
@@ -115,13 +115,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg"> 
                     <?=htmlspecialchars($natent['descr']);?>&nbsp;
                   </td>
-                  <td class="list" nowrap> <a href="firewall_nat_server_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="firewall_nat_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list" nowrap> <a href="firewall_nat_server_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit entry" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="firewall_nat_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="x.gif" title="delete entry" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="2"></td>
-                  <td class="list"> <a href="firewall_nat_server_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="firewall_nat_server_edit.php"><img src="plus.gif" title="add entry" width="17" height="17" border="0"></a></td>
                                </tr>
               </table><br>
                                <span class="vexpl"><span class="red"><strong>Note:<br>
index 765d60b94ec75ed42158ece1ac1566448bc019ed..c5e48be5d44ef5120fcc5915307d9546833092e5 100644 (file)
@@ -224,7 +224,7 @@ if ($_GET['act'] == "del") {
                       <?php $i++; endforeach; ?>
                       <tr> 
                         <td class="list" colspan="6"></td>
-                        <td class="list"> <a href="firewall_shaper_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                        <td class="list"> <a href="firewall_shaper_edit.php"><img src="plus.gif" title="add rule" width="17" height="17" border="0"></a></td>
                       </tr>
                     </table>
                                          
index 322484e18fb727f19e96e50a1ffdbae974091abd..75aea79630c4af80ca60bef1f9c97fbe491c1275 100644 (file)
@@ -150,13 +150,13 @@ if ($_GET['act'] == "del") {
                         <td class="listbg"> 
                           <?=htmlspecialchars($pipe['descr']);?>
                           &nbsp; </td>
-                        <td valign="middle" nowrap class="list"> <a href="firewall_shaper_pipes_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a> 
-                          &nbsp;<a href="firewall_shaper_pipes.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pipe?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                        <td valign="middle" nowrap class="list"> <a href="firewall_shaper_pipes_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit pipe" width="17" height="17" border="0"></a> 
+                          &nbsp;<a href="firewall_shaper_pipes.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pipe?')"><img src="x.gif" title="delete pipe" width="17" height="17" border="0"></a></td>
                       </tr>
                       <?php $i++; endforeach; ?>
                       <tr> 
                         <td class="list" colspan="7"></td>
-                        <td class="list"> <a href="firewall_shaper_pipes_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                        <td class="list"> <a href="firewall_shaper_pipes_edit.php"><img src="plus.gif" title="add pipe" width="17" height="17" border="0"></a></td>
                       </tr>
                     </table><br>
                     <strong><span class="red">Note:</span></strong> a pipe can 
index c1ded3b5a0674a494b0241d43d7579596a86942b..11306d2fd040eda3e15a40db277f752dd8adff5e 100644 (file)
@@ -123,13 +123,13 @@ if ($_GET['act'] == "del") {
                         <td class="listbg"> 
                           <?=htmlspecialchars($queue['descr']);?>
                           &nbsp; </td>
-                        <td valign="middle" nowrap class="list"> <a href="firewall_shaper_queues_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a> 
-                          &nbsp;<a href="firewall_shaper_queues.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this queue?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                        <td valign="middle" nowrap class="list"> <a href="firewall_shaper_queues_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit queue" width="17" height="17" border="0"></a> 
+                          &nbsp;<a href="firewall_shaper_queues.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this queue?')"><img src="x.gif" title="delete queue" width="17" height="17" border="0"></a></td>
                       </tr>
                       <?php $i++; endforeach; ?>
                       <tr> 
                         <td class="list" colspan="5"></td>
-                        <td class="list"> <a href="firewall_shaper_queues_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                        <td class="list"> <a href="firewall_shaper_queues_edit.php"><img src="plus.gif" title="add queue" width="17" height="17" border="0"></a></td>
                       </tr>
                     </table><br>
                     <strong><span class="red">Note:</span></strong> a queue can 
index c46fea04829590654bb648cb9b270e19bc1b78f4..9764f45c9e0ae03829c5689f9d28141bcffb24d3 100644 (file)
@@ -99,6 +99,7 @@ $p1_ealgos = array('des' => 'DES', '3des' => '3DES', 'blowfish' => 'Blowfish',
 $p2_ealgos = array('des' => 'DES', '3des' => '3DES', 'blowfish' => 'Blowfish',
                                        'cast128' => 'CAST128', 'rijndael' => 'Rijndael (AES)');
 $p1_halgos = array('sha1' => 'SHA1', 'md5' => 'MD5');
+$p1_authentication_methods = array('pre_shared_key' => 'Pre-shared key', 'rsasig' => 'RSA signature');
 $p2_halgos = array('hmac_sha1' => 'SHA1', 'hmac_md5' => 'MD5');
 $p2_protos = array('esp' => 'ESP', 'ah' => 'AH');
 $p2_pfskeygroups = array('0' => 'off', '1' => '1', '2' => '2', '5' => '5');
@@ -434,4 +435,14 @@ function wol_sort() {
        usort($config['wol']['wolentry'], "wolcmp");
 }
 
+function ipsec_ca_sort() {
+       global $g, $config;
+
+       function ipseccacmp($a, $b) {
+               return strcmp($a['ident'], $b['ident']);
+       }
+
+       usort($config['ipsec']['cacert'], "ipseccacmp");
+}
+
 ?>
index 0b6991cb4ad08b06dd097ad10b61ac8e674ac30a..a896fc9e05ca01f86cb0baaf1eda9be596c827ee 100644 (file)
@@ -115,13 +115,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg">
                     <?=htmlspecialchars($vlan['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="interfaces_vlan_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="interfaces_vlan.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this VLAN?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="interfaces_vlan_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit VLAN" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="interfaces_vlan.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this VLAN?')"><img src="x.gif" title="delete VLAN" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="3">&nbsp;</td>
-                  <td class="list"> <a href="interfaces_vlan_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="interfaces_vlan_edit.php"><img src="plus.gif" title="add VLAN" width="17" height="17" border="0"></a></td>
                                </tr>
                                <tr>
                                <td colspan="3" class="list"><span class="vexpl"><span class="red"><strong>
index 762228d5065664ead9e657a6828844a8e7cc4ff3..616e01d5e3279348352810b3749e40c10a1e3f68 100644 (file)
@@ -80,6 +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</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>
@@ -122,7 +123,10 @@ require("guiconfig.inc");
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal local user database</font></em><br>
                          <br>
               Matt Juszczak (<a href="mailto:matt@atopia.net">matt@atopia.net</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal logging</font></em></p>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal logging</font></em><br>
+                         <br>
+              Enrique Maldonado (<a href="mailto:enrique@directemar.cl">enrique@directemar.cl</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">IPsec certificate support</font></em></p>
             <hr size="1">
             <p>m0n0wall is based upon/includes various free software packages, 
               listed below.<br>
index a25e997501662a87c8c7f7f8abafb5d9ae155b77..72332933f323c0053b295a4a3f09525b5c998fe3 100644 (file)
@@ -52,6 +52,8 @@ $pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
 $pconfig['enable'] = isset($config['captiveportal']['enable']);
 $pconfig['auth_method'] = $config['captiveportal']['auth_method'];
 $pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
+$pconfig['reauthenticate'] = isset($config['captiveportal']['reauthenticate']);
+$pconfig['reauthenticateacct'] = $config['captiveportal']['reauthenticateacct'];
 $pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
 $pconfig['httpsname'] = $config['captiveportal']['httpsname'];
 $pconfig['cert'] = base64_decode($config['captiveportal']['certificate']);
@@ -124,6 +126,8 @@ if ($_POST) {
                $config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
                $config['captiveportal']['auth_method'] = $_POST['auth_method'];
                $config['captiveportal']['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
+               $config['captiveportal']['reauthenticate'] = $_POST['reauthenticate'] ? true : false;
+               $config['captiveportal']['reauthenticateacct'] = $_POST['reauthenticateacct'];
                $config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
                $config['captiveportal']['httpsname'] = $_POST['httpsname'];
                $config['captiveportal']['certificate'] = base64_encode($_POST['cert']);
@@ -170,6 +174,8 @@ function enable_change(enable_change) {
        document.iform.radiuskey.disabled = endis;
        document.iform.radacct_enable.disabled = endis;
        document.iform.radiusacctport.disabled = endis;
+       document.iform.reauthenticate.disabled = endis;
+       document.iform.reauthenticateacct.disabled = endis;
        document.iform.auth_method[0].disabled = endis;
        document.iform.auth_method[1].disabled = endis;
        document.iform.auth_method[2].disabled = endis;
@@ -289,14 +295,25 @@ to access after they've authenticated.</td>
                </tr>
                <tr>
           <td>Accounting:&nbsp;&nbsp;</td>
-          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?>></td>
+          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?>>
+          send RADIUS accounting packets</td>
                  </tr>
                <tr>
           <td>Accounting port:&nbsp;&nbsp;</td>
           <td><input name="radiusacctport" type="text" class="formfld" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"></td>
-                 </tr></table>
+                 </tr>
+               <tr>
+          <td valign="top">Reauthentication:&nbsp;&nbsp;</td>
+          <td><input name="reauthenticate" type="checkbox" id="reauthenticate" value="yes" <?php if($pconfig['reauthenticate']) echo "checked"; ?>>
+          reauthenticate connected users every minute<br><br>
+          <input name="reauthenticateacct" type="radio" value="" <?php if(!$pconfig['reauthenticateacct']) echo "checked"; ?>> no accounting updates<br>
+          <input name="reauthenticateacct" type="radio" value="stopstart" <?php if($pconfig['reauthenticateacct'] == "stopstart") echo "checked"; ?>> stop/start accounting<br>
+          <input name="reauthenticateacct" type="radio" value="interimupdate" <?php if($pconfig['reauthenticateacct'] == "interimupdate") echo "checked"; ?>> interim update</td>
+                 </tr>
+               </table>
                <br>
        When using RADIUS authentication, enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against.  Leave port number blank to use the default port (1812). Leave the RADIUS shared secret blank to not use a RADIUS shared secret. RADIUS accounting packets will also be sent to the RADIUS server if  accounting is enabled (default port is 1813).
+       <br><br>If reauthentication is enabled, Access-Requests will be sent to the RADIUS server for each user that is logged in every minute. If an Access-Reject is received for a user, that user is disconnected from the captive portal immediately.
        </tr>
        <tr>
       <td valign="top" class="vncell">HTTPS login</td>
index 37da041fb0ca9fa65fac81ed7b8b88e22752ffe5..22664969ec51bec5094adf9b07d763bcf69e097e 100644 (file)
@@ -106,13 +106,13 @@ if ($_GET['act'] == "del") {
          <td class="listbg">
                <?=htmlspecialchars($ip['descr']);?>&nbsp;
          </td>
-         <td valign="middle" nowrap class="list"> <a href="services_captiveportal_ip_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                &nbsp;<a href="services_captiveportal_ip.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this address?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+         <td valign="middle" nowrap class="list"> <a href="services_captiveportal_ip_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit address" width="17" height="17" border="0"></a>
+                &nbsp;<a href="services_captiveportal_ip.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this address?')"><img src="x.gif" title="delete address" width="17" height="17" border="0"></a></td>
        </tr>
   <?php $i++; endforeach; ?>
        <tr> 
          <td class="list" colspan="2">&nbsp;</td>
-         <td class="list"> <a href="services_captiveportal_ip_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+         <td class="list"> <a href="services_captiveportal_ip_edit.php"><img src="plus.gif" title="add address" width="17" height="17" border="0"></a></td>
        </tr>
        <tr>
        <td colspan="2" class="list"><p class="vexpl"><span class="red"><strong>
index fec126228ad28de3dbfbb7a1f5eca29f96219f38..056b90fd0b10ce76143bf1c955bb700ad093cbc8 100644 (file)
@@ -100,13 +100,13 @@ if ($_GET['act'] == "del") {
          <td class="listbg">
                <?=htmlspecialchars($mac['descr']);?>&nbsp;
          </td>
-         <td valign="middle" nowrap class="list"> <a href="services_captiveportal_mac_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                &nbsp;<a href="services_captiveportal_mac.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this host?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+         <td valign="middle" nowrap class="list"> <a href="services_captiveportal_mac_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit host" width="17" height="17" border="0"></a>
+                &nbsp;<a href="services_captiveportal_mac.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this host?')"><img src="x.gif" title="delete host" width="17" height="17" border="0"></a></td>
        </tr>
   <?php $i++; endforeach; ?>
        <tr> 
          <td class="list" colspan="2">&nbsp;</td>
-         <td class="list"> <a href="services_captiveportal_mac_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+         <td class="list"> <a href="services_captiveportal_mac_edit.php"><img src="plus.gif" title="add host" width="17" height="17" border="0"></a></td>
        </tr>
        <tr>
        <td colspan="2" class="list"><span class="vexpl"><span class="red"><strong>
index e15c0dcaa191d521f2f0262e8e6af91467451f1f..78fcab2b1459ce414689588ceb9e15916c6248bc 100644 (file)
@@ -224,15 +224,15 @@ if($_GET['act']=="new" || $_GET['act']=="edit"){
                   <td class="listbg">
                     <?=$user['expirationdate']; ?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="services_captiveportal_users.php?act=edit&username=<?=$username; ?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="services_captiveportal_users.php?act=delete&username=<?=$username; ?>" onclick="return confirm('Do you really want to delete this User?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="services_captiveportal_users.php?act=edit&username=<?=$username; ?>"><img src="e.gif" title="edit user" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_captiveportal_users.php?act=delete&username=<?=$username; ?>" onclick="return confirm('Do you really want to delete this User?')"><img src="x.gif" title="delete user" width="17" height="17" border="0"></a></td>
                </tr>
 <?php
                }
        } ?>
        <tr> 
                          <td class="list" colspan="3"></td>
-                         <td class="list"> <a href="services_captiveportal_users.php?act=new"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                         <td class="list"> <a href="services_captiveportal_users.php?act=new"><img src="plus.gif" title="add user" width="17" height="17" border="0"></a></td>
                </tr>
  </table>
 <?php } ?>
index 9d60aeb73298c6a1acdb6edd04b55d0907262a19..4f1b60d025bd15ec2a6c130b8fa19c7b0f6a147f 100644 (file)
@@ -298,13 +298,13 @@ function enable_change(enable_over) {
                   <td class="listbg">
                     <?=htmlspecialchars($mapent['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="services_dhcp.php?if=<?=$if;?>&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="e.gif" title="edit mapping" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_dhcp.php?if=<?=$if;?>&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="x.gif" title="delete mapping" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="3"></td>
-                  <td class="list"> <a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add mapping" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
     </td>
index 231310dbab25ebf125b40473f24f1356d91b75a7..611342d38f2c57410e92cd832c313a9390faed87 100644 (file)
@@ -142,13 +142,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg">
                     <?=htmlspecialchars($hostent['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="services_dnsmasq_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="services_dnsmasq.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this host?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="services_dnsmasq_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit host" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_dnsmasq.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this host?')"><img src="x.gif" title="delete host" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="4"></td>
-                  <td class="list"> <a href="services_dnsmasq_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="services_dnsmasq_edit.php"><img src="plus.gif" title="add host" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
             </form>
index cbafef203cf888b3e079b774a1f67cd88b85de6f..13a3dad4d2444e7e9e36e0da3a375cb80287cdf4 100644 (file)
@@ -107,13 +107,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg">
                     <?=htmlspecialchars($arpent['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="services_proxyarp_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="services_proxyarp.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this network?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="services_proxyarp_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit network" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_proxyarp.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this network?')"><img src="x.gif" title="delete network" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="3"></td>
-                  <td class="list"> <a href="services_proxyarp_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="services_proxyarp_edit.php"><img src="plus.gif" title="add network" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
             </form>
index 6bd5bd9f0e20f6dd1a5af5fc048c6d465360e40d..abcb16ac708d9bb05258a25cc252dc57556efbc9 100644 (file)
@@ -140,13 +140,13 @@ Click the MAC address to wake up a computer. <br>
                   <td class="listbg">
                     <?=htmlspecialchars($wolent['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="services_wol_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="services_wol.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="services_wol_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit entry" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_wol.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="x.gif" title="delete entry" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="3"></td>
-                  <td class="list"> <a href="services_wol_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="services_wol_edit.php"><img src="plus.gif" title="add entry" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
 </form>
index 18b5ba4d2bcb547c225126fb09a1a44ae658797e..21cb03a80f21332bdf5b6220fd90c53482f40f0f 100644 (file)
@@ -56,7 +56,7 @@ if ($fp) {
                if ($line) {
                        $cpent = explode(",", $line);
                        if ($_GET['showact'])
-                               $cpent[4] = captiveportal_get_last_activity($cpent[1]);
+                               $cpent[7] = captiveportal_get_last_activity($cpent[1]);
                        $cpdb[] = $cpent;
                }
        }
@@ -68,8 +68,10 @@ if ($fp) {
                        $order = 2;
                else if ($_GET['order'] == "mac")
                        $order = 3;
-               else if ($_GET['order'] == "lastact")
+               else if ($_GET['order'] == "user")
                        $order = 4;
+               else if ($_GET['order'] == "lastact")
+                       $order = 7;
                else
                        $order = 0;
                usort($cpdb, "clientcmp");
@@ -81,12 +83,11 @@ captiveportal_unlock();
   <tr>
     <td class="listhdrr"><a href="?order=ip&showact=<?=$_GET['showact'];?>">IP address</a></td>
     <td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>">MAC address</a></td>
-       <?php if ($_GET['showact']): ?>
     <td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>">Session start</a></td>
-    <td class="listhdr"><a href="?order=lastact&showact=<?=$_GET['showact'];?>">Last activity</a></td>
-       <?php else: ?>
-    <td class="listhdr"><a href="?order=start&showact=<?=$_GET['showact'];?>">Session start</a></td>
+       <?php if ($_GET['showact']): ?>
+    <td class="listhdrr"><a href="?order=lastact&showact=<?=$_GET['showact'];?>">Last activity</a></td>
        <?php endif; ?>
+    <td class="listhdr"><a href="?order=user&showact=<?=$_GET['showact'];?>">Username</a></td>
     <td class="list"></td>
   </tr>
 <?php foreach ($cpdb as $cpent): ?>
@@ -95,10 +96,11 @@ captiveportal_unlock();
     <td class="listr"><?=$cpent[3];?>&nbsp;</td>
     <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
        <?php if ($_GET['showact']): ?>
-    <td class="listr"><?php if ($cpent[4]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[4]));?></td>
+    <td class="listr"><?php if ($cpent[7]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[7]));?></td>
        <?php endif; ?>
+    <td class="listr"><?=$cpent[4];?>&nbsp;</td>
        <td valign="middle" class="list" nowrap>
-       <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&id=<?=$cpent[1];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+       <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&id=<?=$cpent[1];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="x.gif" title="disconnect client" width="17" height="17" border="0"></a></td>
   </tr>
 <?php endforeach; ?>
 </table>
index 037a7dd0decfcfdee886dfaf539155056b588dfb..8b791dc000980fea01ec4080e877fd520374caa0 100644 (file)
@@ -46,6 +46,7 @@ $pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
 $pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
 $pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
 $pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
+$pconfig['polling_enable'] = isset($config['system']['polling']);
 
 if ($_POST) {
 
@@ -88,6 +89,7 @@ if ($_POST) {
                $config['filter']['tcpidletimeout'] = $_POST['tcpidletimeout'];
                $oldpreferoldsa = $config['ipsec']['preferoldsa'];
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
+               $config['system']['polling'] = $_POST['polling_enable'] ? true : false;
                        
                write_config();
                
@@ -112,6 +114,7 @@ if ($_POST) {
                        $retval |= interfaces_optional_configure();
                        if ($config['ipsec']['preferoldsa'] != $oldpreferoldsa)
                                $retval |= vpn_ipsec_configure();
+                       $retval |= system_polling_configure();
                        config_unlock();
                }
                $savemsg = get_std_save_message($retval);
@@ -277,6 +280,17 @@ function enable_change(enable_over) {
                                        By default, if several SAs match, the newest one is preferred if it's at least 30 seconds old.
                                        Select this option to always prefer old SAs over new ones.
                                        </td>
+                </tr>
+                               <tr> 
+                  <td width="22%" valign="top" class="vncell">Device polling</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
+                    <strong>Use device polling</strong><br>
+                                       Device polling is a technique that lets the system periodically poll network devices for new
+                                       data instead of relying on interrupts. This can reduce CPU load and therefore increase
+                                       throughput, at the expense of a slightly higher forwarding delay (the devices are polled 1000 times
+                                       per second). Not all NICs support polling; see the m0n0wall homepage for a list of supported cards.
+                                       </td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top">&nbsp;</td>
index d60a1110cadb7c2ccd4e3101d8299f1809c528f9..a6fb970e2982a498d881d8bd4834e8f71b2110f9 100644 (file)
@@ -102,13 +102,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg">
                     <?=htmlspecialchars($route['descr']);?>&nbsp;
                   </td>
-                  <td valign="middle" nowrap class="list"> <a href="system_routes_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="system_routes.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this route?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="system_routes_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit route" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="system_routes.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this route?')"><img src="x.gif" title="delete route" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="4"></td>
-                  <td class="list"> <a href="system_routes_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="system_routes_edit.php"><img src="plus.gif" title="add route" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
             </form>
index ee66c3acbbb47b85c1205ab431c9e86870592389..9a52898b8d55d138dee3435f7e2d286213cfca64 100644 (file)
@@ -95,6 +95,7 @@ if ($_GET['act'] == "del") {
     <li class="tabact">Tunnels</li>
     <li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
     <li class="tabinact"><a href="vpn_ipsec_keys.php">Pre-shared keys</a></li>
+    <li class="tabinact"><a href="vpn_ipsec_ca.php">CAs</a></li>
   </ul>
   </td></tr>
   <tr> 
@@ -164,13 +165,13 @@ if ($_GET['act'] == "del") {
                   <td class="listbg"><?=$spans;?>
                     <?=htmlspecialchars($ipsecent['descr']);?>&nbsp;
                   <?=$spane;?></td>
-                  <td valign="middle" nowrap class="list"> <a href="vpn_ipsec_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a> 
-                    &nbsp;<a href="vpn_ipsec.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this tunnel?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td valign="middle" nowrap class="list"> <a href="vpn_ipsec_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit tunnel" width="17" height="17" border="0"></a> 
+                    &nbsp;<a href="vpn_ipsec.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this tunnel?')"><img src="x.gif" title="delete tunnel" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="6"></td>
-                  <td class="list"> <a href="vpn_ipsec_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="vpn_ipsec_edit.php"><img src="plus.gif" title="add tunnel" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
                        </td>
diff --git a/webgui/vpn_ipsec_ca.php b/webgui/vpn_ipsec_ca.php
new file mode 100644 (file)
index 0000000..bb54ac7
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/local/bin/php
+<?php
+/*
+       vpn_ipsec_ca.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       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", "IPsec");
+require("guiconfig.inc");
+
+if (!is_array($config['ipsec']['cacert'])) {
+       $config['ipsec']['cacert'] = array();
+}
+ipsec_ca_sort();
+$a_secret = &$config['ipsec']['cacert'];
+
+if ($_GET['act'] == "del") {
+       if ($a_secret[$_GET['id']]) {
+               unset($a_secret[$_GET['id']]);
+               write_config();
+               touch($d_ipsecconfdirty_path);
+               header("Location: vpn_ipsec_ca.php");
+               exit;
+       }
+}
+
+?>
+<?php include("fbegin.inc"); ?>
+<form action="vpn_ipsec.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
+<?php print_info_box_np("The IPsec tunnel 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="tabinact"><a href="vpn_ipsec.php">Tunnels</a></li>
+    <li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
+    <li class="tabinact"><a href="vpn_ipsec_keys.php">Pre-shared keys</a></li>
+    <li class="tabact">CAs</li>
+  </ul>
+  </td></tr>
+  <tr> 
+    <td class="tabcont">
+              <table width="80%" border="0" cellpadding="0" cellspacing="0">
+                <tr> 
+                  <td class="listhdrr">Identifier</td>
+                  <td class="list"></td>
+                               </tr>
+                         <?php $i = 0; foreach ($a_secret as $secretent): ?>
+                <tr> 
+                  <td class="listlr">
+                    <?=htmlspecialchars($secretent['ident']);?>
+                  </td>
+                  <td class="list" nowrap> <a href="vpn_ipsec_ca_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit certificate" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="vpn_ipsec_ca.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this certificate?')"><img src="x.gif" title="delete certificate" width="17" height="17" border="0"></a></td>
+                               </tr>
+                         <?php $i++; endforeach; ?>
+                <tr> 
+                  <td class="list"></td>
+                  <td class="list"> <a href="vpn_ipsec_ca_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                               </tr>
+              </table>
+                        </td>
+                       </tr>
+               </table>
+</form>
+<?php include("fend.inc"); ?>
diff --git a/webgui/vpn_ipsec_ca_edit.php b/webgui/vpn_ipsec_ca_edit.php
new file mode 100644 (file)
index 0000000..687d340
--- /dev/null
@@ -0,0 +1,127 @@
+#!/usr/local/bin/php
+<?php
+/*
+       vpn_ipsec_ca_edit.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       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", "IPsec", "Edit CA certificate");
+require("guiconfig.inc");
+
+if (!is_array($config['ipsec']['cacert'])) {
+       $config['ipsec']['cacert'] = array();
+}
+ipsec_ca_sort();
+$a_secret = &$config['ipsec']['cacert'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+       $id = $_POST['id'];
+
+if (isset($id) && $a_secret[$id]) {
+       $pconfig['ident'] = $a_secret[$id]['ident'];
+       $pconfig['cert'] = base64_decode($a_secret[$id]['cert']);
+}
+
+if ($_POST) {
+       
+       unset($input_errors);
+       $pconfig = $_POST;
+
+       /* input validation */
+       $reqdfields = explode(" ", "ident cert");
+       $reqdfieldsn = explode(",", "Identifier,CA Certificate");
+       if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
+                       $input_errors[] = "This certificate does not appear to be valid.";
+       
+       do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+       
+       if (preg_match("/[^a-zA-Z0-9@\.\-]/", $_POST['ident']))
+               $input_errors[] = "The identifier contains invalid characters.";
+       
+       if (!$input_errors && !(isset($id) && $a_secret[$id])) {
+               /* make sure there are no dupes */
+               foreach ($a_secret as $secretent) {
+                       if ($secretent['ident'] == $_POST['ident']) {
+                               $input_errors[] = "Another entry with the same identifier already exists.";
+                               break;
+                       }
+               }
+       }
+
+       if (!$input_errors) {
+       
+               if (isset($id) && $a_secret[$id])
+                       $secretent = $a_secret[$id];
+       
+               $secretent['ident'] = $_POST['ident'];
+               $secretent['cert'] = base64_encode($_POST['cert']);
+               
+               if (isset($id) && $a_secret[$id])
+                       $a_secret[$id] = $secretent;
+               else
+                       $a_secret[] = $secretent;
+               
+               write_config();
+               touch($d_ipsecconfdirty_path);
+               
+               header("Location: vpn_ipsec_ca.php");
+               exit;
+       }
+}
+?>
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+            <form action="vpn_ipsec_ca_edit.php" method="post" name="iform" id="iform">
+              <table width="100%" border="0" cellpadding="6" cellspacing="0">
+                <tr> 
+                  <td valign="top" class="vncellreq">Identifier</td>
+                  <td class="vtable">
+ <input name="ident" type="text" class="formfld" id="ident" size="30" value="<?=$pconfig['ident'];?>">
+                    <br>
+This can be any text to describe the certificate authority.       
+                  </td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Certificate</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
+                    <br> 
+                    Paste a CA certificate in X.509 PEM format here.</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) && $a_secret[$id]): ?>
+                    <input name="id" type="hidden" value="<?=$id;?>">
+                    <?php endif; ?>
+                  </td>
+                </tr>
+              </table>
+</form>
+<?php include("fend.inc"); ?>
index 370c7f4ba565edb89555aac4e791b79f534c6295..3bd98bdc9fe30ac3c5925eb19ee88bb4b96f754e 100644 (file)
@@ -111,7 +111,11 @@ if (isset($id) && $a_ipsec[$id]) {
        $pconfig['p1halgo'] = $a_ipsec[$id]['p1']['hash-algorithm'];
        $pconfig['p1dhgroup'] = $a_ipsec[$id]['p1']['dhgroup'];
        $pconfig['p1lifetime'] = $a_ipsec[$id]['p1']['lifetime'];
+       $pconfig['p1authentication_method'] = $a_ipsec[$id]['p1']['authentication_method'];
        $pconfig['p1pskey'] = $a_ipsec[$id]['p1']['pre-shared-key'];
+       $pconfig['p1cert'] = base64_decode($a_ipsec[$id]['p1']['cert']);
+       $pconfig['p1peercert'] = base64_decode($a_ipsec[$id]['p1']['peercert']);
+       $pconfig['p1privatekey'] = base64_decode($a_ipsec[$id]['p1']['private-key']);
        $pconfig['p2proto'] = $a_ipsec[$id]['p2']['protocol'];
        $pconfig['p2ealgos'] = $a_ipsec[$id]['p2']['encryption-algorithm-option'];
        $pconfig['p2halgos'] = $a_ipsec[$id]['p2']['hash-algorithm-option'];
@@ -125,6 +129,7 @@ if (isset($id) && $a_ipsec[$id]) {
        $pconfig['localnet'] = "lan";
        $pconfig['p1mode'] = "aggressive";
        $pconfig['p1myidentt'] = "myaddress";
+       $pconfig['p1authentication_method'] = "pre_shared_key";
        $pconfig['p1ealgo'] = "3des";
        $pconfig['p1halgo'] = "sha1";
        $pconfig['p1dhgroup'] = "2";
@@ -147,8 +152,20 @@ if ($_POST) {
        $pconfig = $_POST;
 
        /* input validation */
-       $reqdfields = explode(" ", "localnet remotenet remotebits remotegw p1pskey p2ealgos p2halgos");
-       $reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,Pre-Shared Key,P2 Encryption Algorithms,P2 Hash Algorithms");
+       if ($_POST['p1authentication_method'] == "pre_shared_key") {
+               $reqdfields = explode(" ", "localnet remotenet remotebits remotegw p1pskey p2ealgos p2halgos");
+               $reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,Pre-Shared Key,P2 Encryption Algorithms,P2 Hash Algorithms");
+       }
+       else {
+               $reqdfields = explode(" ", "localnet remotenet remotebits remotegw p2ealgos p2halgos");
+               $reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,P2 Encryption Algorithms,P2 Hash Algorithms");     
+               if (!strstr($_POST['p1cert'], "BEGIN CERTIFICATE") || !strstr($_POST['p1cert'], "END CERTIFICATE"))
+                       $input_errors[] = "This certificate does not appear to be valid.";
+               if (!strstr($_POST['p1privatekey'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['p1privatekey'], "END RSA PRIVATE KEY"))
+                       $input_errors[] = "This key does not appear to be valid.";      
+               if ($_POST['p1peercert']!="" && (!strstr($_POST['p1peercert'], "BEGIN CERTIFICATE") || !strstr($_POST['p1peercert'], "END CERTIFICATE")))
+                       $input_errors[] = "This peer certificate does not appear to be valid."; 
+       }
        
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        
@@ -220,6 +237,10 @@ if ($_POST) {
                $ipsecent['p1']['dhgroup'] = $_POST['p1dhgroup'];
                $ipsecent['p1']['lifetime'] = $_POST['p1lifetime'];
                $ipsecent['p1']['pre-shared-key'] = $_POST['p1pskey'];
+               $ipsecent['p1']['private-key'] = base64_encode($_POST['p1privatekey']);
+               $ipsecent['p1']['cert'] = base64_encode($_POST['p1cert']);
+               $ipsecent['p1']['peercert'] = base64_encode($_POST['p1peercert']);
+               $ipsecent['p1']['authentication_method'] = $_POST['p1authentication_method'];
                $ipsecent['p2']['protocol'] = $_POST['p2proto'];
                $ipsecent['p2']['encryption-algorithm-option'] = $_POST['p2ealgos'];
                $ipsecent['p2']['hash-algorithm-option'] = $_POST['p2halgos'];
@@ -262,6 +283,22 @@ function typesel_change() {
                        break;
        }
 }
+function methodsel_change() {
+       switch (document.iform.p1authentication_method.selectedIndex) {
+               case 1: /* rsa */
+                       document.iform.p1pskey.disabled = 1;
+                       document.iform.p1privatekey.disabled = 0;
+                       document.iform.p1cert.disabled = 0;
+                       document.iform.p1peercert.disabled = 0;
+                       break;
+               default: /* pre-shared */
+                       document.iform.p1pskey.disabled = 0;
+                       document.iform.p1privatekey.disabled = 1;
+                       document.iform.p1cert.disabled = 1;
+                       document.iform.p1peercert.disabled = 1;
+                       break;
+       }
+}
 //-->
 </script>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
@@ -434,12 +471,46 @@ function typesel_change() {
                     <input name="p1lifetime" type="text" class="formfld" id="p1lifetime" size="20" value="<?=$pconfig['p1lifetime'];?>">
                     seconds</td>
                 </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Authentication method</td>
+                  <td width="78%" class="vtable">
+                                       <select name="p1authentication_method" class="formfld" onChange="methodsel_change()">
+                      <?php foreach ($p1_authentication_methods as $method => $methodname): ?>
+                      <option value="<?=$method;?>" <?php if ($method == $pconfig['p1authentication_method']) echo "selected"; ?>> 
+                      <?=htmlspecialchars($methodname);?>
+                      </option>
+                      <?php endforeach; ?>
+                    </select> <br> <span class="vexpl">Must match the setting 
+                    chosen on the remote side.</span></td>
+                </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Pre-Shared Key</td>
                   <td width="78%" class="vtable"> 
                     <?=$mandfldhtml;?><input name="p1pskey" type="text" class="formfld" id="p1pskey" size="40" value="<?=htmlspecialchars($pconfig['p1pskey']);?>"> 
                   </td>
                 </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Certificate</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="p1cert" cols="65" rows="7" id="p1cert" class="formpre"><?=htmlspecialchars($pconfig['p1cert']);?></textarea>
+                    <br> 
+                    Paste a certificate in X.509 PEM format here.</td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Key</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="p1privatekey" cols="65" rows="7" id="p1privatekey" class="formpre"><?=htmlspecialchars($pconfig['p1privatekey']);?></textarea>
+                    <br> 
+                    Paste an RSA private key in PEM format here.</td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncell">Peer certificate</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="p1peercert" cols="65" rows="7" id="p1peercert" class="formpre"><?=htmlspecialchars($pconfig['p1peercert']);?></textarea>
+                    <br> 
+                    Paste the peer X.509 certificate in PEM format here.<br>
+                    Leave this blank if you want to use a CA certificate for identity validation.</td>
+                </tr>
                 <tr> 
                   <td colspan="2" class="list" height="12"></td>
                 </tr>
@@ -514,6 +585,7 @@ function typesel_change() {
 <script language="JavaScript">
 <!--
 typesel_change();
+methodsel_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
index 75a50fa039966fadc1f5d18e81a09af6c9158661..676e569a56fd701217a70d52219c24d080c8e517 100644 (file)
@@ -62,6 +62,7 @@ if ($_GET['act'] == "del") {
     <li class="tabinact1"><a href="vpn_ipsec.php">Tunnels</a></li>
     <li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
     <li class="tabact">Pre-shared keys</li>
+    <li class="tabinact"><a href="vpn_ipsec_ca.php">CAs</a></li>
   </ul>
   </td></tr>
   <tr> 
@@ -80,13 +81,13 @@ if ($_GET['act'] == "del") {
                   <td class="listr">
                     <?=htmlspecialchars($secretent['pre-shared-key']);?>
                   </td>
-                  <td class="list" nowrap> <a href="vpn_ipsec_keys_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="vpn_ipsec_keys.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pre-shared key?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list" nowrap> <a href="vpn_ipsec_keys_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit key" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="vpn_ipsec_keys.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pre-shared key?')"><img src="x.gif" title="delete key" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="2"></td>
-                  <td class="list"> <a href="vpn_ipsec_keys_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="vpn_ipsec_keys_edit.php"><img src="plus.gif" title="add key" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
                         </td>
index dfd116d6b7cf1cf29249ccd92fff8cb9bac93ea4..0a1097751a65dbef03d0bd4249f6a3430fa1a64c 100644 (file)
@@ -44,6 +44,7 @@ if (count($a_ipsec) == 0) {
        $pconfig['p1ealgo'] = "3des";
        $pconfig['p1halgo'] = "sha1";
        $pconfig['p1dhgroup'] = "2";
+       $pconfig['p1authentication_method'] = "pre_shared_key";
        $pconfig['p2proto'] = "esp";
        $pconfig['p2ealgos'] = explode(",", "3des,blowfish,cast128,rijndael");
        $pconfig['p2halgos'] = explode(",", "hmac_sha1,hmac_md5");
@@ -69,6 +70,9 @@ if (count($a_ipsec) == 0) {
        $pconfig['p1halgo'] = $a_ipsec['p1']['hash-algorithm'];
        $pconfig['p1dhgroup'] = $a_ipsec['p1']['dhgroup'];
        $pconfig['p1lifetime'] = $a_ipsec['p1']['lifetime'];
+       $pconfig['p1authentication_method'] = $a_ipsec['p1']['authentication_method'];
+       $pconfig['p1cert'] = base64_decode($a_ipsec['p1']['cert']);
+       $pconfig['p1privatekey'] = base64_decode($a_ipsec['p1']['private-key']);
        $pconfig['p2proto'] = $a_ipsec['p2']['protocol'];
        $pconfig['p2ealgos'] = $a_ipsec['p2']['encryption-algorithm-option'];
        $pconfig['p2halgos'] = $a_ipsec['p2']['hash-algorithm-option'];
@@ -86,6 +90,13 @@ if ($_POST) {
        
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        
+       if ($_POST['p1authentication_method']== "rsasig") {
+               if (!strstr($_POST['p1cert'], "BEGIN CERTIFICATE") || !strstr($_POST['p1cert'], "END CERTIFICATE"))
+                       $input_errors[] = "This certificate does not appear to be valid.";
+               if (!strstr($_POST['p1privatekey'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['p1privatekey'], "END RSA PRIVATE KEY"))
+                       $input_errors[] = "This key does not appear to be valid.";      
+       }
+       
        if (($_POST['p1lifetime'] && !is_numeric($_POST['p1lifetime']))) {
                $input_errors[] = "The P1 lifetime must be an integer.";
        }
@@ -132,6 +143,9 @@ if ($_POST) {
                $ipsecent['p1']['hash-algorithm'] = $_POST['p1halgo'];
                $ipsecent['p1']['dhgroup'] = $_POST['p1dhgroup'];
                $ipsecent['p1']['lifetime'] = $_POST['p1lifetime'];
+               $ipsecent['p1']['private-key'] = base64_encode($_POST['p1privatekey']);
+               $ipsecent['p1']['cert'] = base64_encode($_POST['p1cert']);
+               $ipsecent['p1']['authentication_method'] = $_POST['p1authentication_method'];
                $ipsecent['p2']['protocol'] = $_POST['p2proto'];
                $ipsecent['p2']['encryption-algorithm-option'] = $_POST['p2ealgos'];
                $ipsecent['p2']['hash-algorithm-option'] = $_POST['p2halgos'];
@@ -149,6 +163,22 @@ if ($_POST) {
 }
 ?>
 <?php include("fbegin.inc"); ?>
+<script language="JavaScript">
+<!--
+function methodsel_change() {
+       switch (document.iform.p1authentication_method.selectedIndex) {
+               case 1: /* rsa */
+                       document.iform.p1privatekey.disabled = 0;
+                       document.iform.p1cert.disabled = 0;
+                       break;
+               default: /* pre-shared */
+                       document.iform.p1privatekey.disabled = 1;
+                       document.iform.p1cert.disabled = 1;
+                       break;
+       }
+}
+//-->
+</script>
 <form action="vpn_ipsec.php" method="post">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
@@ -163,6 +193,7 @@ if ($_POST) {
     <li class="tabinact1"><a href="vpn_ipsec.php">Tunnels</a></li>
     <li class="tabact">Mobile clients</li>
     <li class="tabinact"><a href="vpn_ipsec_keys.php">Pre-shared keys</a></li>
+    <li class="tabinact"><a href="vpn_ipsec_ca.php">CAs</a></li>
   </ul>
   </td></tr>
   <tr> 
@@ -245,6 +276,32 @@ if ($_POST) {
                     <input name="p1lifetime" type="text" class="formfld" id="p1lifetime" size="20" value="<?=$pconfig['p1lifetime'];?>">
                     seconds</td>
                 </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Authentication method</td>
+                  <td width="78%" class="vtable">
+                                       <select name="p1authentication_method" class="formfld" onChange="methodsel_change()">
+                      <?php foreach ($p1_authentication_methods as $method => $methodname): ?>
+                      <option value="<?=$method;?>" <?php if ($method == $pconfig['p1authentication_method']) echo "selected"; ?>> 
+                      <?=htmlspecialchars($methodname);?>
+                      </option>
+                      <?php endforeach; ?>
+                    </select> <br> <span class="vexpl">Must match the setting 
+                    chosen on the remote side. </span></td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Certificate</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="p1cert" cols="65" rows="7" id="p1cert" class="formpre"><?=htmlspecialchars($pconfig['p1cert']);?></textarea>
+                    <br> 
+                    Paste a certificate in X.509 PEM format here.</td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Key</td>
+                  <td width="78%" class="vtable"> 
+                    <textarea name="p1privatekey" cols="65" rows="7" id="p1privatekey" class="formpre"><?=htmlspecialchars($pconfig['p1privatekey']);?></textarea>
+                    <br> 
+                    Paste an RSA private key in PEM format here.</td>
+                </tr>
                 <tr> 
                   <td colspan="2" class="list" height="12"></td>
                 </tr>
@@ -316,4 +373,9 @@ if ($_POST) {
                        </tr>
                </table>
 </form>
+<script language="JavaScript">
+<!--
+methodsel_change();
+//-->
+</script>
 <?php include("fend.inc"); ?>
index d022630eae4dc7f048a44163a65b5ed8b6cafa56..229006782be6682d58fbd0c37337e82d438f001f 100644 (file)
@@ -121,13 +121,13 @@ if ($_GET['act'] == "del") {
           <td class="listbg"><?=$spans;?>
                <?= $client['descr'];?>
          <?=$spane;?></td>
-         <td valign="middle" nowrap class="list"> <a href="vpn_openvpn_cli_edit.php?id=<?=$i;?>"><img src="e.gif" 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" width="17" height="17" border="0"></a></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="4">&nbsp;</td>
-         <td class="list"> <a href="vpn_openvpn_cli_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></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>
index 5b6d9dacd0ce5e448a5e4cdde76a7a4ee1dcbae2..2e4c47a72e95f865273ab50a618900401c874841 100644 (file)
@@ -99,13 +99,13 @@ if ($_GET['act'] == "del") {
                   <td class="listr">
                     <?=htmlspecialchars($secretent['ip']);?>&nbsp;
                   </td>
-                  <td class="list" nowrap> <a href="vpn_pptp_users_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
-                     &nbsp;<a href="vpn_pptp_users.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this user?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list" nowrap> <a href="vpn_pptp_users_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit user" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="vpn_pptp_users.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this user?')"><img src="x.gif" title="delete user" width="17" height="17" border="0"></a></td>
                                </tr>
                          <?php $i++; endforeach; ?>
                 <tr> 
                   <td class="list" colspan="2"></td>
-                  <td class="list"> <a href="vpn_pptp_users_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+                  <td class="list"> <a href="vpn_pptp_users_edit.php"><img src="plus.gif" title="add user" width="17" height="17" border="0"></a></td>
                                </tr>
               </table>
                        </td>