sendmail and Nagios Core Alerting

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

I see this in my log.. seems to be progress from what I was getting before..


Dec 17 16:34:13 nagios sendmail[10263]: starting daemon (8.14.7): SMTP+queueing@01:00:00
Dec 17 16:34:13 nagios sm-msp-queue[10280]: starting daemon (8.14.7): queueing@01:00:00
Dec 17 16:35:13 nagios sendmail[10264]: xBHIblOQ008231: to=<root@nagios>, delay=03:56:26, xdelay=00:01:00, mailer=relay, pri=661501, relay=smtp.gmail.com. [173.194.78.108], dsn=4.0.0, stat=Deferred: Connection timed out with smtp.gmail.com.
Dec 17 16:35:37 nagios sendmail[10294]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
Dec 17 16:36:31 nagios sendmail[10283]: xBHMYM72010283: from=spatchephunk@gmail.com, size=30, class=0, nrcpts=1, msgid=<201912172235.xBHMYM72010283@nagios.apifw.com>, proto=SMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 17 16:37:32 nagios sendmail[10299]: xBHMYM72010283: to=spatchephunk@gmail.com, delay=00:01:50, xdelay=00:01:00, mailer=relay, pri=120030, relay=smtp.gmail.com. [173.194.78.109], dsn=4.0.0, stat=Deferred: Connection timed out with smtp.gmail.com.
Dec 17 16:38:19 nagios sendmail[10306]: xBHMbMEa010306: from=spatchephunk@gmail.com, size=30, class=0, nrcpts=1, msgid=<201912172237.xBHMbMEa010306@nagios.apifw.com>, proto=SMTP, daemon=MTA, relay=localhost [127.0.0.1]
Dec 17 16:38:52 nagios sendmail[10324]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
QUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: sendmail and Nagios Core Alerting

Post by tgriep »

With the changes, the Sendmail daemon only accepts inbound emails on port 25 and then should forward them to the smtp.gmail.com server isung the gmail credentials and port 587.
Look in the /var/log/maillog for the error if any on why the smtp.gmail.com server blocked the email.

You may have to adjust the gmail security settings for your account.
To let less secure apps access your account, see this link.
https://support.google.com/accounts/ans ... 58064&rd=1

What is the permissions on the /var/spool/clientmqueue/ folder?
Be sure to check out our Knowledgebase for helpful articles and solutions!
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

I changed the smart host in sendmail.mc to smtp.office365.com and updated my authfile and I am getting the same error that smtp.gmail.com was getting which is that it is "timing out"


y, pri=210020, relay=smtp.office365.com [52.96.8.130], dsn=4.0.0, stat=Deferred: Connection timed out with smtp.office365.com




**permissions**

[root@nagios ~]# ls -l /var/spool/clientmqueue
total 4
-rw-rw----. 1 smmsp smmsp 1448 Dec 12 12:15 sm-client.st
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: sendmail and Nagios Core Alerting

Post by tgriep »

The permission issue for the /var/spool/clientmqueue folder.
Do you have selinux enabled?

Try setting the permissions on the folder.

Code: Select all

chmod 770 /var/spool/clientmqueue
It looks like Google's SMTP server has changed.
https://support.google.com/a/answer/2956491?hl=en
See step 2 in the above link.
Be sure to check out our Knowledgebase for helpful articles and solutions!
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

I think we are getting closer. It is no longer timing out and it now appears it is failing to auth:

Dec 18 17:35:37 nagios sendmail[1974]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
Dec 18 17:38:52 nagios sendmail[1996]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
Dec 18 17:39:40 nagios sendmail[2000]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied
Dec 18 17:55:14 nagios sendmail[2138]: starting daemon (8.14.7): SMTP+queueing@01:00:00
Dec 18 17:55:14 nagios sm-msp-queue[2155]: starting daemon (8.14.7): queueing@01:00:00
Dec 18 17:55:15 nagios sendmail[2139]: STARTTLS=client, relay=smtp-relay.gmail.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Dec 18 17:55:15 nagios sendmail[2139]: xBILTJcD009705: AUTH=client, available mechanisms do not fulfill requirements
Dec 18 17:55:15 nagios sendmail[2139]: AUTH=client, relay=smtp-relay.gmail.com., temporary failure, connection abort
Dec 18 17:55:15 nagios sendmail[2139]: xBILTJcD009705: to=it.admin@pelotonland.com, delay=02:25:32, xdelay=00:00:01, mailer=relay, pri=480022, relay=smtp-relay.gmail.com. [172.217.195.28], dsn=4.0.0, stat=Deferred: Temporary AUTH failure


I changed the permissions on /var/spool/clientmqueue/ but still getting permission denied after I rebooted. Does this have any impact on sending mail anyways?


My auth file looks like this:

AuthInfo:gmail.com "U:myemail@gmail.com" "P:mypassword" "M:PLAIN"

Is this correct?
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

OK I think I am getting closer because Google recognized I was trying to auth from sendmail nagios box. I had to enable less secure apps. I am now checking the log again....



*EDIT*

I am seeing this is in my /var/spool/mail/root

Invalid credentials for relay for
<<< 550-5.7.0 one of the domains in: (as obtained from HELO and MAIL FROM).
<<< 550-5.7.0 Email is being sent from a domain or IP address which isn't registered
<<< 550-5.7.0 in your G Suite account. Please login to your G Suite account and
<<< 550-5.7.0 verify that your sending device IP address has been registered within
<<< 550-5.7.0 the G Suite SMTP Relay Settings. For more information, please visit
<<< 550 5.7.0 https://support.google.com/a/answer/6140680#maildenied x27sm622714ywj.14 - gsmtp
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

I am realizing that smtp-relay.gmail.com is used for G Suite accounts which I do not have. I switched it back to smtp.gmail.com and was able to successfully send a test email to myself.
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

OK I can send an email by telnet 25, I can also send an email by sendmail -v myemail@domain.com...

However, I am not receiving alerts from Nagios.
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

[root@nagios mail]# /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/sbin/sendmail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Alert:... List:; syntax illegal for recipient addresses
spatchE
Posts: 24
Joined: Tue Oct 30, 2018 8:05 pm

Re: sendmail and Nagios Core Alerting

Post by spatchE »

What does this mean? Now something is wrong with Nagios but no longer sendmail....


----- Transcript of session follows -----
553 5.1.3 Alert:... List:; syntax illegal for recipient addresses
... while talking to [127.0.0.1]:
>>> DATA
<<< 550 5.1.1 <Host@nagios.apifw.com>... User unknown
550 5.1.1 Host... User unknown
<<< 550 5.1.1 <nagios.apifw.com$@nagios.apifw.com>... User unknown
550 5.1.1 nagios.apifw.com$... User unknown
<<< 550 5.1.1 <is@nagios.apifw.com>... User unknown
550 5.1.1 is... User unknown
<<< 550 5.1.1 <$@nagios.apifw.com>... User unknown
550 5.1.1 $... User unknown
<<< 550 5.1.1 <**@nagios.apifw.com>... User unknown
550 5.1.1 **... User unknown

--xBJ1l2Qn002312.1576720022/nagios.apifw.com
Content-Type: message/delivery-status

Reporting-MTA: dns; nagios.apifw.com
Arrival-Date: Wed, 18 Dec 2019 19:47:02 -0600

Final-Recipient: RFC822; "553 List:; syntax illegal for recipient addresses"@nagios.apifw.com
X-Actual-Recipient: rfc822; "553 List:; syntax illegal for recipient addresses"@nagios.apifw.com
Action: failed
Status: 5.1.3
Last-Attempt-Date: Wed, 18 Dec 2019 19:47:02 -0600

Final-Recipient: RFC822; **@nagios.apifw.com
Action: failed
Status: 5.1.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.1.1 <**@nagios.apifw.com>... User unknown
Last-Attempt-Date: Wed, 18 Dec 2019 19:47:02 -0600

Final-Recipient: RFC822; $@nagios.apifw.com
Action: failed
Status: 5.1.1
Locked