summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-02-06 15:26:07 +0100
committerErich Eckner <git@eckner.net>2022-02-06 15:26:07 +0100
commitdf3935b5096f86cfb647331892b7c8718442dfe5 (patch)
tree252cc4b2fec1506ad012491dbbb6c3963c8139cb
parentae364309616f04eace10ab78e641fa7378367a23 (diff)
downloadcrypt-expiry-check-df3935b5096f86cfb647331892b7c8718442dfe5.tar.xz
NGINX geht jetzt auch hübsch
-rwxr-xr-xcrypt-expiry-check.in36
1 files changed, 27 insertions, 9 deletions
diff --git a/crypt-expiry-check.in b/crypt-expiry-check.in
index 34694cb..60bbd24 100755
--- a/crypt-expiry-check.in
+++ b/crypt-expiry-check.in
@@ -342,16 +342,34 @@ check_nginx_configuration() {
find "${CONFIGDIR}" \
\( -type f -o -type l \) \
- -exec sed -n '
- s/^.*\bssl_certificate\s\+//
- T
- s/;.*$//
- T
- s@^@{} @
- p
+ -exec sed '
+ s/#.*$//
+ s/^\s*//
+ s/\s*$//
' {} \; \
- | while read -r config_file cert_file; do
- check_file_status "${cert_file}" 'NGINX' "${config_file##*/}" "${WARNDAYS}"
+ | tr -d '\n' \
+ | sed '
+ s/}server\s*{/\n\0/g
+ ' \
+ | grep -wF 'ssl_certificate' \
+ | while read -r line; do
+ {
+ read -r _ HOST _
+ read -r _ FILE
+ } < <(
+ printf '%s\n' "${line}" \
+ | sed '
+ s/[;{}]/\0\n/g
+ ' \
+ | sed -n '
+ /^\(server_name\|ssl_certificate\)\s/p
+ ' \
+ | sort \
+ | sed '
+ s/;$//
+ '
+ )
+ check_file_status "${FILE}" 'NGINX' "${HOST// /, }" "${WARNDAYS}"
done
}