Email

/
/
Fail2ban does not work with Dovecot

Fail2ban does not work with Dovecot

Symptoms

The installed fail2ban rules do not work with Dovecot.

An error is displayed in the Dovecot log: «Failed during configuration: Have not found any log file for dovecot jail».

Causes

The Dovecot log is not allocated to a separate file.

Solution

By default, the Dovecot mail server log is written to the system log, so it's necessary to create a file for the log and specify the path to it in the log_path directive in the configuration file at /etc/dovecot/conf.d/10-logging.conf, to to make it look like this: log_path = /var/log/mail.log

Then change the permissions for the log file using the following commands:

chmod 666 /var/log/mail.log
chown dovecot:dovecot /var/log/mail.log

After that, restart the service with the command:

systemctl restart dovecot

In this article