Merge 687814203b into 7d50332246
This commit is contained in:
commit
8b9eef4514
@ -20,7 +20,7 @@
|
||||
# Dependencies:
|
||||
# -------------
|
||||
# - jq and curl
|
||||
# - oathtool (When using 2 Factor Authentication and SYNO_TOTP_SECRET is set)
|
||||
# - oathtool or docker (When using 2 Factor Authentication and SYNO_TOTP_SECRET is set)
|
||||
#
|
||||
#returns 0 means success, otherwise error.
|
||||
|
||||
@ -96,8 +96,16 @@ synology_dsm_deploy() {
|
||||
if [ -n "$SYNO_TOTP_SECRET" ]; then
|
||||
if _exists oathtool; then
|
||||
otp_code="$(oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null)"
|
||||
elif _exists docker; then
|
||||
if [[ "$(docker images -q toolbelt/oathtool:latest 2> /dev/null)" == "" ]]; then
|
||||
_err "docker is available but oathtool docker image must be downloaded manually"
|
||||
_err "Please execute manually 'docker image pull toolbelt/oathtool:latest' and relaunch the deployment"
|
||||
return 1
|
||||
else
|
||||
_err "oathtool could not be found, install oathtool to use SYNO_TOTP_SECRET"
|
||||
otp_code="$(docker run --rm -it toolbelt/oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null | cut -b 1-6)"
|
||||
fi
|
||||
else
|
||||
_err "neither oathtool or docker could be found, install oathtool binary or docker synology package to use SYNO_TOTP_SECRET"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user