mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added: write 'Auth failed' to syslog
This commit is contained in:
parent
693e0f4c10
commit
aa805f9ff9
2 changed files with 10 additions and 8 deletions
|
|
@ -24,15 +24,9 @@ class Syslog extends \MailSo\Log\Driver
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->iLogLevel = \defined('LOG_INFO') ? LOG_INFO : 6;
|
|
||||||
|
|
||||||
if (\function_exists('openlog') && \function_exists('closelog') && \defined('LOG_ODELAY') && \defined('LOG_USER'))
|
if (\function_exists('openlog') && \function_exists('closelog') && \defined('LOG_ODELAY') && \defined('LOG_USER'))
|
||||||
{
|
{
|
||||||
\openlog('rainloop', LOG_ODELAY, LOG_USER);
|
$this->iLogLevel = \defined('LOG_INFO') ? LOG_INFO : 6;
|
||||||
|
|
||||||
\register_shutdown_function(function () {
|
|
||||||
\closelog();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -52,7 +46,10 @@ class Syslog extends \MailSo\Log\Driver
|
||||||
$mDesc = \implode($this->sNewLine, $mDesc);
|
$mDesc = \implode($this->sNewLine, $mDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \syslog($this->iLogLevel, $mDesc);
|
\openlog('rainloop', LOG_ODELAY, LOG_USER);
|
||||||
|
$result = \syslog($this->iLogLevel, $mDesc);
|
||||||
|
\closelog();
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function clearImplementation() : bool
|
protected function clearImplementation() : bool
|
||||||
|
|
|
||||||
|
|
@ -984,6 +984,11 @@ class Actions
|
||||||
{
|
{
|
||||||
$this->LoggerAuth()->Write($this->compileLogParams($sLine, $oAccount, false, $aAdditionalParams));
|
$this->LoggerAuth()->Write($this->compileLogParams($sLine, $oAccount, false, $aAdditionalParams));
|
||||||
}
|
}
|
||||||
|
if ($this->Config()->Get('logs', 'auth_logging', false) && \openlog('rainloop', 0, \LOG_AUTHPRIV))
|
||||||
|
{
|
||||||
|
\syslog(\LOG_ERR, $this->compileLogParams('Auth failed: ip={request:ip} user={imap:login}', $oAccount, false, $aAdditionalParams));
|
||||||
|
\closelog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAdminToken() : string
|
private function getAdminToken() : string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue