Skip to content

Commit e2b6221

Browse files
committed
Merge branch 'master' of github.com:matteocorti/check_ssl_cert
2 parents 5af9892 + 4004b51 commit e2b6221

12 files changed

+32
-54
lines changed

.editorconfig

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ root = true
88
end_of_line = lf
99
insert_final_newline = true
1010
trim_trailing_whitespace = true
11-
insert_final_newline = true
1211

1312
# 4 space indentation
1413
[*]

.github/workflows/publish.yml

-12
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
distro:
19-
- 'centos:7'
20-
- 'centos:8'
2119
- 'fedora:40'
2220
- 'fedora:39'
2321
include:
@@ -29,16 +27,6 @@ jobs:
2927
pre: >-
3028
dnf install -y hostname &&
3129
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl rpm-build openssh-clients bc bash-completion
32-
- distro: 'centos:7'
33-
pre: >-
34-
yum install -y nmap curl sudo perl make bzip2 file openssl perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build openssh-clients b bash-completionc &&
35-
scversion="stable"; curl -Ls "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv && cp "shellcheck-${scversion}/shellcheck" /usr/bin/
36-
- distro: 'centos:8'
37-
pre: >-
38-
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* &&
39-
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-* &&
40-
dnf install -y nmap curl sudo perl make bzip2 file openssl rpm-build openssh-clients bc bash-completion &&
41-
scversion="stable"; curl -Ls "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv && cp "shellcheck-${scversion}/shellcheck" /usr/bin/
4230
steps:
4331
- name: Git clone repository
4432
uses: actions/checkout@v4

.github/workflows/unit_tests.yml

-8
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ jobs:
160160
fail-fast: false
161161
matrix:
162162
distro:
163-
- 'centos:7'
164163
- 'fedora:39'
165164
- 'fedora:40'
166165
include:
@@ -172,9 +171,6 @@ jobs:
172171
pre: >-
173172
dnf install -y hostname &&
174173
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git bash-completion
175-
- distro: 'centos:7'
176-
pre: >-
177-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build bash-completion
178174
steps:
179175

180176
- name: Git clone repository
@@ -198,7 +194,6 @@ jobs:
198194
fail-fast: false
199195
matrix:
200196
distro:
201-
- 'centos:7'
202197
- 'fedora:39'
203198
- 'fedora:40'
204199
include:
@@ -210,9 +205,6 @@ jobs:
210205
pre: >-
211206
dnf install -y hostname &&
212207
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git
213-
- distro: 'centos:7'
214-
pre: >-
215-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build
216208
steps:
217209

218210
- name: Git clone repository

.github/workflows/unit_tests_with_proxy.yml

-8
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
fail-fast: false
6464
matrix:
6565
distro:
66-
- 'centos:7'
6766
- 'fedora:39'
6867
- 'fedora:40'
6968
include:
@@ -75,9 +74,6 @@ jobs:
7574
pre: >-
7675
dnf install -y hostname &&
7776
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git bash-completion
78-
- distro: 'centos:7'
79-
pre: >-
80-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build bash-completion
8177
steps:
8278

8379
- name: Git clone repository
@@ -101,7 +97,6 @@ jobs:
10197
fail-fast: false
10298
matrix:
10399
distro:
104-
- 'centos:7'
105100
- 'fedora:39'
106101
- 'fedora:40'
107102
include:
@@ -113,9 +108,6 @@ jobs:
113108
pre: >-
114109
dnf install -y hostname &&
115110
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git
116-
- distro: 'centos:7'
117-
pre: >-
118-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build
119111
steps:
120112

121113
- name: Git clone repository

CITATION.cff

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ authors:
266266
given-names: "Дилян"
267267
website: https://github.com/dilyanpalauzov
268268
title: "check_ssl_cert"
269-
version: 2.82.0
269+
version: 2.83.0
270270
date-released: 2024-08-15
271271
url: "https://github.com/matteocorti/check_ssl_cert"
272272
repository-code: "https://github.com/matteocorti/check_ssl_cert"

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2024-07-11 Matteo Corti <[email protected]>
2+
3+
* check_ssl_cert (main): fetch HTTP headers for --debug-headers even if no header check is enabled
4+
15
2024-04-01 Matteo Corti <[email protected]>
26

37
* check_ssl_cert (hours_until): refactored without return value

NEWS.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
* Better error handling in subroutines
44

5-
* 2024-08-15 Version 2.82.0
5+
* 2024-08-15 Version 2.83.0
66
* Shows ```--info``` event in case of a problem
7+
* 2024-07-11, Version 2.82.0
8+
* Better error handling in subroutines
9+
* Fetch HTTP headers for --debug-headers even if no header check is enabled
710
* 2024-05-28 Version 2.81.1
811
* Fix in the Icinga2 configuration file
912
* 2024-03-27 Version 2.81.0

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.82.0
1+
2.83.0

check_ssl_cert

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
################################################################################
2727
# Constants
2828

29-
VERSION=2.82.0
29+
VERSION=2.83.0
3030
SHORTNAME="SSL_CERT"
3131

