1) I already told you in my previous message to use "mta=mail" rather
than "mta=sendmail", so I don't know why you're continuing to use
"mta=sendmail".

2) As René pointed out, you said in your first message that you were
using Postfix, but the log messages below are from Sendmail, not
Postfix. So what's probably happening here is the following:

a) You installed Postfix and Sendmail together when you shouldn't have.

b) Because you installed Sendmail, the "sendmail" binary is no longer
linked to Postfix, it's linked to Sendmail.

c) The "sendmail" binary, which fail2ban is trying to use because you
don't have "mta" set properly to what I told you to set it to, is trying
to connect to Sendmail's "submission" port, i.e., port 587, because
that's the default configuration for Sendmail when it's called as an
MUA, but Postfix doesn't listen on port 587.

So you need to change fail2ban's configuration to "mta=mail" and
uninstall Sendmail.

  Jonathan Kamens

On 8/2/18 7: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]
>
>  
>
> *My /etc/fail2ban/jail.local configuration is as follows*
>
> destemail = [email protected]
>
> sender = root@localhost
>
> mta = sendmail
>
> [sshd]
>
> enabled = true
>
> action = %(action_mw)s
>
> port    = ssh
>
> logpath = %(sshd_log)s
>
> backend = %(sshd_backend)s
>
>  
>
> *When the fail2ban service starts I get this*
>
> Aug 02 14:24:12 freepbx systemd[1]: Starting Fail2Ban Service...
>
> Aug 02 14:24:12 freepbx systemd[1]: Started Fail2Ban Service.
>
> Aug 02 14:24:13 freepbx fail2ban-server[3805]: Server ready
>
> 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]
>
>  
>
> *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]
>
>  
>
> Any guesses on what I could be doing wrong here?
>
>  
>
> Thanks.
>
>  
>
> -----Original Message-----
> From: René Berber [mailto:[email protected]]
> Sent: Wednesday, August 1, 2018 7:38 PM
> To: [email protected]
> Subject: Re: [Fail2ban-users] configure fail2ban to use postfix for
> outgoing emails
>
>  
>
> On 8/1/2018 11:03 AM, Aristos Vasiliou wrote:
>
> > - Centos will not allow me to run sendmail and postfix at the same
> time. I get an error in the logs saying that port 25 is already in use
> when both programs are running. This is why I disabled sendmail, so
> postfix can send out emails.
>
>  
>
> You don't run sendmail, sendmail is an alias (a command named sendmail
> that is actually a link to postfix) installed by postfix.
>
>  
>
> > - To clarify, do I need to add " action = %(action_mw)s" in my
> /etc/fail2ban/jail.local file?
>
>  
>
> Yes.  It doesn't have to be that one exactly, any action that includes
> sending mail will do.
>
> --
>
> René Berber
>
>  
>
>
> ------------------------------------------------------------------------------
> 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
------------------------------------------------------------------------------
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