Security-Onion-Solutions / securityonion

Security Onion is a free and open platform for threat hunting, enterprise security monitoring, and log management. It includes our own interfaces for alerting, dashboards, hunting, PCAP, detections, and case management. It also includes other tools such as osquery, CyberChef, Elasticsearch, Logstash, Kibana, Suricata, and Zeek.
https://securityonion.net
3.22k stars 499 forks source link

Check for RAM and other requirements #579

Closed dougburks closed 4 years ago

dougburks commented 4 years ago

Installer should check RAM and other hardware requirements and prompt the user if necessary.

dougburks commented 4 years ago

Here's how we check RAM in current platform (although of course minimum requirements are higher in HH): https://github.com/Security-Onion-Solutions/securityonion-setup/blob/master/bin/sosetup#L211-L221

# Check amount of system RAM (MB)
TOTAL_MEM=`grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//'`
# Make RAM # human readable (GB)
HR_MEM=$((TOTAL_MEM / 1000))
# Text for minimum memory check
MEM_TEXT="This machine currently has "$HR_MEM"GB of RAM allocated.\n\nFor best performance, please ensure the machine is allocated at least 8GB of RAM.\n\nPlease consult the following link for more information:\nhttps://securityonion.net/docs/Hardware\n
Select 'No' to stop setup and adjust the amount of RAM allocated to this machine.\n
Otherwise, select 'Yes' to continue."
# Text for minimum core check
CORE_TEXT="This machine currently has "$CORES" processor core(s) allocated.\n\nFor best performance, please ensure the machine is allocated at least 2 processor cores.\n\nPlease consult the following link for more information:\nhttps://securityonion.net/docs/Hardware\n
Select 'No' to stop setup and adjust the number of processor cores allocated to this machine.\n
Otherwise, select 'Yes' to continue."
# CORES is the number of CPU cores in the box
# This is used for limiting IDS_LB_PROCS and BRO_LB_PROCS
CORES=`grep -c ^processor /proc/cpuinfo`
if [ $TOTAL_MEM -lt 8000 ]; then
    promptyesno "$MEM_TEXT"
    [ $? = 1 ] && exit 1
        [ $DEBUG -eq 1 ] && echo "DEBUG: Continuing, despite low RAM."
fi

if [ $CORES -lt 2 ]; then
    promptyesno "$CORE_TEXT"
    [ $? = 1 ] && exit 1
    [ $DEBUG -eq 1 ] && echo "DEBUG: Continuing, despite low core count."
fi