2

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 = [email protected]

#
# Name of the sender for mta actions
sendername = [email protected]

# Email address of the sender
sender = [email protected]

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": "[email protected]",
      "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

2 Answers 2

0

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

2
  • But it shouldn't even need to worry about my re-writes or aliases as they are defined inside the jail.local file and should be used instead of just populating root in there.
    – James
    May 15, 2016 at 7:10
  • it's sending to root because that is the default destination defined in the action.
    – jwogrady
    Mar 14, 2017 at 22:18
0

Why sSMTP?

Fail2ban support two MTAs.

Add this

# E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the
# mailing. Change mta configuration parameter to mail if you want to
# revert to conventional 'mail'.
mta = sendmail

here

/etc/fail2ban/jail.local

Another helpful hint is to make sure your variables name are correct....

I was pulling my hair out until I realized I was using...

destmail = [email protected]

instead of the correct

destemail = [email protected]

Look closely and you will see those values get passed to the actions defined in action.d.

For example,

**action_mwl = ....., dest="%(destemail)s, ....**

So yeah, don't override the dest in the action file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .