-
-
Save haithemsekri/77258b3f1ef482043113628b7dd6f843 to your computer and use it in GitHub Desktop.
Snort3 User Setup Script
This file contains hidden or 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
| # This is a continuation of the scripting of the installation of Snort3 from the setup guide for Ubuntu 16: | |
| # https://s3.amazonaws.com/snort-org-site/production/document_files/files/000/000/123/original/Snort_3.0.0-a4-223_on_Ubuntu_14_and_16.pdf | |
| # | |
| # This script should be run AFTER the snort_postinstall_setup.sh script here: https://gist.github.com/maravedi/b82ad1d071ab46a5b72b6f507f8437c5 | |
| # | |
| # How to run this script: | |
| # sudo sh snort_user_setup.sh | |
| egrep -i "^snort:" /etc/group; | |
| if [ $? -eq 0 ]; then | |
| echo "group exists: snort" | |
| else | |
| echo "create group: snort" | |
| sudo groupadd snort | |
| fi | |
| egrep -i "^snort:" /etc/passwd; | |
| if [ $? -eq 0 ]; then | |
| echo "user exists: snort" | |
| else | |
| echo "create user: snort" | |
| sudo useradd snort -r -s /sbin/nologin -c SNORT_IDS -g snort | |
| fi | |
| NEW_DIRS="/opt/snort/etc/snort/rules /opt/snort/etc/snort/preproc_rules" | |
| set -- $NEW_DIRS | |
| DIRS=$@ | |
| for i in "$@" | |
| do | |
| if [ -d $i ]; then | |
| echo "directory exists: $i" | |
| else | |
| echo "create directory: $i" | |
| sudo mkdir "$i" | |
| sudo chmod -R 5775 "$i" | |
| sudo chown -R snort:snort "$i" | |
| fi | |
| done | |
| NEW_FILES="/opt/snort/etc/snort/rules/white_list.rules /opt/snort/etc/snort/rules/black_list.rules /opt/snort/etc/snort/rules/local.rules" | |
| set -- $NEW_FILES | |
| FILES=$@ | |
| for i in "$@" | |
| do | |
| if [ -f $i ]; then | |
| echo "file exists: $i" | |
| else | |
| echo "create file: $i" | |
| sudo touch $i | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment