allow non-root users to set /dev/hwrng as an RNG source

Allow users with the Mapping.Use privilege on the /mapping/hwrng path to
configure /dev/hwrng as an entropy source for VirtIO RNG devices.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
This commit is contained in:
Filip Schauer 2025-02-18 12:10:59 +01:00 committed by Fabian Grünbichler
parent b2a0b6b1f0
commit 6a956f8604
2 changed files with 2 additions and 2 deletions

View File

@ -819,7 +819,7 @@ my sub check_rng_perm {
my $device = PVE::JSONSchema::parse_property_string('pve-qm-rng', $value);
if ($device->{source} && $device->{source} eq '/dev/hwrng') {
die "only root can set '$opt' config for a non-mapped Hardware RNG device\n";
$rpcenv->check_full($authuser, "/mapping/hwrng", ['Mapping.Use']);
}
return 1;

View File

@ -6461,7 +6461,7 @@ sub check_mapping_access {
my $device = PVE::JSONSchema::parse_property_string('pve-qm-rng', $conf->{$opt});
if ($device->{source} && $device->{source} eq '/dev/hwrng') {
die "only root can set '$opt' config for a non-mapped Hardware RNG device\n";
$rpcenv->check_full($user, "/mapping/hwrng", ['Mapping.Use']);
}
}
}