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()
if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= <<<EOD
local3.* {$log_directive}/var/log/vpn.log
!captiveportal
local4.* {$log_directive}/var/log/portalauth.log
local7.* {$log_directive}/var/log/dhcpd.log
*.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}/var/log/system.log
......
......@@ -161,6 +161,7 @@ class AccessController extends ApiControllerBase
}
if ($isAuthenticated) {
$this->getLogger("captiveportal")->info("AUTH " . $userName . " (".$clientIp.") zone " . $zoneid);
// when authenticated, we have $authServer available to request additional data if needed
$clientSession = $this->clientSession((string)$cpZone->zoneid);
if ($clientSession['clientState'] == 'AUTHORIZED') {
......@@ -202,6 +203,7 @@ class AccessController extends ApiControllerBase
}
}
} else {
$this->getLogger("captiveportal")->info("DENY " . $userName . " (".$clientIp.") zone " . $zoneid);
return array("clientState" => 'NOT_AUTHORIZED', "ipAddress" => $clientIp);
}
}
......@@ -236,6 +238,9 @@ class AccessController extends ApiControllerBase
);
$status = json_decode($statusRAW, true);
if ($status != null) {
$this->getLogger("captiveportal")->info(
"LOGOUT " . $clientSession['userName'] . " (".$this->getClientIp().") zone " . $zoneid
);
return $status;
}
}
......
......@@ -45,7 +45,7 @@ class CPBackgroundProcess(object):
"""
def __init__(self):
# 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')
# handles to ipfw, arp the config and the internal administration
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