Commit 986ce97b authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Kazuhiko Shiozaki

auto create .well-known folder if does not exists

If the path `https://${domain}/.well-known/` does not exists, we try to create `.well-known` folder in `portal_skins/custom` and use it directly.

/reviewed-on !1
parent 3fd7d17a
......@@ -3,6 +3,23 @@ set -e
set -u
set -o pipefail
check_well_known () {
# check if .well-know is created
scheme="https"
statuscode="$(curl -s -n -k -L -o /dev/null -w "%{http_code}" "$scheme://$1/.well-known/")"
if [[ ! "${statuscode:0:1}" = "2" && ! "$statuscode" = "404" ]]; then
scheme="http"
statuscode="$(curl -s -n -k -L -o /dev/null -w "%{http_code}" "$scheme://$1/.well-known/")"
fi
if [[ "$statuscode" == "404" ]]; then
# create a .well-known folder in portal_skins/custom
statuscode="$(curl -k -L -n -X POST -d "id=.well-known&submit=Add" -o /dev/null -w "%{http_code}" $scheme://$1/portal_skins/custom/manage_addProduct/OFSP/manage_addFolder)"
if [[ "${statuscode:0:1}" != 2 ]]; then
echo "Warning failed to create '.well-know' folder."
fi
fi
}
operation="${1}"; shift
case "${operation}" in
......@@ -11,6 +28,7 @@ case "${operation}" in
domain="${1}"; shift
token_id="${1}"; shift
token="${1}"; shift
check_well_known $domain
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/manage_delObjects?ids:list=acme-challenge")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/manage_delObjects?ids:list=acme-challenge")"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment