From a6b54d99e9b5b95e9d508747b1e1b6892b0ae9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Fri, 25 May 2018 17:55:12 +0200 Subject: [PATCH 1/2] Add IS_EVOACME_LIVELINKS check --- evocheck.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/evocheck.sh b/evocheck.sh index cc19104..661ddbb 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -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,21 @@ 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 + 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 From 9c5f8653fd4dd596e7e884693e8e0416a09075e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Mon, 28 May 2018 11:49:57 +0200 Subject: [PATCH 2/2] IS_EVOACME_LIVELINKS: Only executed if evoacme installed --- evocheck.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 661ddbb..e9715a7 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -769,18 +769,20 @@ if [ -e /etc/debian_version ]; then fi if [ "$IS_EVOACME_LIVELINKS" = 1 ]; 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 + 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