From 946cf81a27d6883b07a6a42cc55a5d24536791fe Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 12 Oct 2021 09:47:25 -0400 Subject: [PATCH 1/4] If ANALYST is selected immediately quit setup --- setup/so-setup | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/setup/so-setup b/setup/so-setup index 7d5ae0a0e..998bdbe05 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -256,7 +256,8 @@ elif [ "$install_type" = 'HELIXSENSOR' ]; then elif [ "$install_type" = 'IMPORT' ]; then is_import=true elif [ "$install_type" = 'ANALYST' ]; then - is_analyst=true + cd .. || exit 255 + exec bash so-analyst-install fi if [[ $is_manager || $is_import ]]; then @@ -337,11 +338,6 @@ if ! [[ -f $install_opt_file ]]; then exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}" fi - if [[ $is_analyst ]]; then - cd .. || exit 255 - exec bash so-analyst-install - fi - else rm -rf $install_opt_file >> "$setup_log" 2>&1 fi From af687b070640ff87c6f50f1ee9ae8ff652832f3c Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 12 Oct 2021 10:10:34 -0400 Subject: [PATCH 2/4] Remove all holds on Ubuntu reinstall --- setup/so-functions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup/so-functions b/setup/so-functions index f7d489f42..c808cc6b2 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -2037,7 +2037,7 @@ reinstall_init() { if command -v docker &> /dev/null; then # Stop and remove all so-* containers so files can be changed with more safety - if [ $(docker ps -a -q --filter "name=so-" | wc -l) -gt 0 ]; then + if [[ $(docker ps -a -q --filter "name=so-" | wc -l) -gt 0 ]]; then docker stop $(docker ps -a -q --filter "name=so-") docker rm -f $(docker ps -a -q --filter "name=so-") fi @@ -2056,6 +2056,10 @@ reinstall_init() { # Remove the old launcher package in case the config changes remove_package launcher-final + if [[ $OS == 'ubuntu' ]]; then + apt-mark unhold $(apt-mark showhold) + fi + } >> "$setup_log" 2>&1 } From 36e17952950156ce876b4483d2eedd5409434bb8 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 12 Oct 2021 10:19:47 -0400 Subject: [PATCH 3/4] Add end of setup log messages per #5032 --- setup/so-functions | 4 ++++ setup/so-setup | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index c808cc6b2..30ccc2761 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1537,6 +1537,10 @@ install_cleanup() { info "Removing so-setup permission entry from sudoers file" sed -i '/so-setup/d' /etc/sudoers fi + + if [[ -z $SO_ERROR ]]; then + echo "Setup completed at $(date)" >> "$setup_log" 2>&1 + fi } import_registry_docker() { diff --git a/setup/so-setup b/setup/so-setup index 998bdbe05..d050b80ff 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -935,7 +935,6 @@ if [[ -n $SO_ERROR ]]; then SKIP_REBOOT=1 whiptail_setup_failed - else echo "Successfully completed setup! Continuing with post-installation steps" >> $setup_log 2>&1 { @@ -965,9 +964,9 @@ else } | whiptail_gauge_post_setup "Running post-installation steps..." + echo "Post-installation steps have completed. Awaiting user input to clean up installer." >> $setup_log 2>&1 whiptail_setup_complete [[ $setup_type != 'iso' ]] && whitpail_ssh_warning - echo "Post-installation steps have completed." >> $setup_log 2>&1 fi install_cleanup >> "$setup_log" 2>&1 From b97361fab976d2d7076958b878d06652e80f18e0 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 12 Oct 2021 10:23:39 -0400 Subject: [PATCH 4/4] Remove references to xenial in setup Resolves #4292 --- setup/so-functions | 31 +++++++++---------------------- setup/so-preflight | 3 +-- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 30ccc2761..32e84bd9d 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1207,11 +1207,7 @@ docker_install() { retry 50 10 "apt-get update" >> "$setup_log" 2>&1 || exit 1 ;; esac - if [ $OSVER != "xenial" ]; then - retry 50 10 "apt-get -y install docker-ce python3-docker" >> "$setup_log" 2>&1 || exit 1 - else - retry 50 10 "apt-get -y install docker-ce python-docker" >> "$setup_log" 2>&1 || exit 1 - fi + retry 50 10 "apt-get -y install docker-ce python3-docker" >> "$setup_log" 2>&1 || exit 1 fi docker_registry { @@ -2172,10 +2168,10 @@ saltify() { DEBIAN_FRONTEND=noninteractive retry 50 10 "apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" upgrade" >> "$setup_log" 2>&1 || exit 1 if [ $OSVER == "bionic" ]; then - # Switch to Python 3 as default if this is not xenial + # Switch to Python 3 as default for bionic update-alternatives --install /usr/bin/python python /usr/bin/python3.6 10 >> "$setup_log" 2>&1 elif [ $OSVER == "focal" ]; then - # Switch to Python 3 as default if this is not xenial + # Switch to Python 3 as default for focal update-alternatives --install /usr/bin/python python /usr/bin/python3.8 10 >> "$setup_log" 2>&1 fi @@ -2194,21 +2190,16 @@ saltify() { # Grab the version from the os-release file local ubuntu_version ubuntu_version=$(grep VERSION_ID /etc/os-release | awk -F '[ "]' '{print $2}') - if [ "$OSVER" != "xenial" ]; then local py_ver_url_path="/py3"; else local py_ver_url_path="/apt"; fi case "$install_type" in 'FLEET') - if [[ $OSVER != 'xenial' ]]; then - retry 50 10 "apt-get -y install python3-mysqldb" >> "$setup_log" 2>&1 || exit 1 - else - retry 50 10 "apt-get -y install python-mysqldb" >> "$setup_log" 2>&1 || exit 1 - fi + retry 50 10 "apt-get -y install python3-mysqldb" >> "$setup_log" 2>&1 || exit 1 ;; 'MANAGER' | 'EVAL' | 'MANAGERSEARCH' | 'STANDALONE' | 'IMPORT' | 'HELIXSENSOR') # Add saltstack repo(s) - wget -q --inet4-only -O - https://repo.saltstack.com"$py_ver_url_path"/ubuntu/"$ubuntu_version"/amd64/archive/3003/SALTSTACK-GPG-KEY.pub | apt-key add - >> "$setup_log" 2>&1 - echo "deb http://repo.saltstack.com$py_ver_url_path/ubuntu/$ubuntu_version/amd64/archive/3003 $OSVER main" > /etc/apt/sources.list.d/saltstack.list 2>> "$setup_log" + wget -q --inet4-only -O - https://repo.saltstack.com/py3/ubuntu/"$ubuntu_version"/amd64/archive/3003/SALTSTACK-GPG-KEY.pub | apt-key add - >> "$setup_log" 2>&1 + echo "deb http://repo.saltstack.com/py3/ubuntu/$ubuntu_version/amd64/archive/3003 $OSVER main" > /etc/apt/sources.list.d/saltstack.list 2>> "$setup_log" # Add Docker repo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - >> "$setup_log" 2>&1 @@ -2216,7 +2207,7 @@ saltify() { # Get gpg keys mkdir -p /opt/so/gpg >> "$setup_log" 2>&1 - wget -q --inet4-only -O /opt/so/gpg/SALTSTACK-GPG-KEY.pub https://repo.saltstack.com$py_ver_url_path/ubuntu/"$ubuntu_version"/amd64/archive/3003/SALTSTACK-GPG-KEY.pub >> "$setup_log" 2>&1 + wget -q --inet4-only -O /opt/so/gpg/SALTSTACK-GPG-KEY.pub https://repo.saltstack.com/py3/ubuntu/"$ubuntu_version"/amd64/archive/3003/SALTSTACK-GPG-KEY.pub >> "$setup_log" 2>&1 wget -q --inet4-only -O /opt/so/gpg/docker.pub https://download.docker.com/linux/ubuntu/gpg >> "$setup_log" 2>&1 wget -q --inet4-only -O /opt/so/gpg/GPG-KEY-WAZUH https://packages.wazuh.com/key/GPG-KEY-WAZUH >> "$setup_log" 2>&1 @@ -2240,7 +2231,7 @@ saltify() { echo "Using apt-key add to add SALTSTACK-GPG-KEY.pub and GPG-KEY-WAZUH" >> "$setup_log" 2>&1 apt-key add "$temp_install_dir"/gpg/SALTSTACK-GPG-KEY.pub >> "$setup_log" 2>&1 apt-key add "$temp_install_dir"/gpg/GPG-KEY-WAZUH >> "$setup_log" 2>&1 - echo "deb http://repo.saltstack.com$py_ver_url_path/ubuntu/$ubuntu_version/amd64/archive/3003/ $OSVER main" > /etc/apt/sources.list.d/saltstack.list 2>> "$setup_log" + echo "deb http://repo.saltstack.com/py3/ubuntu/$ubuntu_version/amd64/archive/3003/ $OSVER main" > /etc/apt/sources.list.d/saltstack.list 2>> "$setup_log" echo "deb https://packages.wazuh.com/3.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list 2>> "$setup_log" ;; esac @@ -2249,11 +2240,7 @@ saltify() { set_progress_str 8 'Installing salt-minion & python modules' retry 50 10 "apt-get -y install salt-minion=3003+ds-1 salt-common=3003+ds-1" >> "$setup_log" 2>&1 || exit 1 retry 50 10 "apt-mark hold salt-minion salt-common" >> "$setup_log" 2>&1 || exit 1 - if [[ $OSVER != 'xenial' ]]; then - retry 50 10 "apt-get -y install python3-pip python3-dateutil python3-m2crypto python3-mysqldb python3-packaging python3-influxdb" >> "$setup_log" 2>&1 || exit 1 - else - retry 50 10 "apt-get -y install python-pip python-dateutil python-m2crypto python-mysqldb python-packaging python-influxdb" >> "$setup_log" 2>&1 || exit 1 - fi + retry 50 10 "apt-get -y install python3-pip python3-dateutil python3-m2crypto python3-mysqldb python3-packaging python3-influxdb" >> "$setup_log" 2>&1 || exit 1 fi } diff --git a/setup/so-preflight b/setup/so-preflight index e58feebd2..2943191eb 100644 --- a/setup/so-preflight +++ b/setup/so-preflight @@ -54,11 +54,10 @@ check_new_repos() { else local ubuntu_version ubuntu_version=$(grep VERSION_ID /etc/os-release 2> /dev/null | awk -F '[ "]' '{print $2}') - if [ "$OSVER" != "xenial" ]; then local py_ver_url_path="/py3"; else local py_ver_url_path="/apt"; fi local repo_arr=( "https://download.docker.com/linux/ubuntu/gpg" "https://download.docker.com/linux/ubuntu" - "https://repo.saltstack.com$py_ver_url_path/ubuntu/$ubuntu_version/amd64/archive/3003/SALTSTACK-GPG-KEY.pub" + "https://repo.saltstack.com/py3/ubuntu/$ubuntu_version/amd64/archive/3003/SALTSTACK-GPG-KEY.pub" "https://packages.wazuh.com/key/GPG-KEY-WAZUH" "https://packages.wazuh.com" )