public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH api] fix revocation of old certificate on renewal
Date: Wed, 17 Mar 2021 11:12:18 +0100	[thread overview]
Message-ID: <20210317101218.17524-1-w.bumiller@proxmox.com> (raw)

in PMG key and certificate are in the same file so we need
to extract the certificate (like in the revoke api call)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 src/PMG/API2/Certificates.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PMG/API2/Certificates.pm b/src/PMG/API2/Certificates.pm
index b50addd..1a6c434 100644
--- a/src/PMG/API2/Certificates.pm
+++ b/src/PMG/API2/Certificates.pm
@@ -610,7 +610,11 @@ __PACKAGE__->register_method ({
 
 	    if (defined($old_cert)) {
 		print "Revoking old certificate\n";
-		eval { $acme->revoke_certificate($old_cert, undef) };
+		eval {
+		    $old_cert = pem_certificate($old_cert)
+			or die "no certificate section found in '$cert_path'\n";
+		    $acme->revoke_certificate($old_cert, undef);
+		};
 		warn "Revoke request to CA failed: $@" if $@;
 	    }
 	};
-- 
2.20.1





             reply	other threads:[~2021-03-17 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 10:12 Wolfgang Bumiller [this message]
2021-03-17 10:34 ` [pmg-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210317101218.17524-1-w.bumiller@proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal