rework the EVOACME check

This commit is contained in:
Jérémy Lecour 2019-03-22 22:42:03 +01:00
parent 55f720972b
commit 0fe664f571

View file

@ -1063,17 +1063,20 @@ if is_debian; then
if [ -x "$EVOACME_BIN" ]; then if [ -x "$EVOACME_BIN" ]; then
# Sometimes evoacme is installed but no certificates has been generated # Sometimes evoacme is installed but no certificates has been generated
numberOfLinks=$(find /etc/letsencrypt/ -type l | wc -l) numberOfLinks=$(find /etc/letsencrypt/ -type l | wc -l)
if [ $numberOfLinks -gt 0 ]; then if [ "$numberOfLinks" -gt "0" ]; then
for live in /etc/letsencrypt/*/live; do for live in /etc/letsencrypt/*/live; do
actualLink=$(ls -lhad $live | tr -s ' ' | cut -d' ' -f 11) actualLink=$(readlink -f "$live")
actualCertDate=$(cut -d'/' -f5 <<< $actualLink) actualVersion=$(basename "$actualLink")
liveDir=$(ls -lhad $live | tr -s ' ' | cut -d' ' -f 9)
certDir=${liveDir%%/live} certDir=$(dirname "$live")
lastCertDir=$(stat -c %n ${certDir}/[0-9]* | tail -1) certName=$(basename "$certDir")
lastCertDate=$(cut -d'/' -f5 <<< $lastCertDir) lastCertDir=$(ls -ds "${certDir}"/[0-9]* | tail -1)
if [[ "$actualCertDate" != "$lastCertDate" ]]; then lastVersion=$(basename "$lastCertDir")
failed "IS_EVOACME_LIVELINKS" "Certificate '$liveDir' hasn't been updated"
break if [[ "$lastVersion" != "$actualVersion" ]]; then
failed "IS_EVOACME_LIVELINKS" "Certificate \`$certName' hasn't been updated"
## let's print an error for each certificate
# break
fi fi
done done
fi fi