• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx

  • We are developing a new feature in Plesk that will help you promote your websites or business on social media. We want to conduct a one-hour online UX test to present the prototype and collect feedback. If you are interested in the feature, please book a meeting via this link.
    Thank you in advance!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Unable to configure fail2ban for snappymail on Plesk

PeopleInside

Regular Pleskian
Server operating system version
Ubuntu 22.04.1 LTS
Plesk version and microupdate number
18.0.48
Hi,
I need configure fail2ban for snappymail

Official snappymail on how to proceed for configure fail2ban are listed here:

but on Plesk those rules can be and maybe should be done by using the Plesk fail2ban UI interface.

I try to do the setup using this steps:

but I'm unable to proceed.

  • I am able to create the Jail filter snappymail-fpm-journal
with content:

Code:
[INCLUDES]
before = common.conf

[Definition]
failregex = Auth failed: ip=<HOST> user=.*$
ignoreregex =
_daemon = php-fpm
journalmatch = _SYSTEMD_UNIT=php-fpm.service SYSLOG_FACILITY=10
  • I am able to create the Jail filter snappymail-log
with content:

Code:
[Definition]
failregex = Auth failed: ip=<HOST> user=.* host=.* port=.*$
ignoreregex =

  • I am unable to create the Jail with name snappymail-fpm-journ
the following error is showed:
Error: f2bmng failed: 2023-01-09 14:05:01,232 fail2ban [3179708]: ERROR Failed during configuration: Have not found any log file for snappymail-fpm-journ jail
ERROR:__main__:Command '['/usr/bin/fail2ban-client', 'reload', '--if-exists', 'snappymail-fpm-journ']' returned non-zero exit status 255.
ERROR:__main__:Failed to reload following jails due to errors in configuration: snappymail-fpm-journ
 
Hi @PeopleInside,

Did you followed the instructions provided by the one person who was trying to help you out in your raised issue on github? About creating the filter first then when creating the jail you want to make sure you select your newly created filter. It's outlined pretty clearly on Issue to setup Fail2Ban on Plesk · Issue #489 · the-djmaze/snappymail
Yes filter are created first then I select the filter while creating the Jail.
Still not able to configure as reported.
 
So, without going out of the way to do the full installation in a test environment, the only thing I can say is to make sure you configure your jails properly. Here's how I got it configured in my test:

1673274859681.png
raw

Make sure that the log path is correct for where the logs are configured for snappymail.
 
Thanks you, maybe I was inserting wrong log position.
Now Jails are created but I still have an issue that should be not from Plesk.
I will ask to snappymail developer.

Thank you for your help!

Log path inserted was wrong.
 
The log when a wrong login is done should be saved in a folder in snappyemail.
Log path should be not inside the snappymail? Is a different things?

I am unable to see the log created when a wrong login is done.
In Log path I was try to insert the path to the fail2ban log folder inside the snappy mail and Plesk give me an error, now that I use your path var/log/fail2ban.log I am able to create the two jails but when a wrong login in snappy mail is done no custom log is created.


I have asked to the developer of snappymail.

In the past was able to configure, now seems I am unable anymore, I don't know where I can be wrong.
 
I just used /var/log/fail2ban.log as an example, you will need to make sure the log file you're using is the correct one with the correct path that exist so you want to check that and update accordingly.
 
I just used /var/log/fail2ban.log as an example, you will need to make sure the log file you're using is the correct one with the correct path that exist so you want to check that and update accordingly.
Finally discovered the log file should be compiled as you compiled it: /var/log/fail2ban.log

The custom file log that I mean and it's saved will be created by the snappy fail2ban app (confi, application.ini) that is where user set the patch of the custom log.

Plesk need have /var/log/fail2ban.log in the UI settings, that's good.
This post just to made the discussion updated so in the future I hope to don't fall anymore into this issue.

I updated also my instructions on the GitHub issue of the app and the configuration of fail2ban.
 
Not correct, I need revert back log with custom path.
If I use the plesk log location the ban never work, the app save the fail2ban inside the app folder so need use custom path and be sure the log file exist and is not deleted. Will correct again the GitHub page,
 
Back
Top