Commit 3fd7d17a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use Script (Python) to support token starts with "_" character.

parent d4454764
This is a hook script of [dehydrated](https://github.com/lukas2511/dehydrated) (former name was letsencrypt.sh) for Zope backends.
First, you need to prepare the target Zope folder beforehand so that URL like http://example.com/.well-known/acme-challenge/xxx works.
For example, you can create the target folder in "portal_skins/custom/.well-known/acme-challenge".
First, you need to prepare the target Zope folder beforehand so that URL like http://example.com/.well-known/xxx works.
For example, you can create the target folder in "portal_skins/custom/.well-known".
Next, you need to provide Zope's username and password in ~/.netrc like :
......
......@@ -11,17 +11,13 @@ case "${operation}" in
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}")"
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/acme-challenge/manage_addFile?id=${token_id}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
fi
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/manage_delObjects?ids:list=acme-challenge")"
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}")"
statuscode="$(curl -s -k -n -L -o /dev/null -w "%{http_code}" "https://${domain}/.well-known/manage_addProduct/PythonScripts/manage_addPythonScript?id=acme-challenge&file=return%20%27${token}%27")"
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 -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/manage_addProduct/PythonScripts/manage_addPythonScript?id=acme-challenge&file=return%20%27${token}%27")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
......@@ -34,9 +30,9 @@ case "${operation}" in
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}")"
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/acme-challenge/manage_delObjects?ids:list=${token_id}")"
statuscode="$(curl -s -n -L -o /dev/null -w "%{http_code}" "http://${domain}/.well-known/manage_delObjects?ids:list=acme-challenge")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
......
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