Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

sosetup: add '-y' option #592 #22

Merged
merged 2 commits into from
Jul 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions bin/sosetup
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ HR_MEM=$((TOTAL_MEM / 1000))
MEM_TEXT="This machine currently has "$HR_MEM"GB of RAM allocated.\n\For best performance, please ensure the machine is allocated at least 3GB of RAM.\n\n\Please consult the following link for more information:\n\https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware\n\n\
Click 'No' to stop setup and adjust the amount of RAM allocated to this machine.\n\
Otherwise, click 'Yes' to continue."

#########################################
# Debug
#########################################
Expand Down Expand Up @@ -2160,6 +2159,7 @@ Security Onion Setup
-h This message
-f <file> Configure using answer file <file>
-w <file> Create answer file <file>
-y Configure without prompting

Usage: $0
EOF
Expand All @@ -2171,7 +2171,8 @@ EOF
#########################################

# Check to see if the user provided an answer file
while getopts "hf:w:" OPTION
SKIP=0
while getopts "hf:yw:" OPTION
do
case $OPTION in
h)
Expand All @@ -2189,6 +2190,9 @@ do
w)
WRITEANSWERFILE="$OPTARG"
;;
y)
SKIP=1
;;
esac
done

Expand All @@ -2201,7 +2205,7 @@ OUTPUT="gui"
[ -f "$ANSWERFILE" ] && OUTPUT="cli"

# If the user didn't provide an answer file, then ask them the questions
if [ ! -f "$ANSWERFILE" ]; then
if [ ! -f "$ANSWERFILE" ]; then
if [ "$OUTPUT" = "gui" ] ; then
ask
else
Expand All @@ -2224,21 +2228,23 @@ else
# copy SNIFFING_INTERFACES into INTERFACES
INTERFACES="$SNIFFING_INTERFACES"
ADVANCED_SETUP="1"
echo
echo "Security Onion Setup"
echo
echo "Ready to configure system using parameters in $ANSWERFILE."
echo
echo "WARNING! Continuing will destroy any existing data/config."
echo "Are you sure you want to continue?"
echo "Type yes to continue or anything else to exit."
read INPUT
[ "$INPUT" != "yes" ] && exit 0
echo
# If /etc/network/interfaces has not been configured yet, then we need
# to run sosetup-network and pass it the answerfile
if ! grep "Security Onion" /etc/network/interfaces >/dev/null 2>&1; then
/usr/bin/sosetup-network $@
if [ $SKIP -ne 1 ];then
echo
echo "Security Onion Setup"
echo
echo "Ready to configure system using parameters in $ANSWERFILE."
echo
echo "WARNING! Continuing will destroy any existing data/config."
echo "Are you sure you want to continue?"
echo "Type yes to continue or anything else to exit."
read INPUT
[ "$INPUT" != "yes" ] && exit 0
echo
# If /etc/network/interfaces has not been configured yet, then we need
# to run sosetup-network and pass it the answerfile
if ! grep "Security Onion" /etc/network/interfaces >/dev/null 2>&1; then
/usr/bin/sosetup-network $@
fi
fi
fi

Expand Down
3 changes: 2 additions & 1 deletion share/securityonion/sosetup.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ DOMAIN='example.com'
# For example:
# SNIFFING_INTERFACES='eth1 eth2'
SNIFFING_INTERFACES='eth1'

# MTU for sniffing interface(s). Default is 1550.
MTU='1550'
################################
# Master Server
################################
Expand Down