Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

alt

Daniel Nashed

Replacing sendmail in Fail2Ban configuration with nshmailx

Daniel Nashed – 29 September 2024 06:35:50

nshmailx is a simple open source C based application, which started as a simple test tool.
But I figured out it can help me to remove the requirement to use separate tools for mailing on Linux.
In addition it allows to specify relay hosts and supports STARTTLS.

Most Linux tools use mailx (BSD version) for sending mail. You can also use nshmailx to replace mailx -- which supports the BSD mailx command-line for sending mail as well.

By default Fail2Ban wants to use sendmail for sending mail. This might introduce also unwanted additional packages on your server.

Here is a simple change to the Fail2Ban action in /etc/fail2ban/action.d/sendmail-common.conf.
You need to customize this script also to change the sender and destination for notifications.

The -file - option is important. It instructs nshmailx to read the e-mail body from stdin.

mailcmd = /usr/bin/nshmailx -from "" -to "" -file - -subject "Fail2Ban Report"

See https://github.com/nashcom/nsh-tools/tree/main/nshmailx for details about nshmailx.



Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]