From 4325df46b72e73b99463e2c105e99b264a554ae5 Mon Sep 17 00:00:00 2001 From: liorj-orca <96177663+liorj-orca@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:46:55 +0200 Subject: [PATCH 1/2] Update install.sh - add flag for skipping SSL certificate verification when downloading --- install.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 4d95614..a5fde11 100755 --- a/install.sh +++ b/install.sh @@ -99,10 +99,13 @@ http_download_curl() { local_file=$1 source_url=$2 header=$3 + insecure_opt="" + [ "$INSECURE" = "1" ] && insecure_opt="-k" + if [ -z "$header" ]; then - code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url") + code=$(curl $insecure_opt -w '%{http_code}' -sL -o "$local_file" "$source_url") else - code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url") + code=$(curl $insecure_opt -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url") fi if [ "$code" != "200" ]; then log_debug "http_download_curl received HTTP status $code" @@ -115,10 +118,13 @@ http_download_wget() { local_file=$1 source_url=$2 header=$3 + insecure_opt="" + [ "$INSECURE" = "1" ] && insecure_opt="--no-check-certificate" + if [ -z "$header" ]; then - wget -q -O "$local_file" "$source_url" + wget $insecure_opt -q -O "$local_file" "$source_url" else - wget -q --header "$header" -O "$local_file" "$source_url" + wget $insecure_opt -q --header "$header" -O "$local_file" "$source_url" fi } @@ -253,11 +259,14 @@ Usage: $this [-b] bin_dir [-d] [tag] [-x] [tag] A tag from https://github.com/orcasecurity/orca-cli/releases In case a tag is missing, latest tag will be used. -x enables a mode of the shell where all executed commands are printed to the terminal. + -k Skip SSL certificate verification when downloading EOF exit 2 } +INSECURE=0 + parse_args() { # BINDIR default value is /usr/local/bin unless set be ENV # or over-ridden by flag below @@ -267,12 +276,14 @@ parse_args() { else BINDIR=${BINDIR:-/usr/local/bin} fi - while getopts "b:dh?x" arg; do + while getopts "b:dh?xk" arg; do + log_info "checking $arg" case "$arg" in b) BINDIR="$OPTARG" ;; d) log_set_priority 10 ;; h | \?) usage "$0" ;; x) set -x ;; + k) INSECURE=1 ;; esac done @@ -421,4 +432,3 @@ main(){ } main "${@}" - From 1ba370adf13a5db8b67e23ef10250321562ddd80 Mon Sep 17 00:00:00 2001 From: liorj-orca <96177663+liorj-orca@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:51:21 +0200 Subject: [PATCH 2/2] Update install.sh --- install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install.sh b/install.sh index a5fde11..8bc405d 100755 --- a/install.sh +++ b/install.sh @@ -277,7 +277,6 @@ parse_args() { BINDIR=${BINDIR:-/usr/local/bin} fi while getopts "b:dh?xk" arg; do - log_info "checking $arg" case "$arg" in b) BINDIR="$OPTARG" ;; d) log_set_priority 10 ;;