From df3935b5096f86cfb647331892b7c8718442dfe5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 6 Feb 2022 15:26:07 +0100 Subject: NGINX geht jetzt auch hübsch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crypt-expiry-check.in | 36 +++++++++++++++++++++++++++--------- 1 file 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 } -- cgit v1.2.3-70-g09d2