Fail2ban not respecting email settings

debian-jessieemailfail2banssmtp

In Fail2ban I have set up my email settings as:

# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = me@hotmail.com

#
# Name of the sender for mta actions
sendername = mailer@example.com

# Email address of the sender
sender = mailer@example.com

I have set this in my /etc/fail2ban/jail.local and /etc/fail2ban/jail.conf files, however when I look at my Mailgun domain logs I am seeing that the message is not being delivered due to is not being RFC 5322.

When I am looking in the message headers, which are in the logs on Mailgun, I can see:

"message": {
    "headers": {
      "to": "root",
      "message-id": "20160515041935.56055.7228.B699C442@mg.example.com",
      "from": "Fail2Ban <fail2ban>",
      "subject": "[Fail2Ban] recidive: banned 183.3.202.174 from example.com"
    },

I have a rule setup to send any emails for root to my email address.

Why is it not sending them to the correct email address intially, and how do I fix this/make the emails RFC 5322 compliant?

Server info

  • Debian Jessie
  • sSMTP as my email client
  • Fail2ban version: Fail2Ban v0.8.13

Please let me know if you need any more information

Best Answer

Message to : root

From : Fail2ban

Looks like your SMTP re-writes or aliases aren't working correctly.

I would start by checking there

Edit Without further details it is hard for me to say - but it sounds like you might have a configuration issue with sSMTP

Related Topic