summaryrefslogtreecommitdiff
path: root/crypt-expiry-check.in
diff options
context:
space:
mode:
Diffstat (limited to 'crypt-expiry-check.in')
-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
}