Skip to content

Commit

Permalink
Merge pull request #434 from matteocorti/433-support-protocol-dns-for…
Browse files Browse the repository at this point in the history
…-dns-over-tls

Fixed #433
  • Loading branch information
matteocorti authored Dec 4, 2022
2 parents 9745a2e + e1dfeb8 commit b5c03ce
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ authors:
given-names: "Дилян"
website: https://github.com/dilyanpalauzov
title: "check_ssl_cert"
version: 2.56.0
date-released: 2022-11-30
version: 2.57.0
date-released: 2022-12-04
url: "https://github.com/matteocorti/check_ssl_cert"
repository-code: "https://github.com/matteocorti/check_ssl_cert"
keywords:
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# News

* 2022-12-04 Version 2.57.0
* Support for DNS over TLS
* 2022-11-30 Version 2.56.0
* Adds the ```--path``` command line option
* 2022-10-25 Version 2.55.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Options:
defaults to 0 if critical or warning are
integers, 2 otherwise
-P,--protocol protocol Use the specific protocol:
ftp, ftps, http, https (default),
dns, ftp, ftps, http, https (default),
h2 (HTTP/2), imap, imaps, irc, ircs, ldap,
ldaps, mysql, pop3, pop3s, postgres,
sieve, smtp, smtps, tds, xmpp,
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Release notes

New command line optioon ```--path```
Support for DNS over TLS
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.56.0
2.57.0
11 changes: 7 additions & 4 deletions check_ssl_cert
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
################################################################################
# Constants

VERSION=2.56.0
VERSION=2.57.0
SHORTNAME="SSL_CERT"

