mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Rename fail2ban syslog 'rainloop' to 'snappymail'
This commit is contained in:
parent
0a95e2c6dc
commit
98c6fa0675
|
@ -8,12 +8,12 @@ If you use other ports then http, https & 2096, modify them in /filter.d/*.conf
|
|||
|
||||
Upload the following to /etc/fail2ban/*
|
||||
|
||||
- /filter.d/rainloop-fpm-journal.conf
|
||||
- /jail.d/rainloop-fpm-journal.conf
|
||||
- /filter.d/snappymail-fpm-journal.conf
|
||||
- /jail.d/snappymail-fpm-journal.conf
|
||||
|
||||
Modify your /etc/fail2ban/jail.local with:
|
||||
|
||||
<code>[rainloop-fpm-journal]<br/>
|
||||
<code>[snappymail-fpm-journal]<br/>
|
||||
enabled = true</code>
|
||||
|
||||
## Default log (not recommended)
|
||||
|
@ -26,14 +26,14 @@ auth_logging_filename = "fail2ban/auth-fail.log"<br/>
|
|||
auth_logging_format = "[{date:Y-m-d H:i:s T}] Auth failed: ip={request:ip} user={imap:login} host={imap:host} port={imap:port}"
|
||||
</code>
|
||||
|
||||
Modify the path in /jail.d/rainloop-log.conf
|
||||
Modify the path in /jail.d/snappymail-log.conf
|
||||
|
||||
Upload the following to /etc/fail2ban/*
|
||||
|
||||
- /filter.d/rainloop-log.conf
|
||||
- /jail.d/rainloop-log.conf
|
||||
- /filter.d/snappymail-log.conf
|
||||
- /jail.d/snappymail-log.conf
|
||||
|
||||
Modify your /etc/fail2ban/jail.local with:
|
||||
|
||||
<code>[rainloop-log]<br/>
|
||||
<code>[snappymail-log]<br/>
|
||||
enabled = true</code>
|
||||
|
|
|
@ -5,4 +5,4 @@ failregex = Auth failed: ip=<HOST> user=.*$
|
|||
ignoreregex =
|
||||
_daemon = php-fpm
|
||||
journalmatch = _SYSTEMD_UNIT=php-fpm.service SYSLOG_FACILITY=10
|
||||
#journalmatch = _SYSTEMD_UNIT=php-fpm.service SYSLOG_FACILITY=10 SYSLOG_IDENTIFIER=rainloop PRIORITY=3
|
||||
#journalmatch = _SYSTEMD_UNIT=php-fpm.service SYSLOG_FACILITY=10 SYSLOG_IDENTIFIER=snappymail PRIORITY=3
|
|
@ -1,5 +0,0 @@
|
|||
[rainloop-fpm-journal]
|
||||
filter = rainloop-fpm-journal
|
||||
port = http,https,2096
|
||||
backend = systemd
|
||||
maxretry = 3
|
|
@ -1,5 +0,0 @@
|
|||
[rainloop-log]
|
||||
filter = rainloop-log
|
||||
port = http,https,2096
|
||||
logpath = /PATH-TO-RAINLOOP-DATA/_data_/_default_/logs/fail2ban/auth-fail.log
|
||||
maxretry = 3
|
5
fail2ban/jail.d/snappymail-fpm-journal.conf
Normal file
5
fail2ban/jail.d/snappymail-fpm-journal.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
[snappymail-fpm-journal]
|
||||
filter = snappymail-fpm-journal
|
||||
port = http,https,2096
|
||||
backend = systemd
|
||||
maxretry = 3
|
5
fail2ban/jail.d/snappymail-log.conf
Normal file
5
fail2ban/jail.d/snappymail-log.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
[snappymail-log]
|
||||
filter = snappymail-log
|
||||
port = http,https,2096
|
||||
logpath = /PATH-TO-SNAPPYMAIL-DATA/_data_/_default_/logs/fail2ban/auth-fail.log
|
||||
maxretry = 3
|
|
@ -46,7 +46,7 @@ class Syslog extends \MailSo\Log\Driver
|
|||
$mDesc = \implode($this->sNewLine, $mDesc);
|
||||
}
|
||||
|
||||
\openlog('rainloop', LOG_ODELAY, LOG_USER);
|
||||
\openlog('snappymail', LOG_ODELAY, LOG_USER);
|
||||
$result = \syslog($this->iLogLevel, $mDesc);
|
||||
\closelog();
|
||||
return $result;
|
||||
|
|
|
@ -958,7 +958,7 @@ class Actions
|
|||
{
|
||||
$this->LoggerAuth()->Write($this->compileLogParams($sLine, $oAccount, false, $aAdditionalParams));
|
||||
}
|
||||
if ($this->Config()->Get('logs', 'auth_logging', false) && \openlog('rainloop', 0, \LOG_AUTHPRIV))
|
||||
if ($this->Config()->Get('logs', 'auth_logging', false) && \openlog('snappymail', 0, \LOG_AUTHPRIV))
|
||||
{
|
||||
\syslog(\LOG_ERR, $this->compileLogParams('Auth failed: ip={request:ip} user={imap:login}', $oAccount, false, $aAdditionalParams));
|
||||
\closelog();
|
||||
|
|
|
@ -213,7 +213,7 @@ trait Admin
|
|||
$this->LoggerAuthHelper(null, $this->getAdditionalLogParamsByUserLogin($sLogin, true));
|
||||
if ($this->Config()->Get('logs', 'auth_logging', false)
|
||||
&& $this->Config()->Get('security', 'allow_admin_panel', true)
|
||||
&& \openlog('rainloop', 0, \LOG_AUTHPRIV))
|
||||
&& \openlog('snappymail', 0, \LOG_AUTHPRIV))
|
||||
{
|
||||
\syslog(\LOG_ERR, $this->compileLogParams('Admin Auth failed: ip={request:ip} user='.$sLogin));
|
||||
\closelog();
|
||||
|
|
Loading…
Reference in a new issue