Commit graph

129 commits

Author SHA1 Message Date
Lorenz Kästle
6cd097921f Allow setting of port independent of argument position again 2025-03-10 21:27:50 +01:00
Lorenz Kästle
5cf53de34f check_smtp: fix positional host logic 2025-03-10 20:56:09 +01:00
Lorenz Kästle
897fef9370 check_smtp: small improvements 2025-03-10 20:54:52 +01:00
Lorenz Kästle
c5f873aa7b check_smtp: small style fixes 2025-03-10 09:56:05 +01:00
Lorenz Kästle
acf57dba52 check_smtp: Remove unused enum 2025-03-10 01:32:49 +01:00
Lorenz Kästle
883fcb607f Refactor check_smtp 2025-03-10 01:31:52 +01:00
Lorenz Kästle
0867319268 check_smtp: clang-format 2025-03-09 23:40:05 +01:00
Lorenz Kästle
b830c7a3e0 check_smtp: delare previously missed file local variables static 2024-11-08 12:51:14 +01:00
Lorenz Kästle
d330b975b3 check_smtp: delare file local variables static 2024-11-08 12:47:32 +01:00
Lorenz Kästle
41b0b959d8 check_smtp: update copyright 2024-10-31 14:46:36 +01:00
RincewindsHat
decca6d290 check_smtp: Restore behaviour pre ead5526efa regarding -D and TLS 2023-10-19 11:31:28 +02:00
RincewindsHat
d820929dd8 check_smtp: little fix for C99 booleans missed earlier 2023-10-19 10:17:28 +02:00
RincewindsHat
163ad151b9 check_smtp: Use C99 booleans 2023-10-18 20:55:22 +02:00
Franz Schwartau
ce96ef868a check_smtp: Let port option always take precedence
Otherwise -s/--ssl would overwrite a port given with -p if it comes
after it, e. g.

check_smtp -H mailhost.example.com -p 4465 --ssl

Found-By: Lorenz Kästle
2023-08-29 09:46:50 +02:00
Franz Schwartau
079c300dcc check_smtp: add new longoption --tls
This is an alias for -s/--ssl.
2023-08-29 09:46:50 +02:00
Franz Schwartau
da81dd3cf2 check_smtp: remove restriction of --proxy with --ssl 2023-08-29 09:46:50 +02:00
Franz Schwartau
e823896d8a check_smtp: set default port to smtps (465) for TLS
The port can still be set with -p.
2023-08-29 09:46:50 +02:00
Franz Schwartau
ead5526efa Add support for SMTP over TLS
This is commonly used on smtps (465) port.

PROXY protocol is not implemented with TLS in check_smtp.c, yet.

Backported from nagios-plugins:
0a8cf08ebb
2023-08-29 09:46:50 +02:00
waja
265a7c0ed8
Merge branch 'master' into compiler_warning_part_2 2023-06-28 16:39:27 +02:00
Arkadiusz Miśkiewicz
252272344e Add support for SNI in check_smtp.
Add support for SSL/TLS hostname extension support (SNI) for check_smtp
plugin.

Backported from nagios-plugins:
9f1628f4b5
2023-06-12 23:18:20 +02:00
Franz Schwartau
d762fb1374 check_smtp: update year in copyright header 2023-06-12 22:09:54 +02:00
Franz Schwartau
6d5e81fcba check_smtp: add missing -r option in usage 2023-06-12 21:49:42 +02:00
Patrick Uiterwijk
ce85affd20 check_smtp: Add option to prefix PROXY header
This enables checks of SMTP servers that expect the haproxy
PROXY protocol:  -o smtpd_upstream_proxy_protocol=haproxy.

Backported from nagios-plugins:
3246efe923
2023-06-12 21:49:42 +02:00
RincewindsHat
f7687d47cb Fixes for -Wimplicit-fallthrough 2023-04-18 00:18:07 +02:00
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00:00
Geert Hendrickx
0bd45c200b
check_smtp: add -L flag to support LMTP (LHLO instead of HELO/EHLO). 2021-10-28 23:08:02 +02:00
Iustin Pop
8520c643dd Simply initializes n before it is used
When SSL is enabled, n is assigned the size of the server's second EHLO
response (I think in bytes), which will usually be significantly higher
than the command passed. As such, no commands are executed and no responses
are checked, which - silently - defeats the desired checks and results in a
success value.
2019-01-18 22:52:54 +01:00
Jan Wagner
dbb92c347e Spelling fixes suggested by lintian 2016-12-01 12:49:40 +01:00
Oliver Skibbe
6438fec788 Merge pull request #1382 from riskersen/smtp_tls_expec
check_smtp: extended support for expect option
2016-11-19 16:38:07 +01:00
Holger Weiss
303acfc64f Merge remote-tracking branch 'monitoring-plugins/pr/1443'
* monitoring-plugins/pr/1443:
  add openssl 1.1 support
