Commit 4fae1355 authored by Kazuhiko's avatar Kazuhiko

initial commit.

parents
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 ".well-known/acme-challenge" in skin folder.
Next, you need to provide Zope's username and password in ~/.netrc like :
```text
machine example.com
login zope_username
password zope_password
```
You need to prepare "config" file like :
```text
# See https://github.com/lukas2511/dehydrated/blob/master/docs/examples/config for other parameters.
#
# We can use any local directory for storing challenge string temporarily.
WELLKNOWN="${BASEDIR}"
# We use a special hook script for zope.
HOOK="${BASEDIR}/zope-hook.sh"
#This is needed to call hook
HOOK_CHAIN=yes
```
You also need "domains.txt" like :
```text
www.example.com example.com
another.example.com
```
Now you can invoke the script like :
```text
./dehydrated -c
```
And if you have any problems, read [Troubleshooting](https://github.com/lukas2511/dehydrated/blob/master/docs/troubleshooting.md) and read ``dehydrated`` source code.
# See https://github.com/lukas2511/dehydrated/blob/master/docs/examples/config for other parameters.
#
# We can use any local directory for storing challenge string temporarily.
WELLKNOWN="${BASEDIR}"
# We use a special hook script for zope.
HOOK="${BASEDIR}/zope-hook.sh"
#This is needed to call hook
HOOK_CHAIN=yes
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
domain="${2}"
token_id="${3}"
token="${4}"
case "${1}" 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}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
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}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; then
echo 'Failed'
exit 1
fi
fi
;;
"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}")"
if [[ ! "${statuscode:0:1}" = "2" ]]; 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