• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Fail2ban for Mailservices

Janko1000

Regular Pleskian
Hi,

i use Fail2ban for several Services. Now i want to protect our Mailservice eg: pop,pops,imap,imaps etc.
My Fail2ban Rule "courierlogin.conf" looks:
Code:
# Fail2Ban configuration file
#
# Author: Christoph Haas
# Modified by: Cyril Jaquier
#
# $Revision: 728 $
#

[Definition]

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values:  TEXT
#
failregex = LOGIN FAILED, ip=\[<HOST>\]$

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =
and my jail.conf:
Code:
[courierauth]

enabled  = true
port	 = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter   = courierlogin
logpath  = /opt/psa/var/log/maillog
maxretry = 5
bantime  = 3600

but nothing happend when in /opt/psa/var/log/maillog:
Code:
Nov 18 02:41:00 phi74201 courier-imapd: LOGIN FAILED, [email protected], ip=[::ffff:123.456.789.000]

- Debian 7
- Plesk 11.5


any hints?
 
1. your failregex is wrong, try this
Code:
failregex = LOGIN FAILED,(.*)ip=\[<HOST>\]$



2. you might want to test your filters with

Code:
fail2ban-regex /path/to/logfile /etc/fail2ban/filter.d/myfilter.conf
 
Last edited:
1. your failregex is wrong, try this
Code:
failregex = LOGIN FAILED,(.*)ip=\[<HOST>\]$



2. you might want to test your filters with

Code:
fail2ban-regex /path/to/logfile /etc/fail2ban/filter.d/myfilter.conf


Thanks a lot :)


Code:
~# fail2ban-regex /opt/psa/var/log/maillog /etc/fail2ban/filter.d/courierlogin.conf
Code:
Success, the total number of match is 133

However, look at the above section 'Running tests' which could contain important
information.

Thanks for the note, but WHEN it is implemented?
 
Last edited:
Back
Top