Created
May 6, 2024 16:04
-
-
Save da667/5f03ce60c51ccbae6365159637db7ed6 to your computer and use it in GitHub Desktop.
snort3 updater script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#updater.sh - Weekly update script | |
#checks for updates, downloads them, then reboots the system. | |
#place this script in /etc/cron.weekly, ensure it is owned by root (chown root:root /etc/cron.weekly/updater) | |
#ensure the script has execute permissions (chmod 700 /etc/cron.weekly/updater) | |
#if you want updates to run once daily or monthly, you could also place this script into cron.daily, or cron.weekly. | |
#alternatively, edit /etc/crontab to create a crontab entry. | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get -q update | |
apt-get -y -q dist-upgrade | |
python3 /usr/local/etc/snort/pulledpork3/pulledpork.py -c /usr/local/etc/snort/pulledpork3/etc/pulledpork.conf -i -vv | |
logger updater cron job ran successfully. rebooting system | |
init 6 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey folks, this is a pretty basic shell script for my guide on creating a snort3 IDS sensor on debian-based derivatives. It runs apt-get update, dist-upgrade, then pulledpork 3 for not snort rules, then reboots the system. Drop this into
/etc/cron.[hourly|daily|weekly|monthly|yearly]
to have this script run on whatever regular basis you prefer.I recommend no more frequently than daily, because snort/AWS do not look kindly on those who hammer their website for rule updates. The recommendation is to drop this script into
/etc/cron.weekly
. Additonally, do not add the .sh file extension to this file. In the past, adding the .sh extension lead to the script not running. Might have been PEBKAC, but I don't know.After dropping the script into the right
/etc/cron.[time interval]
directory that suits your needs, runchmod 700 /etc/cron.[time interval]/updater
to provide the script execute permissions so that cron can actually run it.