Enable state tracking for sigma refresh

This commit is contained in:
Josh Brower
2022-02-28 21:17:59 -05:00
parent 0cee0d5dea
commit 41a58b791a
2 changed files with 23 additions and 6 deletions

View File

@@ -17,11 +17,21 @@
. /usr/sbin/so-common
# Regenerate ElastAlert & update Plays
docker exec so-soctopus python3 playbook_play-update.py
if ! [ -f /opt/so/state/playbook_regen_plays ] || [ "$1" = "--force" ]; then
# Delete current Elastalert Rules
rm /opt/so/rules/elastalert/playbook/*.yaml
echo "Refreshing Sigma & regenerating plays... "
# Regenerate Elastalert Rules
so-playbook-sync
# Regenerate ElastAlert & update Plays
docker exec so-soctopus python3 playbook_play-update.py
# Delete current Elastalert Rules
rm /opt/so/rules/elastalert/playbook/*.yaml
# Regenerate Elastalert Rules
so-playbook-sync
# Create state file
touch /opt/so/state/playbook_regen_plays
else
printf "\nState file found, exiting...\nRerun with --force to override.\n"
fi