[monitoring-plugins] check_smtp: set default port to smtps (465) for ...

Franz Schwartau git at monitoring-plugins.org
Tue Aug 29 17:00:12 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: e823896d8a39618e0cb60c5cd4e46f13bbc6a51d
 Author: Franz Schwartau <franz at electromail.org>
   Date: Wed Jun 14 18:27:24 2023 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=e823896

check_smtp: set default port to smtps (465) for TLS

The port can still be set with -p.

---

 plugins/check_smtp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index f3ba9e3..474557d 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -50,7 +50,8 @@ int days_till_exp_warn, days_till_exp_crit;
 #endif
 
 enum {
-	SMTP_PORT	= 25
+	SMTP_PORT	= 25,
+	SMTPS_PORT	= 465
 };
 #define PROXY_PREFIX "PROXY TCP4 0.0.0.0 0.0.0.0 25 25\r\n"
 #define SMTP_EXPECT "220"
@@ -650,6 +651,7 @@ process_arguments (int argc, char **argv)
 		case 's':
 		/* ssl */
 			use_ssl = TRUE;
+			server_port = SMTPS_PORT;
 			break;
 		case 'S':
 		/* starttls */
@@ -879,6 +881,7 @@ print_help (void)
   printf ("    %s\n", _("Minimum number of days a certificate has to be valid."));
   printf (" %s\n", "-s, --ssl");
   printf ("    %s\n", _("Use SSL/TLS for the connection."));
+  printf (_("    Sets default port to %d.\n"), SMTPS_PORT);
   printf (" %s\n", "-S, --starttls");
   printf ("    %s\n", _("Use STARTTLS for the connection."));
   printf (" %s\n", "--sni");



More information about the Commits mailing list