commit 3f2b92d27424b7ae495a3e07d763ebc7d4c81122
Author: Scott Ullrich <sullrich@pfsense.org>
Date:   Wed Nov 17 17:59:56 2004 +0000

    Add captive portal logging.
    
    Patch-submitted-to-m0n0wall-list-by:    Matt Juszczak <matt_AT_atopia.net>

diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index d2c0b33070..d2c76c9851 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -195,8 +195,9 @@ function system_syslogd_start() {
 		$syslogconf = <<<EOD
 local0.*					%/var/log/filter.log
 local3.*					%/var/log/vpn.log
+local4.*					%/var/log/portalauth.log
 local7.*					%/var/log/dhcpd.log
-*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local7.none %/var/log/system.log
+*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local4.none;local7.none %/var/log/system.log
 security.*					%/var/log/system.log
 auth.info;authpriv.info;daemon.info		%/var/log/system.log
 *.emerg						*
@@ -213,20 +214,26 @@ EOD;
 		if (isset($syslogcfg['vpn'])) {
 			$syslogconf .= <<<EOD
 local3.*					@{$syslogcfg['remoteserver']}
+EOD;
+		}
+
 
+		if (isset($syslogcfg['portalauth'])) {
+			$syslogconf .= <<<EOD
+local4.*					@{$syslogcfg['remoteserver']}
 EOD;
 		}
 
+
 		if (isset($syslogcfg['dhcp'])) {
 			$syslogconf .= <<<EOD
 local7.*					@{$syslogcfg['remoteserver']}
-
 EOD;
 		}
 
 		if (isset($syslogcfg['system'])) {
 			$syslogconf .= <<<EOD
-*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local7.none @{$syslogcfg['remoteserver']}
+*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local4.none;local7.none @{$syslogcfg['remoteserver']}
 security.*					@{$syslogcfg['remoteserver']}
 auth.info;authpriv.info;daemon.info		@{$syslogcfg['remoteserver']}
 *.emerg						@{$syslogcfg['remoteserver']}
diff --git a/etc/rc b/etc/rc
index 6822844145..882602e53c 100755
--- a/etc/rc
+++ b/etc/rc
@@ -35,7 +35,8 @@ clog -i -s 262144 /var/log/system.log
 clog -i -s 262144 /var/log/filter.log
 clog -i -s 32768 /var/log/dhcpd.log
 clog -i -s 32768 /var/log/vpn.log
-chmod 0600 /var/log/system.log /var/log/filter.log /var/log/dhcpd.log /var/log/vpn.log
+clog -i -s 32768 /var/log/portalauth.log
+chmod 0600 /var/log/system.log /var/log/filter.log /var/log/dhcpd.log /var/log/vpn.log /var/log/portalauth.log
 
 adjkerntz -i
 
diff --git a/etc/syslog.conf b/etc/syslog.conf
index 6b7fbd9603..9d102f37ae 100644
--- a/etc/syslog.conf
+++ b/etc/syslog.conf
@@ -1,7 +1,8 @@
 local0.*					%/var/log/filter.log
 local3.*					%/var/log/vpn.log
+local4.*					%/var/log/portalauth.log
 local7.*					%/var/log/dhcpd.log
-*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local7.none	%/var/log/system.log
+*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local4.none;local7.none	%/var/log/system.log
 security.*					%/var/log/system.log
 auth.info;authpriv.info;daemon.info		%/var/log/system.log
 *.emerg						*
diff --git a/etc/version b/etc/version
index 5b526c0625..ef10c3acfd 100644
--- a/etc/version
+++ b/etc/version
@@ -1 +1 @@
-1.2b2
+1.2b2-STOCKTON
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index c264625961..af1e1bc162 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -34,6 +34,7 @@ require("util.inc");
 require("config.inc");
 require("radius_authentication.inc") ;
 require("radius_accounting.inc") ;
+require("portal_log.inc") ;
 
 header("Expires: 0");
 header("Cache-Control: no-store, no-cache, must-revalidate");
@@ -73,6 +74,7 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
 							  			  $radiusservers[0]['port'],
 							  			  $radiusservers[0]['key']);
 		if ($auth_val == 2) {
+			captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,TRUE);
 			$sessionid = portal_allow($clientip, $clientmac, $_POST['auth_user']);
 			if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
 				$auth_val = RADIUS_ACCOUNTING_START($_POST['auth_user'],
@@ -82,6 +84,7 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
 													$radiusservers[0]['key']);
 			}
 		} else {
+			captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,FALSE);
 			readfile("{$g['varetc_path']}/captiveportal-error.html");
 		}
 	} else {
diff --git a/usr/local/www/diag_logs.php b/usr/local/www/diag_logs.php
index fe4d41a6fa..5be7a17ab3 100755
--- a/usr/local/www/diag_logs.php
+++ b/usr/local/www/diag_logs.php
@@ -78,6 +78,7 @@ function dump_clog($logfile, $tail, $withorig = true) {
 	<li class="tabact">System</li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
diff --git a/usr/local/www/diag_logs_dhcp.php b/usr/local/www/diag_logs_dhcp.php
index ba13ee3f0c..088a02d956 100755
--- a/usr/local/www/diag_logs_dhcp.php
+++ b/usr/local/www/diag_logs_dhcp.php
@@ -78,6 +78,7 @@ function dump_clog($logfile, $tail, $withorig = true) {
     <li class="tabinact"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabact">DHCP</li>
+    <li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index 05c37139c1..fe0eaa55db 100755
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -135,6 +135,7 @@ function format_ipf_ip($ipfip) {
     <li class="tabinact"><a href="diag_logs.php">System</a></li>
     <li class="tabact">Firewall</li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php
index 7868c56111..740e450c5b 100755
--- a/usr/local/www/diag_logs_settings.php
+++ b/usr/local/www/diag_logs_settings.php
@@ -36,6 +36,7 @@ $pconfig['nentries'] = $config['syslog']['nentries'];
 $pconfig['remoteserver'] = $config['syslog']['remoteserver'];
 $pconfig['filter'] = isset($config['syslog']['filter']);
 $pconfig['dhcp'] = isset($config['syslog']['dhcp']);
+$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
 $pconfig['vpn'] = isset($config['syslog']['vpn']);
 $pconfig['system'] = isset($config['syslog']['system']);
 $pconfig['enable'] = isset($config['syslog']['enable']);
@@ -64,6 +65,7 @@ if ($_POST) {
 		$config['syslog']['remoteserver'] = $_POST['remoteserver'];
 		$config['syslog']['filter'] = $_POST['filter'] ? true : false;
 		$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
+		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
 		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
 		$config['syslog']['system'] = $_POST['system'] ? true : false;
 		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
@@ -99,12 +101,14 @@ function enable_change(enable_over) {
 		document.iform.remoteserver.disabled = 0;
 		document.iform.filter.disabled = 0;
 		document.iform.dhcp.disabled = 0;
+		document.iform.portalauth.disabled = 0;
 		document.iform.vpn.disabled = 0;
 		document.iform.system.disabled = 0;
 	} else {
 		document.iform.remoteserver.disabled = 1;
 		document.iform.filter.disabled = 1;
 		document.iform.dhcp.disabled = 1;
+		document.iform.portalauth.disabled = 1;
 		document.iform.vpn.disabled = 1;
 		document.iform.system.disabled = 1;
 	}
@@ -125,6 +129,7 @@ function enable_change(enable_over) {
     <li class="tabinact"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabact">Settings</li>
   </ul>
@@ -171,7 +176,8 @@ function enable_change(enable_over) {
                           IP address of remote syslog server<br> <br> <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
                           system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
                           firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
-                          DHCP service events<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
+                          DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
+                          Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
                           PPTP VPN events</td>
                       </tr>
                       <tr> 
diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php
index 3ed561cfba..7e315b581d 100755
--- a/usr/local/www/diag_logs_vpn.php
+++ b/usr/local/www/diag_logs_vpn.php
@@ -82,6 +82,7 @@ function dump_clog($logfile, $tail) {
     <li class="tabinact"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
     <li class="tabact">PPTP VPN</li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
