From 310a56df8115af5cdc420a177bb3cba475c98bc5 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Mon, 4 Apr 2022 09:47:00 +0200 Subject: [PATCH] Bugfix: copy key from csr folder to ~/.acme/ --- cm.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cm.sh b/cm.sh index e3dc9da..166117d 100755 --- a/cm.sh +++ b/cm.sh @@ -27,6 +27,7 @@ # 2022-01-10 <axel.hahn@iml.unibe.ch> _wait_for_free_slot: exclude ssh calls # 2022-03-30 <axel.hahn@iml.unibe.ch> remove usage of csr and generation of key file # 2022-03-31 <axel.hahn@iml.unibe.ch> dns authentication with alias domain +# 2022-04-04 <axel.hahn@iml.unibe.ch> Bugfix: copy key from csr folder to ~/.acme/ # ====================================================================== @@ -516,6 +517,20 @@ function public_renew(){ _wait_for_free_slot _requiresFqdn _certMustExist + + # BUGFIX: acme.sh does not create a new key file on renew. + # After switching from csr method to pram -d we got a 0 byte Keyfile + local _acme_keyfile="~/.acme/${CM_fqdn}/${CM_fqdn}.key" + if test ! -f "$_acme_keyfile" + then + echo "FIX: copy key from csr folder $CM_filekey to $_acme_keyfile" + if ! cp "$CM_filekey" "$_acme_keyfile" + then + exit 1 + fi + fi + # /BUGFIX + $ACME --renew -d ${CM_fqdn} $ACME_Params local _rc=$? -- GitLab