mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Setup Script - Added several functions
This commit is contained in:
@@ -24,47 +24,32 @@ CPUCORES=$(cat /proc/cpuinfo | grep processor | wc -l)
|
|||||||
# End Global Variable Section
|
# End Global Variable Section
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
es_heapsize () {
|
|
||||||
# Determine ES Heap Size
|
|
||||||
if [ $TOTAL_MEM -lt 8000 ] ; then
|
|
||||||
ES_HEAP_SIZE="600m"
|
|
||||||
elif [ $TOTAL_MEM -ge 124000 ]; then
|
|
||||||
# Set a max of 31GB for heap size
|
|
||||||
# https://www.elastic.co/guide/en/elasticsearch/guide/current/heap-sizing.html
|
|
||||||
ES_HEAP_SIZE="31000m"
|
|
||||||
else
|
|
||||||
# Set heap size to 25% of available memory
|
|
||||||
ES_HEAP_SIZE=$(($TOTAL_MEM / 4))"m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ls_heapsize () {
|
configure_minion () {
|
||||||
# Determine LS Heap Size
|
local TYPE=$1
|
||||||
if [ $TOTAL_MEM -ge 16000 ] ; then
|
|
||||||
LS_HEAP_SIZE="4192m"
|
|
||||||
else
|
|
||||||
# Set a max of 1GB heap if you have less than 16GB RAM
|
|
||||||
LS_HEAP_SIZE="1g"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_sensor () {
|
|
||||||
# Configure Sensor
|
|
||||||
touch /etc/salt/grains
|
touch /etc/salt/grains
|
||||||
echo "role: so-sensor" > /etc/salt/grains
|
echo "role: so-$TYPE" > /etc/salt/grains
|
||||||
# Master server
|
|
||||||
echo "master: $MASTER" > /etc/salt/minion
|
echo "master: $MASTER" > /etc/salt/minion
|
||||||
# Start the salt agent
|
|
||||||
service salt-minion start
|
service salt-minion start
|
||||||
|
}
|
||||||
|
copy_pillar () {
|
||||||
|
local TYPE=$1
|
||||||
|
|
||||||
# Do a checkin so the key gets there. Need to add some error checking here
|
if [ $TYPE = 'STORAGENODE' ]; then
|
||||||
salt-call state.highstate
|
PLOC="nodes"
|
||||||
|
else
|
||||||
|
PLOC="sensors"
|
||||||
|
fi
|
||||||
|
scp /tmp/$HOSTNAME.sls /opt/so/saltstack/pillar/$PLOC/
|
||||||
|
}
|
||||||
|
configure_sensor () {
|
||||||
|
|
||||||
# Create the pillar file for the sensor
|
# Create the pillar file for the sensor
|
||||||
touch /tmp/$HOSTNAME.sls
|
touch /tmp/$HOSTNAME.sls
|
||||||
echo "sensors:" > /tmp/$HOSTNAME.sls
|
echo "sensors:" > /tmp/$HOSTNAME.sls
|
||||||
echo " interface: bond0" >> /tmp/$HOSTNAME.sls
|
echo " interface: bond0" >> /tmp/$HOSTNAME.sls
|
||||||
echo " lbprocs: $LBPROCS" >> /tmp/$HOSTNAME.sls
|
echo " bro_lbprocs: $LBPROCS" >> /tmp/$HOSTNAME.sls
|
||||||
# Need to add pins loop
|
# Need to add pins loop
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -109,6 +94,20 @@ disk_space () {
|
|||||||
# Give me Disk Space
|
# Give me Disk Space
|
||||||
}
|
}
|
||||||
|
|
||||||
|
es_heapsize () {
|
||||||
|
# Determine ES Heap Size
|
||||||
|
if [ $TOTAL_MEM -lt 8000 ] ; then
|
||||||
|
ES_HEAP_SIZE="600m"
|
||||||
|
elif [ $TOTAL_MEM -ge 124000 ]; then
|
||||||
|
# Set a max of 31GB for heap size
|
||||||
|
# https://www.elastic.co/guide/en/elasticsearch/guide/current/heap-sizing.html
|
||||||
|
ES_HEAP_SIZE="31000m"
|
||||||
|
else
|
||||||
|
# Set heap size to 25% of available memory
|
||||||
|
ES_HEAP_SIZE=$(($TOTAL_MEM / 4))"m"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
filter_nics () {
|
filter_nics () {
|
||||||
FNICS=$(ip link | grep -vw $MNIC | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}')
|
FNICS=$(ip link | grep -vw $MNIC | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}')
|
||||||
}
|
}
|
||||||
@@ -123,6 +122,17 @@ got_root () {
|
|||||||
install_master () {
|
install_master () {
|
||||||
yum -y install salt-master
|
yum -y install salt-master
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ls_heapsize () {
|
||||||
|
# Determine LS Heap Size
|
||||||
|
if [ $TOTAL_MEM -ge 16000 ] ; then
|
||||||
|
LS_HEAP_SIZE="4192m"
|
||||||
|
else
|
||||||
|
# Set a max of 1GB heap if you have less than 16GB RAM
|
||||||
|
LS_HEAP_SIZE="1g"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
master_pillar () {
|
master_pillar () {
|
||||||
# Create the master pillar
|
# Create the master pillar
|
||||||
touch /opt/so/saltstack/pillar/masters/$HOSTNAME.sls
|
touch /opt/so/saltstack/pillar/masters/$HOSTNAME.sls
|
||||||
@@ -252,6 +262,10 @@ whiptail_management_server () {
|
|||||||
MASTERSRV=$(whiptail --title "Enter your Master Server IP Address" --inputbox 10 60 1.2.3.4 3>&1 1>&2 2>&3)
|
MASTERSRV=$(whiptail --title "Enter your Master Server IP Address" --inputbox 10 60 1.2.3.4 3>&1 1>&2 2>&3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
whiptail_network_notice () {
|
||||||
|
whiptail --title "Security Onion Setup" --msgbox "Since this is a network install we assume the management interface, DNS, Hostname, etc are already set up. You must hit OK to continue." 8 78
|
||||||
|
}
|
||||||
|
|
||||||
whiptail_rule_setup () {
|
whiptail_rule_setup () {
|
||||||
# Get pulled pork info
|
# Get pulled pork info
|
||||||
RULESETUP=$(whiptail --title "Security Onion Setup" --radiolist \
|
RULESETUP=$(whiptail --title "Security Onion Setup" --radiolist \
|
||||||
@@ -279,7 +293,7 @@ detect_os
|
|||||||
if (whiptail --title "Security Onion Setup" --yesno "Are you sure you want to install Security Onion over the internet?" 8 78) then
|
if (whiptail --title "Security Onion Setup" --yesno "Are you sure you want to install Security Onion over the internet?" 8 78) then
|
||||||
|
|
||||||
# Let folks know they need their management interface already set up.
|
# Let folks know they need their management interface already set up.
|
||||||
whiptail --title "Security Onion Setup" --msgbox "Since this is a network install we assume the management interface, DNS, Hostname, etc are already set up. You must hit OK to continue." 8 78
|
whiptail_network_notice
|
||||||
|
|
||||||
# What kind of install are we doing?
|
# What kind of install are we doing?
|
||||||
whiptail_install_type
|
whiptail_install_type
|
||||||
|
|||||||
Reference in New Issue
Block a user