letsencrypt.sh always generates a new key #51

Closed
opened 2025-12-29 00:23:31 +01:00 by adam · 0 comments
Owner

Originally created by @c-MM on GitHub (Feb 5, 2016).

letsencrypt.sh test for "file" for the privkey, but in fact it's a symlink. I fixed it with the following change:

diff --git a/letsencrypt.sh b/letsencrypt.sh
index dad4766..f52eb16 100755
--- a/letsencrypt.sh
+++ b/letsencrypt.sh
@@ -429,7 +429,7 @@ sign_domain() {

   privkey="privkey.pem"
   # generate a new private key if we need or want one
-  if [[ ! -f "${BASEDIR}/certs/${domain}/privkey.pem" ]] || [[ "${PRIVATE_KEY_RENEW}" = "yes" ]]; then
+  if [[ ! -r "${BASEDIR}/certs/${domain}/privkey.pem" ]] || [[ "${PRIVATE_KEY_RENEW}" = "yes" ]]; then
     echo " + Generating private key..."
     privkey="privkey-${timestamp}.pem"
     case "${KEY_ALGO}" in
Originally created by @c-MM on GitHub (Feb 5, 2016). letsencrypt.sh test for "file" for the privkey, but in fact it's a symlink. I fixed it with the following change: ``` diff diff --git a/letsencrypt.sh b/letsencrypt.sh index dad4766..f52eb16 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -429,7 +429,7 @@ sign_domain() { privkey="privkey.pem" # generate a new private key if we need or want one - if [[ ! -f "${BASEDIR}/certs/${domain}/privkey.pem" ]] || [[ "${PRIVATE_KEY_RENEW}" = "yes" ]]; then + if [[ ! -r "${BASEDIR}/certs/${domain}/privkey.pem" ]] || [[ "${PRIVATE_KEY_RENEW}" = "yes" ]]; then echo " + Generating private key..." privkey="privkey-${timestamp}.pem" case "${KEY_ALGO}" in ```
adam closed this issue 2025-12-29 00:23:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#51