3232
VALID_ATTRIBUTES=",startdate,enddate,subject,issuer,modulus,serial,hash,email,ocsp_uri,fingerprint,"
@@ -5825,6 +5825,12 @@ main() {
58255825
####################
58265826
# check HTTP headers
58275827
5828+
if [ -n "${REQUIRED_HTTP_HEADERS}" ] ||
5829+
[ -n "${UNREQUIRED_HTTP_HEADERS}" ] ||
5830+
[ -n "${DEBUG_HEADERS}" ] ; then
5831+
fetch_http_headers
5832+
fi
5833+
58285834
if [ -n "${REQUIRED_HTTP_HEADERS}" ]; then
58295835
debuglog "Checking required HTTP headers: ${REQUIRED_HTTP_HEADERS}"
58305836
for header in $(echo "${REQUIRED_HTTP_HEADERS}" | tr ',' '\n'); do

check_ssl_cert.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" Process this file with
22
.\" groff -man -Tascii check_ssl_cert.1
33
.\"
4-
.TH "check_ssl_cert" 1 "August, 2024" "2.82.0" "USER COMMANDS"
4+
.TH "check_ssl_cert" 1 "August, 2024" "2.83.0" "USER COMMANDS"
55
.SH NAME
66
check_ssl_cert \- checks the validity of X.509 certificates
77
.SH SYNOPSIS

check_ssl_cert.spec

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%global version 2.82.0
1+
%global version 2.83.0
22
%global release 0
33
%global sourcename check_ssl_cert
44
%global packagename nagios-plugins-check_ssl_cert
@@ -54,10 +54,13 @@ rm -rf $RPM_BUILD_ROOT
5454
%endif
5555

5656
%changelog
57-
* Tue August 28 2024 Matteo Corti <[email protected]> - 2.82.0-0
57+
* Tue August 28 2024 Matteo Corti <[email protected]> - 2.83.0-0
58+
- Updated to 2.83.0
59+
60+
* Thu Jul 11 2024 Matteo Corti <[email protected]> - 2.82.0-0
5861
- Updated to 2.82.0
5962

60-
* Tue May 28 2024 Matteo Corti <[email protected]> - 2.81.1-0
63+
* Tue May 28 2024 Matteo Corti <[email protected]> - 2.81.1-0
6164
- Updated to 2.81.1
6265

6366
* Sun Mar 17 2024 Matteo Corti <[email protected]> - 2.81.0-0

test/integration_tests.sh

+8-17
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,6 @@ testSignatureAlgorithms() {
354354
sed 's/^Signature algorithm *//')
355355
assertEquals "wrong signature algorithm" 'sha256WithRSAEncryption (8192 bit)' "${ALGORITHM}"
356356

357-
echo " testing sha256WithRSAEncryption (256 bit)"
358-
# shellcheck disable=SC2086
359-
ALGORITHM=$(${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --info --ignore-exp --host ecc256.badssl.com |
360-
grep '^Signature algorithm' |
361-
sed 's/^Signature algorithm *//')
362-
assertEquals "wrong signature algorithm" 'sha256WithRSAEncryption (256 bit)' "${ALGORITHM}"
363-
364-
echo " testing sha256WithRSAEncryption (384 bit)"
365-
# shellcheck disable=SC2086
366-
ALGORITHM=$(${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --info --ignore-exp --host ecc384.badssl.com |
367-
grep '^Signature algorithm' |
368-
sed 's/^Signature algorithm *//')
369-
assertEquals "wrong signature algorithm" 'sha256WithRSAEncryption (384 bit)' "${ALGORITHM}"
370-
371357
}
372358

373359
testFQDN() {
@@ -1051,13 +1037,13 @@ testNotExistingHosts() {
10511037
if [ -n "${NSLOOKUP_BIN}" ] ; then
10521038

10531039
# shellcheck disable=SC2086
1054-
OUTPUT=$( ${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --host li )
1040+
OUTPUT=$( ${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --host nonexistinghostordomain )
10551041
EXIT_CODE=$?
10561042
assertEquals "wrong exit code" "${NAGIOS_CRITICAL}" "${EXIT_CODE}"
10571043
assertContains "wrong error message" "${OUTPUT}" "Cannot resolve"
10581044

10591045
# shellcheck disable=SC2086
1060-
OUTPUT=$( ${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --host li --do-not-resolve )
1046+
OUTPUT=$( ${SCRIPT} ${TEST_DEBUG} --rootcert-file cabundle.crt --host nonexistinghostordomain --do-not-resolve )
10611047
EXIT_CODE=$?
10621048
assertEquals "wrong exit code" "${NAGIOS_CRITICAL}" "${EXIT_CODE}"
10631049
assertContains "wrong error message" "${OUTPUT}" "Cannot connect"
@@ -1309,7 +1295,6 @@ testGithubComCRL() {
13091295
create_temporary_test_file
13101296
TEMPFILE_CRL=${TEMPFILE}
13111297

1312-
echo "${TEST_CRL_URI}"
13131298
curl --silent "${TEST_CRL_URI}" --output "${TEMPFILE_CRL}"
13141299

13151300
# shellcheck disable=SC2086
@@ -1593,6 +1578,12 @@ testXFrameOptionsFailed() {
15931578
assertEquals "wrong exit code" "${NAGIOS_CRITICAL}" "${EXIT_CODE}"
15941579
}
15951580

1581+
testHTTPHeaders() {
1582+
# shellcheck disable=SC2086
1583+
${SCRIPT} ${TEST_DEBUG} -H securityheaders.com --ignore-exp --debug-headers
1584+
}
1585+
1586+
15961587
testHTTPHeadersOK() {
15971588
# shellcheck disable=SC2086
15981589
${SCRIPT} ${TEST_DEBUG} -H securityheaders.com --ignore-exp --require-security-headers

0 commit comments

Comments
 (0)