• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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, user=cust@email.de, 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