VALID_ATTRIBUTES=",startdate,enddate,subject,issuer,modulus,serial,hash,email,ocsp_uri,fingerprint,"
Expand Down Expand Up @@ -401,7 +401,7 @@ usage() {
echo " defaults to 0 if critical or warning are"
echo " integers, 2 otherwise"
echo " -P,--protocol protocol Use the specific protocol:"
echo " ftp, ftps, http, https (default),"
echo " dns, ftp, ftps, http, https (default),"
echo " h2 (HTTP/2), imap, imaps, irc, ircs, ldap,"
echo " ldaps, mysql, pop3, pop3s, postgres,"
echo " sieve, smtp, smtps, tds, xmpp,"
Expand Down Expand Up @@ -2492,11 +2492,11 @@ fetch_certificate() {
exec_with_timeout "printf 'QUIT\\n' | ${OPENSSL} s_client ${INETPROTO} ${CLIENT} ${CLIENTPASS} -crlf -showcerts -connect ${HOST_ADDR}:${PORT} ${SERVERNAME} ${SCLIENT_PROXY} ${SCLIENT_PROXY_ARGUMENT} -verify 6 ${ROOT_CA} ${SSL_VERSION} ${SSL_VERSION_DISABLED} ${SSL_AU} ${STATUS} ${DANE} ${RENEGOTIATION} ${S_CLIENT_NAME} 2> ${ERROR} 1> ${CERT}"
RET=$?
;;
irc | ldap)
irc | ldap )
exec_with_timeout "echo | ${OPENSSL} s_client ${INETPROTO} ${CLIENT} ${CLIENTPASS} -starttls ${PROTOCOL} -showcerts -connect ${HOST_ADDR}:${PORT} ${SERVERNAME} ${SCLIENT_PROXY} ${SCLIENT_PROXY_ARGUMENT} -verify 6 ${ROOT_CA} ${SSL_VERSION} ${SSL_VERSION_DISABLED} ${SSL_AU} ${STATUS} ${DANE} ${RENEGOTIATION} 2> ${ERROR} 1> ${CERT}"
RET=$?
;;
ircs | ldaps)
ircs | ldaps | dns )
exec_with_timeout "echo | ${OPENSSL} s_client ${INETPROTO} ${CLIENT} ${CLIENTPASS} -showcerts -connect ${HOST_ADDR}:${PORT} ${SERVERNAME} ${SCLIENT_PROXY} ${SCLIENT_PROXY_ARGUMENT} -verify 6 ${ROOT_CA} ${SSL_VERSION} ${SSL_VERSION_DISABLED} ${SSL_AU} ${STATUS} ${DANE} ${RENEGOTIATION} 2> ${ERROR} 1> ${CERT}"
RET=$?
;;
Expand Down Expand Up @@ -3949,6 +3949,9 @@ main() {
pop3)
PORT=110
;;
dns)
PORT=853
;;
ftp | ftps)
PORT=21
;;
Expand Down
4 changes: 2 additions & 2 deletions check_ssl_cert.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" Process this file with
.\" groff -man -Tascii check_ssl_cert.1
.\"
.TH "check_ssl_cert" 1 "November, 2022" "2.56.0" "USER COMMANDS"
.TH "check_ssl_cert" 1 "December, 2022" "2.57.0" "USER COMMANDS"
.SH NAME
check_ssl_cert \- checks the validity of X.509 certificates
.SH SYNOPSIS
Expand Down Expand Up @@ -321,7 +321,7 @@ TCP port (default 443)
Number of decimal places for durations: defaults to 0 if critical or warning are integers, 2 otherwise
.TP
.BR "-P,--protocol" " protocol"
Use the specific protocol: ftp, ftps, http, https (default), h2 (HTTP/2), imap, imaps, irc, ircs, ldap, ldaps, mysql, pop3, pop3s, postgres, sieve, smtp, smtps, tds, xmpp, xmpp-server, ftp, imap, irc, ldap, pop3, postgres, sieve, smtp: switch to TLS using StartTLS.
Use the specific protocol: dns, ftp, ftps, http, https (default), h2 (HTTP/2), imap, imaps, irc, ircs, ldap, ldaps, mysql, pop3, pop3s, postgres, sieve, smtp, smtps, tds, xmpp, xmpp-server, ftp, imap, irc, ldap, pop3, postgres, sieve, smtp: switch to TLS using StartTLS.
.BR
These protocols switch to TLS using StartTLS: ftp, imap, irc, ldap, mysql, pop3, smtp.
.TP
Expand Down
5 changes: 4 additions & 1 deletion check_ssl_cert.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%global version 2.56.0
%global version 2.57.0
%global release 0
%global sourcename check_ssl_cert
%global packagename nagios-plugins-check_ssl_cert
Expand Down Expand Up @@ -54,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
%endif

%changelog
* Sun Dec 4 2022 Matteo Corti <[email protected]> - 2.57.0-0
- Updated to 2.57.0

* Wed Nov 30 2022 Matteo Corti <[email protected]> - 2.56.0-0
- Updated to 2.56.0

Expand Down
7 changes: 7 additions & 0 deletions test/unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,13 @@ testJavaKeyStore2() {
assertEquals "wrong exit code" "${NAGIOS_OK}" "${EXIT_CODE}"
}

testDNS() {
# shellcheck disable=SC2086
${SCRIPT} ${TEST_DEBUG} --host 1.1.1.1 --protocol dns --ignore-exp
EXIT_CODE=$?
assertEquals "wrong exit code" "${NAGIOS_OK}" "${EXIT_CODE}"
}

# the script will exit without executing main
export SOURCE_ONLY='test'

Expand Down
2 changes: 1 addition & 1 deletion utils/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
-N,--host-cn;(enabled by default)
-N,--host-cn;Match CN with the host name
-P,--protocol protocol;Use the specific protocol:
-P,--protocol protocol;ftp, ftps, http, https (default),
-P,--protocol protocol;dns, ftp, ftps, http, https (default),
-P,--protocol protocol;ftp, imap, irc, ldap, pop3, postgres,
-P,--protocol protocol;h2 (HTTP/2), imap, imaps, irc, ircs, ldap,
-P,--protocol protocol;ldaps, mysql, pop3, pop3s, postgres,
Expand Down

0 comments on commit b5c03ce

Please sign in to comment.