Commit e0b94a68 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Rewrite to use a hook script only.

parent ba3ee2e0
First, prepare target Zope folder beforehand so that URL like http://example.com/.well-known/acme-challenge/xxx works. First, prepare target Zope folder beforehand so that URL like http://example.com/.well-known/acme-challenge/xxx works.
Set following values in the config file: Next, you need to provide Zope's username and password in ~/.netrc like :
- URL=http://example.com/.well-known/acme-challenge
- USER=zope_user ```text
- PASSWORD=zope_password machine example.com
login zope_username
password zope_password
```
Now you can invoke the script like : Now you can invoke the script like :
```text ```text
./letsencrypt.sh --cron --domain example.com --config path/to/config ./letsencrypt.sh --cron --domain example.com --hook ./zope-hook.sh
``` ```
...@@ -403,7 +403,6 @@ sign_csr() { ...@@ -403,7 +403,6 @@ sign_csr() {
# Store challenge response in well-known location and make world-readable (so that a webserver can access it) # Store challenge response in well-known location and make world-readable (so that a webserver can access it)
printf '%s' "${keyauth}" > "${WELLKNOWN}/${challenge_token}" printf '%s' "${keyauth}" > "${WELLKNOWN}/${challenge_token}"
chmod a+r "${WELLKNOWN}/${challenge_token}" chmod a+r "${WELLKNOWN}/${challenge_token}"
curl -u "${USER}:${PASSWORD}" -F "id=${challenge_token}" -F "file=@${WELLKNOWN}/${challenge_token}" "${URL}/manage_addFile"
keyauth_hook="${keyauth}" keyauth_hook="${keyauth}"
;; ;;
"dns-01") "dns-01")
...@@ -447,7 +446,6 @@ sign_csr() { ...@@ -447,7 +446,6 @@ sign_csr() {
done done
[[ "${CHALLENGETYPE}" = "http-01" ]] && rm -f "${WELLKNOWN}/${challenge_token}" [[ "${CHALLENGETYPE}" = "http-01" ]] && rm -f "${WELLKNOWN}/${challenge_token}"
[[ "${CHALLENGETYPE}" = "http-01" ]] && curl -u "${USER}:${PASSWORD}" -F "ids:list=${challenge_token}" "${URL}/manage_delObjects"
# Wait for hook script to clean the challenge if used # Wait for hook script to clean the challenge if used
if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" != "yes" ]] && [[ -n "${challenge_token}" ]]; then if [[ -n "${HOOK}" ]] && [[ "${HOOK_CHAIN}" != "yes" ]] && [[ -n "${challenge_token}" ]]; then
......
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
domain="${2}"
challenge_token="${3}"
case "${1}" in
"deploy_challenge")
url_effective="$(curl -s -n -L -o /dev/null -w "%{url_effective}" -F "id=${challenge_token}" -F "file=@${WELLKNOWN}/${challenge_token}" "https://${domain}/.well-known/acme-challenge/manage_addFile")"
if [[ "${url_effective}" != "https://${domain}/.well-known/acme-challenge/manage_main" ]]; then
url_effective="$(curl -s -n -L -o /dev/null -w "%{url_effective}" -F "id=${challenge_token}" -F "file=@${WELLKNOWN}/${challenge_token}" "http://${domain}/.well-known/acme-challenge/manage_addFile")"
if [[ "${url_effective}" != "http://${domain}/.well-known/acme-challenge/manage_main" ]]; then
echo 'Failed'
exit 1
fi
fi
;;
"clean_challenge")
url_effective="$(curl -s -n -L -o /dev/null -w "%{url_effective}" -F "ids:list=${challenge_token}" "https://${domain}/.well-known/acme-challenge/manage_delObjects")"
if [[ "${url_effective}" != "https://${domain}/.well-known/acme-challenge/manage_delObjects" ]]; then
url_effective="$(curl -s -n -L -o /dev/null -w "%{url_effective}" -F "ids:list=${challenge_token}" "http://${domain}/.well-known/acme-challenge/manage_delObjects")"
if [[ "${url_effective}" != "http://${domain}/.well-known/acme-challenge/manage_delObjects" ]]; then
echo 'Failed'
exit 1
fi
fi
;;
esac
exit 0
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