Merge branch '33-is_evoacme_livelinks' into 'master'

Resolve "IS_EVOACME_LIVELINKS"

Closes #33

See merge request evolix/evocheck!14
This commit is contained in:
Benoît S. 2018-06-13 17:54:03 +02:00
commit 3144cd2deb

View file

@ -102,6 +102,7 @@ IS_EVOBACKUP=1
IS_DUPLICATE_FS_LABEL=1
IS_EVOMAINTENANCE_FW=1
IS_EVOLIX_USER=1
IS_EVOACME_LIVELINKS=1
#Proper to OpenBSD
IS_SOFTDEP=1
@ -766,6 +767,23 @@ if [ -e /etc/debian_version ]; then
if [ "$IS_EVOLIX_USER" = 1 ]; then
getent passwd evolix >/dev/null && echo 'IS_EVOLIX_USER FAILED!'
fi
if [ "$IS_EVOACME_LIVELINKS" = 1 ]; then
if [ -x "$(which evoacme)" ]; then
for live in /etc/letsencrypt/*/live; do
actualLink=$(ls -lhad $live | tr -s ' ' | cut -d' ' -f 11)
actualCertDate=$(cut -d'/' -f5 <<< $actualLink)
liveDir=$(ls -lhad $live | tr -s ' ' | cut -d' ' -f 9)
certDir=${liveDir%%/live}
lastCertDir=$(stat -c %n ${certDir}/[0-9]* | tail -1)
lastCertDate=$(cut -d'/' -f5 <<< $lastCertDir)
if [[ "$actualCertDate" != "$lastCertDate" ]]; then
echo 'IS_EVOACME_LIVELINKS FAILED!'
break
fi
done
fi
fi
fi