mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-24 22:41:06 +00:00
implement permission checks for cloud-init related options
Most cloud-init options are network related, so we simply check for VM.Config.Network priviledge. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
503308ed91
commit
7ee990cd30
@ -291,6 +291,15 @@ my $diskoptions = {
|
|||||||
'vmstatestorage' => 1,
|
'vmstatestorage' => 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
my $cloudinitoptions = {
|
||||||
|
cipassword => 1,
|
||||||
|
citype => 1,
|
||||||
|
ciuser => 1,
|
||||||
|
nameserver => 1,
|
||||||
|
searchdomain => 1,
|
||||||
|
sshkeys => 1,
|
||||||
|
};
|
||||||
|
|
||||||
my $check_vm_modify_config_perm = sub {
|
my $check_vm_modify_config_perm = sub {
|
||||||
my ($rpcenv, $authuser, $vmid, $pool, $key_list) = @_;
|
my ($rpcenv, $authuser, $vmid, $pool, $key_list) = @_;
|
||||||
|
|
||||||
@ -318,7 +327,7 @@ my $check_vm_modify_config_perm = sub {
|
|||||||
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.PowerMgmt']);
|
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.PowerMgmt']);
|
||||||
} elsif ($diskoptions->{$opt}) {
|
} elsif ($diskoptions->{$opt}) {
|
||||||
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.Disk']);
|
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.Disk']);
|
||||||
} elsif ($opt =~ m/^(?:net|ipconfig)\d+$/) {
|
} elsif ($cloudinitoptions->{$opt} || ($opt =~ m/^(?:net|ipconfig)\d+$/)) {
|
||||||
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.Network']);
|
$rpcenv->check_vm_perm($authuser, $vmid, $pool, ['VM.Config.Network']);
|
||||||
} else {
|
} else {
|
||||||
# catches usb\d+, hostpci\d+, args, lock, etc.
|
# catches usb\d+, hostpci\d+, args, lock, etc.
|
||||||
|
Loading…
Reference in New Issue
Block a user