@@ -99,10 +99,13 @@ http_download_curl() {
9999 local_file=$1
100100 source_url=$2
101101 header=$3
102+ insecure_opt=" "
103+ [ " $INSECURE " = " 1" ] && insecure_opt=" -k"
104+
102105 if [ -z " $header " ]; then
103- code=$( curl -w ' %{http_code}' -sL -o " $local_file " " $source_url " )
106+ code=$( curl $insecure_opt -w ' %{http_code}' -sL -o " $local_file " " $source_url " )
104107 else
105- code=$( curl -w ' %{http_code}' -sL -H " $header " -o " $local_file " " $source_url " )
108+ code=$( curl $insecure_opt -w ' %{http_code}' -sL -H " $header " -o " $local_file " " $source_url " )
106109 fi
107110 if [ " $code " != " 200" ]; then
108111 log_debug " http_download_curl received HTTP status $code "
@@ -115,10 +118,13 @@ http_download_wget() {
115118 local_file=$1
116119 source_url=$2
117120 header=$3
121+ insecure_opt=" "
122+ [ " $INSECURE " = " 1" ] && insecure_opt=" --no-check-certificate"
123+
118124 if [ -z " $header " ]; then
119- wget -q -O " $local_file " " $source_url "
125+ wget $insecure_opt -q -O " $local_file " " $source_url "
120126 else
121- wget -q --header " $header " -O " $local_file " " $source_url "
127+ wget $insecure_opt -q --header " $header " -O " $local_file " " $source_url "
122128 fi
123129}
124130
@@ -253,11 +259,14 @@ Usage: $this [-b] bin_dir [-d] [tag] [-x]
253259 [tag] A tag from https://github.com/orcasecurity/orca-cli/releases
254260 In case a tag is missing, latest tag will be used.
255261 -x enables a mode of the shell where all executed commands are printed to the terminal.
262+ -k Skip SSL certificate verification when downloading
256263
257264EOF
258265 exit 2
259266}
260267
268+ INSECURE=0
269+
261270parse_args () {
262271 # BINDIR default value is /usr/local/bin unless set be ENV
263272 # or over-ridden by flag below
@@ -267,12 +276,13 @@ parse_args() {
267276 else
268277 BINDIR=${BINDIR:-/ usr/ local/ bin}
269278 fi
270- while getopts " b:dh?x " arg; do
279+ while getopts " b:dh?xk " arg; do
271280 case " $arg " in
272281 b) BINDIR=" $OPTARG " ;;
273282 d) log_set_priority 10 ;;
274283 h | \? ) usage " $0 " ;;
275284 x) set -x ;;
285+ k) INSECURE=1 ;;
276286 esac
277287 done
278288
@@ -421,4 +431,3 @@ main(){
421431}
422432
423433main " ${@ } "
424-
0 commit comments