2016-11-18 11:51:12 +01:00
Holger Weiss
487a9d0a8b check_radius: Replace functions removed in radcli
The radcli library no longer offers the rc_get_ipaddr(),
rc_good_ipaddr(), and rc_own_ipaddress() functions.
2016-11-17 17:22:37 +01:00
vagrant
fe1c4bb0e5 add openssl 1.1 support
changes:
  - CRYPTO_lock detection replaced in configure.ac. We don't use that
    function anywhere, so just replace it with the suggested one from
    https://wiki.openssl.org/index.php/Library_Initialization#Autoconf
  - OPENSSL_NO_SSL2 is no longer defined while ssl2 is not included.
    Set it ourself using the suggested openssl 1.1 version check from
    https://wiki.openssl.org/index.php/1.1_API_Changes#Backward_compatibility
  - openssl 1.1 sends a sigpipe if the connection is still open when
    calling SSL_shutdown(), so move the close before the shutdown.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-13 21:14:02 +00:00
Oliver Skibbe
6b8c0bdf11 check_smtp: extended support for expect option
expect option (-e) supported only first response, so checking for
  any other response like 250-xxx would never match. This fix stores
  return of relevant buffer

  closes #1381
2015-10-08 11:09:25 +02:00
Oliver Skibbe
b6de2341f8 check_smtp.c: modified SSL check for use with -e
- currently STARTTLS check does not work with -e if there's text
    like '220 hostname ESMTP*'. This is caused by SMTP answer from
    host. Postfix answer: 220 2.0.0 Ready to start TLS, Exchange
    2010: 220 2.0.0 SMTP server ready. This fix checks against 220

    closes #1093
2015-10-08 09:04:29 +02:00
Holger Weiss
dfe66c01c0 check_smtp: Let "-D" option imply "-S" 2015-10-06 23:28:24 +02:00
Holger Weiss
b317aaf32a check_smtp: QUIT SMTP connection when "-D" is used
Don't forget to issue an SMTP QUIT command when the -D/--certificate
option is specified.  This avoids undesired MTA log messages.
2015-10-06 23:21:17 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Thomas Guyot-Sionnest
11cf54ca78 Merge branch 'rename' 2014-01-21 07:59:07 -05:00
Spenser Reinhardt
212575b858 plugins/*.c: Alterations for timeout messages.
.c file changes for misleading timeout messages in help functions. Solution to pull request #1209 tracker by awiddersheim.

Files: plugins/check_apt.c, plugins/check_by_ssh.c, plugins/check_dbi.c, plugins/check_dig.c, plugins/check_disk.c, plugins/check_dns.c, plugins/check_game.c, plugins/check_http.c, plugins/check_ldap.c, plugins/check_ntp.c, plugins/check_ntp_peer.c, plugins/check_ntp_time.c, plugins/check_nwstat.c, plugins/check_overcr.c, plugins/check_pgsql.c, plugins/check_ping.c, plugins/check_procs.c, plugins/check_radius.c, plugins/check_real.c, plugins/check_smtp.c, plugins/check_snmp.c, plugins/check_ssh.c, plugins/check_tcp.c, plugins/check_time.c, plugins/check_ups.c, plugins/negate.c
2014-01-21 11:33:45 +01:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
This is an initial take at renaming the project to Monitoring Plugins.
It's not expected to be fully complete, and it is expected to break
things (The perl module for instance). More testing will be required
before this goes mainline.
2014-01-19 14:18:47 -05:00
Jan Wagner
b6f0e755fd Fixed SF.net bug 2555775, threshold can be double for check_smtp
Thanks to Roman Fiedler for reporting the issue and providing a fix
2013-08-06 10:55:49 +02:00
William Leibzon
6b844aea9f fixing bug in certificate experiation patch checking for bad warning threshold data 2012-08-10 13:03:00 +02:00
Eric Stanley
49df5964eb Re-added missing variable declarations to check_smtp.c
A recent update removed the declarations for a couple variables in
check_smtp.c that are still being used, which caused a failure
in the compilation of check_smtp.c. This commit restores those variable
declarations so the check_smtp.c will again compile.
2012-07-04 12:48:07 -05:00
Holger Weiss
b57aeb1e5f check_smtp: Remove a comment regarding MAIL FROM
Earlier versions of check_smtp generated an (invalid) "MAIL FROM"
command without arguments by default.  These days, a "MAIL FROM" command
is only sent if the --from option is specified.

This commit removes a comment which explains the old behaviour, and it
updates a variable name accordingly.
2012-06-29 15:09:34 +02:00
Holger Weiss
973d147cef check_smtp: Fix help and usage output regarding -R 2012-06-29 14:25:40 +02:00
Anders Kaseorg
638b596992 check_smtp: Fix strcat overflows
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Anders Kaseorg
028d50d6f9 Die when asprintf fails
Fixes many instances of
warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Anders Kaseorg
9976876584 check_smtp: Strip angle brackets from -f argument, if provided
Apparently some people used -f '<nagios@example.com>' to work around
the bug I just fixed in the MAIL FROM: command generation.  Although
the resulting command wasn't RFC-compliant, it was working with some
MTAs, so let's continue to support this syntax now that we generate
RFC-compliant commands.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Anders Kaseorg
dd1e9eb5ea check_smtp: Change MAIL FROM: command to comply with the SMTP standard
Every version of the SMTP standard (from RFC 821 to the current RFC
5321) requires the address following MAIL FROM: to follow the colon
immediately (with no space) and to be surrounded by angle brackets.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00