]> git.proxmox.com Git - pve-access-control.git/commitdiff
ticket: reorder calls when rotating
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 19 Jun 2019 09:46:18 +0000 (11:46 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 19 Jun 2019 09:59:45 +0000 (11:59 +0200)
to shrink the window between the two file_set_contents calls. we don't
need the mtimes to line up exactly since we have 300s of uncertainty
anyway, but generating an RSA key could take a while ;)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/AccessControl.pm

index fff2df2d7ebec40b0e04779e53ec6d4f2250d43d..013226819579cb79be45d8749f478a5d88bc21e3 100644 (file)
@@ -166,6 +166,7 @@ sub rotate_authkey {
        return if check_authkey();
 
        my $old = get_pubkey();
+       my $new = Crypt::OpenSSL::RSA->generate_key(2048);
 
        if ($old) {
            eval {
@@ -175,7 +176,6 @@ sub rotate_authkey {
            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);