From 330ad6540e16b74fcce7f7d29aed08eedef62771 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 8 Dec 2020 08:45:49 -0500 Subject: [PATCH] Check if user is root before starting deploy_linux script If the user is root, we want to exit as soon as possible since any commands that the deployment script runs will be run as root. --- deployment_scripts/deploy_linux.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deployment_scripts/deploy_linux.sh b/deployment_scripts/deploy_linux.sh index d13478018..1f21fb758 100755 --- a/deployment_scripts/deploy_linux.sh +++ b/deployment_scripts/deploy_linux.sh @@ -23,6 +23,11 @@ log_message() { echo -e "DEPLOYMENT SCRIPT: $1" } +if is_root; then + log_message "Please don't run this script as root" + exit 1 +fi + config_branch=${2:-"develop"} config_url="https://raw.githubusercontent.com/guardicore/monkey/${config_branch}/deployment_scripts/config" @@ -62,11 +67,6 @@ ISLAND_BINARIES_PATH="$ISLAND_PATH/cc/binaries" INFECTION_MONKEY_DIR="$monkey_home/monkey/infection_monkey" MONKEY_BIN_DIR="$INFECTION_MONKEY_DIR/bin" -if is_root; then - log_message "Please don't run this script as root" - exit 1 -fi - HAS_SUDO=$(has_sudo) if [[ ! $HAS_SUDO ]]; then log_message "You need root permissions for some of this script operations. Quiting."