fix: load security monitor telegram credentials from root-only env file
This commit is contained in:
+11
-2
@@ -42,8 +42,17 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
umask 077 # state files hold key fingerprints and source IPs
|
umask 077 # state files hold key fingerprints and source IPs
|
||||||
|
|
||||||
TELEGRAM_BOT="8602530664:AAFE7tsRY79zhhEjU7sRR7MrS8p3FB0jvXg"
|
# Telegram credentials live outside the script (it's in a public repo): a root-only env file
|
||||||
TELEGRAM_CHAT_ID="108712105"
|
# with TELEGRAM_BOT=... and TELEGRAM_CHAT_ID=... lines. Fail loudly if it's missing rather than
|
||||||
|
# running a monitor that silently can't alert.
|
||||||
|
TELEGRAM_ENV="${TELEGRAM_ENV:-/root/.security-monitor/telegram.env}"
|
||||||
|
if [ ! -r "$TELEGRAM_ENV" ]; then
|
||||||
|
echo "ERROR: $TELEGRAM_ENV missing or unreadable — no way to send alerts" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$TELEGRAM_ENV"
|
||||||
|
: "${TELEGRAM_BOT:?not set in $TELEGRAM_ENV}" "${TELEGRAM_CHAT_ID:?not set in $TELEGRAM_ENV}"
|
||||||
|
|
||||||
DISK_ALERT_PCT="${DISK_ALERT_PCT:-90}" # alert once usage reaches this
|
DISK_ALERT_PCT="${DISK_ALERT_PCT:-90}" # alert once usage reaches this
|
||||||
DISK_RECOVER_PCT="${DISK_RECOVER_PCT:-85}" # ...and don't re-arm until it drops back below this (hysteresis)
|
DISK_RECOVER_PCT="${DISK_RECOVER_PCT:-85}" # ...and don't re-arm until it drops back below this (hysteresis)
|
||||||
|
|||||||
Reference in New Issue
Block a user