Skip to content

Instantly share code, notes, and snippets.

@bluesku
Last active February 8, 2021 07:19
Show Gist options
  • Save bluesku/32956adfc9d0b73ffe42fb4fa8a5f409 to your computer and use it in GitHub Desktop.
Save bluesku/32956adfc9d0b73ffe42fb4fa8a5f409 to your computer and use it in GitHub Desktop.
Snort-post-install.config
#! /bin/sh
user_config () {
echo '<STARTING CONFIGURATION>'
echo 'add groupadd snort'
groupadd snort
useradd snort -r -s /sbin/nologin -c SNORT_IDS -g snort
mkdir -p /etc/snort/rules/iplists
mkdir /etc/snort/preproc_rules
mkdir /usr/local/lib/snort_dynamicrules
mkdir /etc/snort/so_rules
touch /etc/snort/rules/iplists/black_list.rules
touch /etc/snort/rules/iplists/white_list.rules
touch /etc/snort/rules/local.rules
touch /etc/snort/sid-msg.map
mkdir -p /var/log/snort/archived_logs
chmod -R 5775 /etc/snort
chmod -R 5775 /var/log/snort
chmod -R 5775 /var/log/snort/archived_logs
chmod -R 5775 /etc/snort/so_rules
chmod -R 5775 /usr/local/lib/snort_dynamicrules
chown -R snort:snort /etc/snort
chown -R snort:snort /var/log/snort
chown -R snort:snort /usr/local/lib/snort_dynamicrules
cd -v ~/snort/snort-2.9.17/etc/
cd -v *.conf* /etc/snort
cd -v *.map /etc/snort
cd -v *.dtd /etc/snort
cd -v ~/snort/snort-2.9.17/src/dynamic-preprocessors/build/usr/local/lib/snort_dynamicpreprocessor/
cd -v * /usr/local/lib/snort_dynamicpreprocessor/
return 0
}
user_config
echo 'Function returned an error, check user_config $? '
#Only Uncomment the next 2 lines below if you dont have/messed-up with >>> /etc/snort/snort.conf <<<
#wget https://www.snort.org/documents/snort-2091101-conf || echo 'Check Link from config at.: https://www.snort.org/documents'
#mv -v snort-2091101-conf /etc/snort/snort.conf
# Add Rules Community
wget https://www.snort.org/downloads/community/community-rules.tar.gz || echo 'Check Link from config at.: https://www.snort.org/documents'
tar -xf community-rules.tar.gz -C /etc/snort/
mv -v /etc/snort/community-rules/community.rules /etc/snort/rules/
echo 'include $RULE_PATH/community.rules' >> /etc/snort/snort.conf
echo 'include $RULE_PATH/local.rules' >> /etc/snort/snort.conf
ifconfig -s #Find your network details using ifconfig
read -p 'Please, type your interface.: ' i_face
echo '#[starting] Now just start using SNORT!!!' ; sleep 3
snort -A console -A unsock -l /tmp -u snort -g snort -c /etc/snort/snort.conf -i $i_face
#snort -A console -q -u snort -g snort -c /etc/snort/snort.conf -i $i_face
#snort -d -l snortlog -h $sethost -A console -c snort.conf
@bluesku
Copy link
Author

bluesku commented Feb 5, 2021

#read -p 'SET Snort HOST IP.: ' ip_conf
#echo 'ipvar HOME_NET $ip_conf' >> /etc/snort/snort.conf
#echo 'ipvar EXTERNAL_NET !$HOME_NET
#echo 'var RULE_PATH /etc/snort/rules' >> /etc/snort/snort.conf
#echo 'var SO_RULE_PATH /etc/snort/so_rules' >> /etc/snort/snort.conf
#echo 'var PREPROC_RULE_PATH /etc/snort/preproc_rules' >> /etc/snort/snort.conf
#echo 'var WHITE_LIST_PATH /etc/snort/rules/iplists' >> /etc/snort/snort.conf
#echo 'var BLACK_LIST_PATH /etc/snort/rules/iplists' >> /etc/snort/snort.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment