]> git.proxmox.com Git - pmg-api.git/commitdiff
fix revocation of old certificate on renewal
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 17 Mar 2021 10:12:18 +0000 (11:12 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Mar 2021 10:26:29 +0000 (11:26 +0100)
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>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PMG/API2/Certificates.pm

index b50addd17674cf2f1b8525f7d27444c4688485c9..1a6c434206ffb8bc8b33d6dcd953762b7c1910de 100644 (file)
@@ -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 $@;
            }
        };