From 5bad0301d910f3dc04bd0057ec0092b4c0e15b8a Mon Sep 17 00:00:00 2001 From: Jeremy Dubois Date: Mon, 27 Jul 2020 16:59:54 +0200 Subject: [PATCH] Add check_ntp() - Check the ntpd configuration --- evocheck.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/evocheck.sh b/evocheck.sh index b3c6175..7af41af 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -311,6 +311,16 @@ check_defaultroute(){ fi } +check_ntp(){ + if grep -q "server ntp.evolix.net" /etc/ntpd.conf; then + if [ $(wc -l /etc/ntpd.conf | awk '{print $1}') -ne 1 ]; then + failed "IS_NTP" "The /etc/ntpd.conf file should only contains \"server ntp.evolix.net\"." + fi + else + failed "IS_NTP" "The configuration in /etc/ntpd.conf is not compliant. It should contains \"server ntp.evolix.net\"." + fi +} + main() { # Default return code : 0 = no error @@ -349,6 +359,7 @@ main() { test "${IS_EVOMAINTENANCECONF:=1}" = 1 && check_evomaintenanceconf test "${IS_SYNC:=1}" = 1 && check_sync test "${IS_DEFAULTROUTE:=1}" = 1 && check_defaultroute + test "${IS_NTP:=1}" = 1 && check_ntp exit ${RC} }