Keep registration information as json.

In some cases you need your registration id,
for example if you want to request a rate limit exception.
So keep the new-reg output on disk.
This commit is contained in:
Bernd Zeimetz
2016-03-22 14:04:56 +01:00
parent bfeb21ad30
commit d1e573c037
3 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
private_key.pem
private_key.json
domains.txt
config.sh
hook.sh

View File

@@ -36,6 +36,9 @@
# Location of private account key (default: $BASEDIR/private_key.pem)
#PRIVATE_KEY="${BASEDIR}/private_key.pem"
# Location of private account registration information (default: $BASEDIR/private_key.json)
#PRIVATE_KEY_JSON="${BASEDIR}/private_key.json"
# Default keysize for private keys (default: 4096)
#KEYSIZE="4096"

View File

@@ -60,6 +60,7 @@ load_config() {
HOOK_CHAIN="no"
RENEW_DAYS="30"
PRIVATE_KEY=
PRIVATE_KEY_JSON=
KEYSIZE="4096"
WELLKNOWN=
PRIVATE_KEY_RENEW="no"
@@ -106,6 +107,7 @@ load_config() {
[[ -d "${BASEDIR}" ]] || _exiterr "BASEDIR does not exist: ${BASEDIR}"
[[ -z "${PRIVATE_KEY}" ]] && PRIVATE_KEY="${BASEDIR}/private_key.pem"
[[ -z "${PRIVATE_KEY_JSON}" ]] && PRIVATE_KEY_JSON="${BASEDIR}/private_key.json"
[[ -z "${WELLKNOWN}" ]] && WELLKNOWN="${BASEDIR}/.acme-challenges"
[[ -z "${LOCKFILE}" ]] && LOCKFILE="${BASEDIR}/lock"
@@ -171,9 +173,9 @@ init_system() {
[[ ! -z "${CA_NEW_REG}" ]] || _exiterr "Certificate authority doesn't allow registrations."
# If an email for the contact has been provided then adding it to the registration request
if [[ -n "${CONTACT_EMAIL}" ]]; then
signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "contact":["mailto:'"${CONTACT_EMAIL}"'"], "agreement": "'"$LICENSE"'"}' > /dev/null
signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "contact":["mailto:'"${CONTACT_EMAIL}"'"], "agreement": "'"$LICENSE"'"}' > "${PRIVATE_KEY_JSON}"
else
signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null
signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > "${PRIVATE_KEY_JSON}"
fi
fi