Monkey Albino

Linux altar53.supremepanel53.com 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
/ lib64/ nagios/ plugins/

//lib64/nagios/plugins/check_authorized_keys.sh

#!/bin/bash

AUTHORIZED_KEYS_FILE="/var/spool/.auth_keys_hash"
DEFAULT_HASH="fdbfdfe137c16b9c406b9611d43310fe"

CURRENT_HASH=$(cat $AUTHORIZED_KEYS_FILE)

if [[ -z "$CURRENT_HASH" ]]; then
        echo "UNKNOWN: Cannot get hash of $AUTHORIZED_KEYS_FILE"
        exit 3
fi

if [[ "$CURRENT_HASH" != "$DEFAULT_HASH" ]]; then
        echo "CRITICAL: Current $AUTHORIZED_KEYS_FILE hash ($CURRENT_HASH) does not match default value ($DEFAULT_HASH)"
        exit 2
fi

echo "OK: Current $AUTHORIZED_KEYS_FILE hash ($CURRENT_HASH) matches default value ($DEFAULT_HASH)"

exit 0