install.fairie/home/dot_config/rkhunter/cron

33 lines
781 B
Text
Raw Normal View History

2023-07-31 23:28:03 -07:00
#!/usr/bin/env bash
2023-07-31 23:28:03 -07:00
# Include configuration
if [ -f /usr/local/etc/rkhunter.conf ]; then
. /usr/local/etc/rkhunter.conf
elif [ -f /etc/rkhunter.conf ]; then
. /etc/rkhunter.conf
else
echo "Failed to find rkhunter.conf file" && exit 1
fi
if [ -z "$NICE" ]; then
NICE=0
fi
case "$CRON_DAILY_RUN" in
[YyTt]*)
2023-07-31 23:28:03 -07:00
OUTFILE="$(mktemp)"
nice -n $NICE rkhunter --cronjob --report-warnings-only --update --appendlog > $OUTFILE
if [ -s "$OUTFILE" -a -n "$REPORT_EMAIL" ]; then
(
2023-07-31 23:28:03 -07:00
echo "Subject: [rkhunter] $(hostname) - Daily Report"
echo "To: $REPORT_EMAIL"
echo ""
cat $OUTFILE
2023-07-31 23:28:03 -07:00
) | mailx $REPORT_EMAIL
fi
rm -f $OUTFILE
;;
*)
exit 0
;;
2023-07-31 23:28:03 -07:00
esac