diff --git a/salt/common/tools/sbin/so-analyst-install b/salt/common/tools/sbin/so-analyst-install index 7ac8524dd..c62474fcf 100755 --- a/salt/common/tools/sbin/so-analyst-install +++ b/salt/common/tools/sbin/so-analyst-install @@ -23,6 +23,43 @@ fi INSTALL_LOG=/root/so-analyst-install.log exec &> >(tee -a "$INSTALL_LOG") +log() { + msg=$1 + level=${2:-I} + now=$(TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ") + echo -e "$now | $level | $msg" >> "$INSTALL_LOG" 2>&1 +} + +error() { + log "$1" "E" +} + +info() { + log "$1" "I" +} + +title() { + echo -e "\n-----------------------------\n $1\n-----------------------------\n" >> "$INSTALL_LOG" 2>&1 +} + +logCmd() { + cmd=$1 + info "Executing command: $cmd" + $cmd >> "$INSTALL_LOG" 2>&1 +} + +analyze_system() { + title "System Characteristics" + logCmd "uptime" + logCmd "uname -a" + logCmd "free -h" + logCmd "lscpu" + logCmd "df -h" + logCmd "ip a" +} + +analyze_system + OS=$(grep PRETTY_NAME /etc/os-release | grep 'CentOS Linux 7') if [ $? -ne 0 ]; then echo "This is an unsupported OS. Please use CentOS 7 to install the analyst node." @@ -37,19 +74,25 @@ else CURLCONTINUE='' fi +FIRSTPASS=yes while [[ $INSTALL != "yes" ]] && [[ $INSTALL != "no" ]]; do - clear - echo "###########################################" - echo "## ** W A R N I N G ** ##" - echo "## _______________________________ ##" - echo "## ##" - echo "## Installing the Security Onion ##" - echo "## analyst node on this device will ##" - echo "## make permanenet changes to ##" - echo "## the system. ##" - echo "## ##" - echo "###########################################" - echo "Do you wish to continue? (Type the entire word 'yes' to proceed or 'no' to exit)" + if [[ "$FIRSTPASS" == "yes" ]]; then + clear + echo "###########################################" + echo "## ** W A R N I N G ** ##" + echo "## _______________________________ ##" + echo "## ##" + echo "## Installing the Security Onion ##" + echo "## analyst node on this device will ##" + echo "## make permanenet changes to ##" + echo "## the system. ##" + echo "## ##" + echo "###########################################" + echo "Do you wish to continue? (Type the entire word 'yes' to proceed or 'no' to exit)" + FIRSTPASS=no + else + echo "Please type 'yes' to continue or 'no' to exit." + fi read INSTALL done @@ -61,10 +104,17 @@ fi echo "Testing for internet connection with curl https://securityonionsolutions.com/" CANCURL=$(curl -sI https://securityonionsolutions.com/ | grep "200 OK") if [ $? -ne 0 ]; then - echo "We could not access https://securityonionsolutions.com/. Since packages are downloaded from the internet in order to configure the analyst node, internet acceess is required. If you would like to ignore this warning and continue anyway, please type 'yes'. Otherwise, type 'no' to exit." - read CURLCONTINUE + FIRSTPASS=yes while [[ $CURLCONTINUE != "yes" ]] && [[ $CURLCONTINUE != "no" ]]; do - echo "We could not access https://securityonionsolutions.com/. Since packages are downloaded from the internet in order to configure the analyst node, internet acceess is required. If you would like to ignore this warning and continue anyway, please type 'yes'. Otherwise, type 'no' to exit." + if [[ "$FIRSTPASS" == "yes" ]]; then + echo "We could not access https://securityonionsolutions.com/." + echo "Since packages are downloaded from the internet, internet acceess is required." + echo "If you would like to ignore this warning and continue anyway, please type 'yes'." + echo "Otherwise, type 'no' to exit." + FIRSTPASS=no + else + echo "Please type 'yes' to continue or 'no' to exit." + fi read CURLCONTINUE done if [[ "$CURLCONTINUE" == "no" ]]; then