code-dumps/sh/aide-check.sh
2021-12-05 11:24:57 +08:00

9 lines
338 B
Bash

#!/bin/bash
aide --check -r file:/var/log/aide-check.log
COUNT=$(egrep '(Added|Removed|Changed).*[0-9]' /var/log/aide-check.log | awk '{SUM+=$NF}; END {print SUM}')
if [ $COUNT -gt 0 ]; then
# changes detected
cat /var/log/aide-check.log | mailx -s "AIDE alert" -r security@your-domain.com -- yourself@your-domain.com
fi