config: add hint for set encryption key, die on unlink error

as else the API cannot easily know if this is set, it cannot check
with -f as the key is in a restricted area and we do not want that a
GET runs as protected.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-07-24 16:47:47 +02:00
parent 25a9583634
commit 18cf6c9f27

View File

@ -114,6 +114,7 @@ sub pbs_delete_encryption_key {
my $pwfile = pbs_encryption_key_file_name($scfg, $storeid);
unlink $pwfile;
delete $scfg->{'encryption-key'};
}
sub pbs_get_encryption_key {
@ -355,6 +356,7 @@ sub on_add_hook {
} else {
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
}
$scfg->{'encryption-key'} = 1;
} else {
pbs_delete_encryption_key($scfg, $storeid);
}
@ -378,6 +380,7 @@ sub on_update_hook {
} else {
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
}
$scfg->{'encryption-key'} = 1;
} else {
pbs_delete_encryption_key($scfg, $storeid);
}