Commit d49d6b0e authored by Franco Fichtner's avatar Franco Fichtner

captive portal: backported logging fixes from master

parent 05dc4630
...@@ -844,6 +844,7 @@ function system_syslogd_start() ...@@ -844,6 +844,7 @@ function system_syslogd_start()
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= <<<EOD $syslogconf .= <<<EOD
local3.* {$log_directive}/var/log/vpn.log local3.* {$log_directive}/var/log/vpn.log
!captiveportal
local4.* {$log_directive}/var/log/portalauth.log local4.* {$log_directive}/var/log/portalauth.log
local7.* {$log_directive}/var/log/dhcpd.log local7.* {$log_directive}/var/log/dhcpd.log
*.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}/var/log/system.log *.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}/var/log/system.log
......
...@@ -161,6 +161,7 @@ class AccessController extends ApiControllerBase ...@@ -161,6 +161,7 @@ class AccessController extends ApiControllerBase
} }
if ($isAuthenticated) { if ($isAuthenticated) {
$this->getLogger("captiveportal")->info("AUTH " . $userName . " (".$clientIp.") zone " . $zoneid);
// when authenticated, we have $authServer available to request additional data if needed // when authenticated, we have $authServer available to request additional data if needed
$clientSession = $this->clientSession((string)$cpZone->zoneid); $clientSession = $this->clientSession((string)$cpZone->zoneid);
if ($clientSession['clientState'] == 'AUTHORIZED') { if ($clientSession['clientState'] == 'AUTHORIZED') {
...@@ -202,6 +203,7 @@ class AccessController extends ApiControllerBase ...@@ -202,6 +203,7 @@ class AccessController extends ApiControllerBase
} }
} }
} else { } else {
$this->getLogger("captiveportal")->info("DENY " . $userName . " (".$clientIp.") zone " . $zoneid);
return array("clientState" => 'NOT_AUTHORIZED', "ipAddress" => $clientIp); return array("clientState" => 'NOT_AUTHORIZED', "ipAddress" => $clientIp);
} }
} }
...@@ -236,6 +238,9 @@ class AccessController extends ApiControllerBase ...@@ -236,6 +238,9 @@ class AccessController extends ApiControllerBase
); );
$status = json_decode($statusRAW, true); $status = json_decode($statusRAW, true);
if ($status != null) { if ($status != null) {
$this->getLogger("captiveportal")->info(
"LOGOUT " . $clientSession['userName'] . " (".$this->getClientIp().") zone " . $zoneid
);
return $status; return $status;
} }
} }
......
...@@ -45,7 +45,7 @@ class CPBackgroundProcess(object): ...@@ -45,7 +45,7 @@ class CPBackgroundProcess(object):
""" """
def __init__(self): def __init__(self):
# open syslog and notice startup # open syslog and notice startup
syslog.openlog('captiveportal', logoption=syslog.LOG_DAEMON) syslog.openlog('captiveportal', logoption=syslog.LOG_DAEMON, facility=syslog.LOG_LOCAL4)
syslog.syslog(syslog.LOG_NOTICE, 'starting captiveportal background process') syslog.syslog(syslog.LOG_NOTICE, 'starting captiveportal background process')
# handles to ipfw, arp the config and the internal administration # handles to ipfw, arp the config and the internal administration
self.ipfw = IPFW() self.ipfw = IPFW()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment