Alert handling: Sendmail: 500 command unrecognized
Hi, I'm setting up monit today, and I'm having trouble getting it work with my SMTP server.
I have a SMTP server which works with TLS on port 465, and I just tested it with OpenSSL s_client to see if there was any issue with the server itself (it appears that there's no problem on the mail server side).
Here is my mail server setting in monitrc:
set mailserver smtp.superserver.com username "user@domain.com" password "supersecret" using tlsv1 with timeout 30 seconds using hostname "domain.com"
And here's what's happening actually:
[CEST Jun 4 16:23:53] error : Alert handler failed, retry scheduled for next cycle
[CEST Jun 4 16:24:23] info : Processing queued event /var/monit/1433425926_1d58c80
[CEST Jun 4 16:24:24] error : Sendmail: 500 command unrecognized
[CEST Jun 4 16:24:24] error : Alert handler failed, retry scheduled for next cycle
What I understand is that monit is trying to send mail using only the sendmail command. I tested it directly on the server and actually it does not support this command. In order to send a mail, I need to:
ehlo domain.com
mail from: user@domain.com
rcpt to: destination@otherdomain.com
data
[mail body]
Is there a way to tell monit to send mails differently? Or does it come from somewhere else? I think this would be great to support more SMTP servers... Isn't there a standard for this btw?
Also, nice soft!
Regards, Jordan
Comments (19)
-
repo owner -
reporter Hi,
Thanks for the fast answer!
Okay so this is definitely strange...
I'm using monit v5.13 (mistake on the original report, my bad).
I'll try with 5.14 right away.
-
reporter - changed version to 5.13
-
repo owner That should work fine (5.14 was not released yet).
If you have access to the mailserver logs, please can you check it for error details?
Is it possible to get testing account on that mailserver so we can try to replicate the issue? (you can send testing account details to "support@mmonit.com").
-
reporter That's what I just noticed... :-)
Unfortunately no, I do not have access to the mail server since I'm not hosting it...
I will try to get you a testing account, but I can't guarantee I'll be able to do so.
But if you could try to get your hands on a mail account hosted by GoDaddy, you will have an account on the same server as ours...
-
repo owner I will prepare debug version, which will log the whole communication between the SMTP server and monit, will send details when it's ready.
-
reporter Nice!
Keep me informed then.
-
reporter By the way, I don't know if you were going to provide me the debug version, but in case you do and you wanted to build it, I would need the linux-x64 version.
-
repo owner The debug version is available here:
https://mmonit.com/tmp/monit-5.13-debug.tar.gz
To compile:
tar -xzf monit-5.13-debug.tar.gz cd monit-5.13-debug ./configure make
The "monit" binary will be in the current directory, please stop your existing monit and run the debug version this way:
./monit -vI
It'll dump debug info to the console, please collect the messages with "[MAIL]" prefix and any SMTP errors.
-
repo owner Yet one note ... the debug will contains also the credentials (base64 encoded), please replace it with some dummy string before posting here.
-
reporter Ok thanks will do, but it appears that I miss some PAM libraries...
-
reporter Output of ./configure:
checking for pam_start in -lpam... no configure: error: PAM enabled but headers or library not found, install the PAM development support or run configure --without-pam
-
repo owner On Ubuntu/Debian you'll need libpam0g-dev (or disable PAM with configure option), on RHEL it's "pam-devel".
There are also some additional utilities required (bison, flex) + you'll also need libssl-dev (debian) or openssl-devel (RHEL)
-
reporter Problem solved installing libpam0g-dev. I'll get back to you when I got some debug info
-
reporter I can't reproduce the issue, I'm only having these errors now:
Monit HTTP server started 'my-server' Monit started Monit instance changed notification is sent to destination@otherdomain.com Sendmail: Error receiving data from the mailserver 'smtp.superserver.com' -- Resource temporarily unavailable [MAIL] -> QUIT Sendmail: Error receiving data from the mail server 'smtp.superserver.com' -- Resource temporarily unavailable Adding event to the queue file /var/monit/1433434395_7283d0 for later delivery
-
reporter Ok so I finally get it working! As it turns out, the SMTP server did not allow TLSV1... I switched to SSLAUTO and it's working like a charm now.
Sorry for wasting your time...
But, for the record, how could I determine which cryptographic protocols the server accepts, knowing that their support does not provide this information?
-
reporter - changed status to resolved
I have to learn how to identify which cryptographic protocol are allowed on a SMTP server.
-
repo owner The SSLAUTO on monit side is the best option.
If you need to check if specific SSL/TLS version is supported on server side, you can test it for example with "openssl s_client" using -tls1, -tls1_1, -tls1_2 options.
-
repo owner - removed version
Removing version: 5.13 (automated comment)
- Log in to comment
Hi,
monit sends alerts via SMTP directly (using the EHLO, MAIL FROM, RCPT TO, DATA sequence), "sendmail" is used in the log messages as it's name of that module in monit, but it is not related to "sendmail" command-line utility.
According to the error message, there was problem in the SMTP transaction ... the server didn't understood some command sent by monit.
Which monit version it is? (monit -V)
There were some problems fixed in the past (Qmail SMTP server support, handling of "." in the mail body, etc.) ... if you're running some older monit version, please try to upgrade monit.