summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcrypt-expiry-check.in25
1 files changed, 13 insertions, 12 deletions
diff --git a/crypt-expiry-check.in b/crypt-expiry-check.in
index 4cb78c6..2b3576e 100755
--- a/crypt-expiry-check.in
+++ b/crypt-expiry-check.in
@@ -80,6 +80,7 @@ OPENSSL=$(which openssl)
PRINTF=$(which printf)
SED=$(which sed)
TEE=$(which tee)
+TR=$(which tr)
SORT=$(which sort)
TAIL=$(which tail)
MKTEMP=$(which mktemp)
@@ -347,14 +348,14 @@ check_nginx_configuration() {
read -r _ FILE
} < <(
printf '%s\n' "${line}" \
- | sed '
+ | "${SED}" '
s/[;{}]/\0\n/g
' \
- | sed -n '
+ | "${SED}" -n '
/^\(server_name\|ssl_certificate\)\s/p
' \
- | sort \
- | sed '
+ | "${SORT}" \
+ | "${SED}" '
s/;$//
'
)
@@ -362,16 +363,16 @@ check_nginx_configuration() {
done < <(
find "${CONFIGDIR}" \
\( -type f -o -type l \) \
- -exec sed '
+ -exec "${SED}" '
s/#.*$//
s/^\s*//
s/\s*$//
' {} \; \
- | tr -d '\n' \
- | sed '
+ | "${TR}" -d '\n' \
+ | "${SED}" '
s/}server\s*{/\n\0/g
' \
- | grep -wF 'ssl_certificate'
+ | "${GREP}" -wF 'ssl_certificate'
)
}
@@ -644,10 +645,10 @@ then
fi
### Check to make sure the sed and awk binaries are available
-if [ ! -f ${SED} ] || [ ! -f ${AWK} ] || [ ! -f ${TEE} ] || [ ! -f ${SORT} ] || [ ! -f ${TAIL} ]
+if [ ! -f ${SED} ] || [ ! -f ${AWK} ] || [ ! -f ${TEE} ] || [ ! -f ${SORT} ] || [ ! -f ${TAIL} ] || [ ! -f "${TR}" ]
then
- >&2 echo "ERROR: Unable to locate the sed, awk, tee, sort or tail binary."
- >&2 echo "FIX: Please modify the \${SED}, \${AWK}, \${TEE}, \${SORT}, \${TAIL} variables in the program header."
+ >&2 echo "ERROR: Unable to locate the sed, awk, tee, sort, tail or tr binary."
+ >&2 echo "FIX: Please modify the \${SED}, \${AWK}, \${TEE}, \${SORT}, \${TAIL}, \${TR} variables in the program header."
exit 1
fi
@@ -721,7 +722,7 @@ do
check_server_status "${HOST}" "${PORT}" "${FWARNDAYS}"
fi
done < <(
- sed '
+ "${SED}" '
/^#\|^$/d
s/^\([0-9]\+\) \+\(.*\S\) \+\(\S\+\)$/\1 \3 \2/
t