From ea5b70a3d91d9ed211b8e8e4d641b8fe5c1c2093 Mon Sep 17 00:00:00 2001 From: "et@corde.org" Date: Tue, 8 Dec 2015 14:30:31 +0100 Subject: [PATCH] add CONTACT_EMAIL option on registration --- config.sh.example | 4 ++++ letsencrypt.sh | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.sh.example b/config.sh.example index 9ae870f..d90982d 100644 --- a/config.sh.example +++ b/config.sh.example @@ -17,3 +17,7 @@ # create new private key for each csr (yes|no) #PRIVATE_KEY_RENEW=no + +# email to use during the registration +#CONTACT_EMAIL= + diff --git a/letsencrypt.sh b/letsencrypt.sh index fe9930b..86ee320 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -16,6 +16,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" BASEDIR="${SCRIPTDIR}" OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf" ROOTCERT="lets-encrypt-x1-cross-signed.pem" +CONTACT_EMAIL= # If exists load config from same directory as this script if [[ -e "${BASEDIR}/config.sh" ]]; then @@ -250,7 +251,12 @@ thumbprint="$(printf '%s' "$(printf '%s' '{"e":"'"${pubExponent64}"'","kty":"RSA # If we generated a new private key in the step above we have to register it with the acme-server if [[ "${register}" = "1" ]]; then echo "+ Registering account key with letsencrypt..." - signed_request "${CA}/acme/new-reg" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null + # if an email for the contact has been provided then adding it to the registration request + if [ -n "${CONTACT_EMAIL}" ]; then + signed_request "${CA}/acme/new-reg" '{"resource": "new-reg", "contact":["mailto:'"${CONTACT_EMAIL}"'"], "agreement": "'"$LICENSE"'"}' > /dev/null + else + signed_request "${CA}/acme/new-reg" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null + fi fi if [[ -e "${BASEDIR}/domains.txt" ]]; then -- 2.39.5