Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_smtp shows OK also response is 530 5.7.57 SMTP #1728

Open
blindzero opened this issue Nov 24, 2021 · 1 comment
Open

check_smtp shows OK also response is 530 5.7.57 SMTP #1728

blindzero opened this issue Nov 24, 2021 · 1 comment

Comments

@blindzero
Copy link

Goal
I want to monitor that SMTP server is not accepting unauthenticated.
I use -f someaddress@ourdomain.com for this.

Current Behaviour
The output seems fine and as expected:

root@host:/usr/lib/nagios/plugins# ./check_smtp -H mailserver -v -p 465 -S -f someaddress@ourdomain.com
HELOCMD: EHLO host
FROM CMD: MAIL FROM:<it@someaddress@ourdomain.com>
sent EHLO host
250-mailserver.ourdomain.com Hello [192.168.xxx.yyy]
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH GSSAPI NTLM LOGIN
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-XRDST
250 XSHADOWREQUEST
250-mailserver.ourdomain.com Hello [192.168.xxx.yyy]
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH GSSAPI NTLM LOGIN
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-XRDST
250 XSHADOWREQUEST
530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
sent QUIT

Unfortunately check_smtp returns OK then in the next line. (The quit-problem can also not be avoided by adding -q).

recv() failed after QUIT.SMTP OK - 5.010 sec. response time, 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
|time=5.010097s;;;0.000000

Expected Behaviour
I would expect CRITICAL here as error 530 is received. RFC 5321 defines this as permanent negative response.

@MEschenbacher
Copy link

MEschenbacher commented Dec 5, 2021

Reading through the code, it does not look like as if the response to -f or -C is checked at all, however I believe with a combination of -C and -R (which checks the response and also takes regex) you might get the behaviour you like e.g.:

/usr/lib/nagios/plugins# ./check_smtp -H mailserver -v -p 465 -S -C "MAIL FROM:<someaddress@ourdomain.com>" -R "^5" -C "RCPT TO:<foo@bar>" -R "^5"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants