Hey Everyone. So I think I may have found a bug with the proxmox api. Consider the below powershell script that I wrote which utilizes the Corsinvest.ProxmoxVE.Api Powershell module to create a vm:
As you can see, one of the disks that I have defined imports an existing disk image. I point this out simply because it is the part of the script that is referenced in the error message. When I attempt to run the above script, the proxmox api returns the following error:
The path that the error is referring to is the path I passed to the "import-from" property when creating one of the disks. I find this error odd because, as you can see for yourself, the api key that I use in my script (which I redacted of course) was created to authenticate the root user. As a test, I attempted running the above script again, except I authenticated to the proxmox server using the root accounts actual credentials, and the script worked perfectly. So, it would seem, as far as the permissions needed to "pass an arbitrary filesystem path" to the proxmox api, authenticating to the proxmox server using an api key generated by the root user does not have the permissions of the root user.
Code:
$apikey = 'root@pam!api=Idontthinkso'
$key = Connect-PveCluster -HostsAndPorts 192.168.1.15:8006 -SkipCertificateCheck -ApiToken $apikey
$sata = @{}
$sata.add("0", "fourt:100")
$sata.Add("1", "fourt:0,import-from=/mnt/pve/iso/template/iso/SERVER.VHD")
$ide = @{}
$ide.Add("2", "big:iso/virtio-win-0.1.266.iso,media=cdrom")
$usb = @{}
$usb.Add("0", "spice,usb3=1")
$net = @{}
$net.Add(0, "model=e1000,bridge=vmbr0,firewall=1")
$vmid = 100
New-PveQemu -Memory "4096" -Bios ovmf -Cpu host -Cores 4 -Machine q35 -Node prox -Pool res -Ostype win10 -Scsihw virtio-scsi-pci -Vmid 100 -Name "PB99976-P05" -Storage fourt -Vga "type=qxl,memory=128" -NetN $net -Efidisk0 "fourt:1,efitype=4m,pre-enrolled-keys=1" -Agent "1" -SataN $sata -IdeN $ide -Boot "order=sata1;sata0;ide2" -UsbN $usb
As you can see, one of the disks that I have defined imports an existing disk image. I point this out simply because it is the part of the script that is referenced in the error message. When I attempt to run the above script, the proxmox api returns the following error:
Code:
Only root can pass arbitrary filesystem paths. at /usr/share/perl5/PVE/Storage.pm line 561.
The path that the error is referring to is the path I passed to the "import-from" property when creating one of the disks. I find this error odd because, as you can see for yourself, the api key that I use in my script (which I redacted of course) was created to authenticate the root user. As a test, I attempted running the above script again, except I authenticated to the proxmox server using the root accounts actual credentials, and the script worked perfectly. So, it would seem, as far as the permissions needed to "pass an arbitrary filesystem path" to the proxmox api, authenticating to the proxmox server using an api key generated by the root user does not have the permissions of the root user.