]> git.street.me.uk Git - andy/dehydrated.git/commitdiff
add CONTACT_EMAIL option on registration
authoret@corde.org <et@corde.org>
Tue, 8 Dec 2015 13:30:31 +0000 (14:30 +0100)
committerLukas Schauer <lukas@schauer.so>
Tue, 8 Dec 2015 13:38:13 +0000 (14:38 +0100)
config.sh.example
letsencrypt.sh

index 9ae870f1e0d6f7928cfc5052f5b1522e320b0007..d90982d33563bcfc43333cd924dbb352d85d5b8a 100644 (file)
@@ -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=
+
index fe9930b583f38cc391cf52afd1cda2fe71839510..86ee3207ef98a49b0bc1112540f74e6f9258e57c 100755 (executable)
@@ -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