On 8/2/2018 6:27 AM, Aristos Vasiliou wrote:

> Ok bear with me please, I'm still struggling to understand the logic.
> 
> So I figured out the email issue.
> 
> *All three commands below can sent out email, no problem there.*
> 
> echo "test mail" | mail -s subject [email protected]
> echo "test mailx" | mailx -s "subject" [email protected]
> echo "Subject: test sendmail" | sendmail -v [email protected]

That only proves that your user is able to send emails, nothing else.
Unless you executed those as root (but still root with a shell
environment is different than root as a service).

> *My /etc/fail2ban/jail.local configuration is as follows*
> 
> destemail = [email protected]
> sender = root@localhost

> mta = sendmail

> [sshd]
[snip]

> Aug 02 14:24:13 freepbx sendmail[3820]: w72BODCj003820:
> from=root@localhost, size=225, class=0, nrcpts=1,
> msgid=<[email protected]>,
> relay=root@localhost
> 
> Aug 02 14:24:13 freepbx sendmail[3820]: w72BODCj003820:
> [email protected], ctladdr=root@localhost (0/0), delay=00:00:00,
> xdelay=00:00:00, mailer=relay, pri=30225, relay=[127.0.0.1] [127.0.0.1],
> dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

"Connection refused" means there's a mail configuration problem.

> *When fail2ban bans an ip, /var/log/maillog shows me this*
> 
> Aug  2 14:15:24 localhost sendmail[3409]: w72BFOZM003409:
> from=root@localhost, size=352, class=0, nrcpts=1,
> msgid=<[email protected]>,
> relay=root@localhost
> 
> Aug  2 14:15:24 localhost sendmail[3409]: w72BFOZM003409:
> [email protected], ctladdr=root@localhost (0/0), delay=00:00:00,
> xdelay=00:00:00, mailer=relay, pri=30352, relay=[127.0.0.1] [127.0.0.1],
> dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Two problems show here, first the message is from sendmail, weren't you
using postfix?

You may want to check on your mail log how the manual test actually
looks like.  Also check the output of 'll $(which sendmail)' in a bash
shell.

Second problem is the connection refused, either "root@localhost" is not
allowed to send emails (you could try [email protected], not
literally), or perhaps the configuration explicitly says not to allow
relaying (which is also odd in that message) from local host.

> Any guesses on what I could be doing wrong here?

My guess is that the only problem is with the mail server configuration.

Is it postfix or sendmail?  The log says sendmail.  Then sendmail
configuration is what you should check.

As the comments on jail.local say (distros usually install a jail.local
with comments), the default mta is sendmail, but you can use/try mail.
-- 
René Berber

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fail2ban-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fail2ban-users

Reply via email to