diff --git a/README.md b/README.md index 91bb8d6..2bf89b9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ NAME= # optional PW= # optional, I wouldn't put it here PATTERN="${ACCOUNT}|${ROLE}" # optional, the message you want to see in front of the prompt RENEW_INT= # optional, defaults to token's expiry +INSECURE= # optional, perform "insecure" SSL connections, defaults to false ``` Use option `--example-cfg` to create an example configuration file. diff --git a/afpre b/afpre index cceed3e..6c7f566 100755 --- a/afpre +++ b/afpre @@ -33,6 +33,10 @@ variable_empty() { [ -z "${1}" ] } +variable_true() { + [ "${1}" = true ] +} + options_contain() { grep -q -- "${1}" <<< "${@:2}" } @@ -102,6 +106,11 @@ variable_empty "${PW}" && { echo } +variable_true "${INSECURE}" && { + INSECURE_OPTION="--insecure" + echo WARNING: configured to perform \"insecure\" SSL connections and transfers +} + X1XBN02R=$(encode64 "${NAME}:${PW}") RCFILE=$(mktemp) @@ -122,7 +131,7 @@ error_msg() { } basic_auth() { - curl -f -s -H "Authorization: Basic \${2}" \${1} + curl -f -s ${INSECURE_OPTION} -H "Authorization: Basic \${2}" \${1} } json_value() {