I'd like fail2ban to send me alert emails for any events. There seem to be dest variables littered throughout the config files in /etc/fail2ban and /etc/fail2ban/action.d

Is there a way to set one destination email for all events? I can't seem to find up to date documentation on this.

jail.local contains:

# ban & send an e-mail with whois report to the destemail.
action_mw = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
            %(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]

But where is destemail set? It would also be useful to know how to quickly test that the destemail is working.


Looks like it is in /etc/fail2ban/jail.local (on centos 6.7) which has been copied from jail.conf.

A one liner to test that mail deilvery is working would be

echo "My message" | mail -s subject your@email.co.uk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.