]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/AccessControl.pm
ticket: reorder calls when rotating
[pve-access-control.git] / PVE / AccessControl.pm
index fff2df2d7ebec40b0e04779e53ec6d4f2250d43d..013226819579cb79be45d8749f478a5d88bc21e3 100644 (file)
@@ -166,6 +166,7 @@ sub rotate_authkey {
        return if check_authkey();
 
        my $old = get_pubkey();
        return if check_authkey();
 
        my $old = get_pubkey();
+       my $new = Crypt::OpenSSL::RSA->generate_key(2048);
 
        if ($old) {
            eval {
 
        if ($old) {
            eval {
@@ -175,7 +176,6 @@ sub rotate_authkey {
            die "Failed to store old auth key: $@\n" if $@;
        }
 
            die "Failed to store old auth key: $@\n" if $@;
        }
 
-       my $new = Crypt::OpenSSL::RSA->generate_key(2048);
        eval {
            my $pem = $new->get_public_key_x509_string();
            PVE::Tools::file_set_contents($pve_auth_key_files->{pub}, $pem);
        eval {
            my $pem = $new->get_public_key_x509_string();
            PVE::Tools::file_set_contents($pve_auth_key_files->{pub}, $pem);