NCP fail2ban Email server settings

I am running Nextcloudpi (NCP) v1.33.0 with NC20.0.3 on a RaspberryPi 4.

I use the “fail2ban” support of NCP which I setup in the admin-panel. I also activated Mailalerts.
When I test the settings by entering the wrong password multiple times, and check the status over SSH (sudo fail2ban-client status nextcloud), I see that my IP goes to the “Banned IP list” for the desired time. But I never receive any EMail.

Now my question is, which EMail settings does fail2ban use?
Because in NC with the admin-user I set up an Email Server and tested it successfully.

Thanks for your Inputs.

NCP comes with Postfix to send mail, usually just works…
Sometimes not…happend to me once as well.
Can check and reconfigure from cli with:

sudo dpkg-reconfigure postfix

This looks like what guided me step by step :wink:

1 Like

Thank you a lot for your response.
Looks like I am not talented enough to see through this… Basic questions I still have:

In NC I configured the Mail-Server with “SMTP”. Does that even work with Postfix in NCP? (see the confusing doc:
Is NCP independent of the Mail-Server Configuration of NC? Or does NC use the NCP config, or NCP uses the NC configuration. That still is not clear at all to me.

I tried to follow the instructions in your link and also the dpkg-reconfigure. None of which helped me get the NCP Mail-Settings to work.

If I get the time I will try this again on a fresh setup… But would be nice to get it to work on my existing one.

What part is unclear?
You either use php or smtp
php uses postfix.
smtp uses whatever external service you provide credentials for.

Afaik, and In general; system user@localhost is delivered by postfix to /var/mail/ in username files. Check with

cat /var/mail/pi
sudo cat /var/mail/root

The link I send you provides a method to (check) the set up postfix as send-only server(SMTP) server. So it can deliver system mail to any external email.
This does not affect Settings in NC tho. When smtp is configured there, NC mail is handled by the external mail service.

Another thought occured to me: It could be your provider/modem/router blocking outgoing smtp port?