Commit afdcc7cf authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support altnames.

parent 4fae1355
......@@ -3,38 +3,46 @@ set -e
set -u
set -o pipefail
domain="${2}"
token_id="${3}"
token="${4}"
operation="${1}"; shift
case "${1}" in
case "${operation}" in
"deploy_challenge")
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/manage_addFile?id=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/manage_addFile?id=${token_id}")"
while [ "$#" != 0 ]; do
domain="${1}"; shift
token_id="${1}"; shift
token="${1}"; shift
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/manage_addFile?id=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/manage_addFile?id=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
fi
fi
fi
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/${token_id}/manage_edit?title=&content_type=text/plain&filedata=${token}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/${token_id}/manage_edit?title=&content_type=text/plain&filedata=${token}")"
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/${token_id}/manage_edit?title=&content_type=text/plain&filedata=${token}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/${token_id}/manage_edit?title=&content_type=text/plain&filedata=${token}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
fi
fi
fi
done
;;
"clean_challenge")
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/manage_delObjects?ids:list=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/manage_delObjects?ids:list=${token_id}")"
while [ "$#" != 0 ]; do
domain="${1}"; shift
token_id="${1}"; shift
token="${1}"; shift
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/acme-challenge/manage_delObjects?ids:list=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/acme-challenge/manage_delObjects?ids:list=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
fi
fi
fi
done
;;
esac
......
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