[pve-devel] [PATCH cluster/guest-common/manager/qemu-server v3 00/11] fix #5657: allow configuring RNG device as non-root user

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Feb 11 13:34:53 CET 2025


On February 10, 2025 4:37 pm, Filip Schauer wrote:
> Allow users with the VM.Config.HWType privilege to configure VirtIO RNG
> devices on VMs with either /dev/urandom or /dev/random as the entropy
> source.
> 
> Further introduce hardware RNG device mapping to be able to selectively
> allow non-root users with the Mapping.Use privilege to configure
> hardware RNG devices as entropy sources.

some high level questions here:

- this series allows direct access to /dev/urandom and /dev/random, but
  also allows setting up mappings to them (the mapping seems unnecessary)
- the only other (restricted) value is /dev/hwrng

wouldn't it be easier to just define an ACL path for /dev/hwrng, and
skip all the mapping setup if the only sensible mapping you can set up
is a single one for /dev/hwrng?

do we expect other hardware RNG device paths in the future?

else the only benefit of the full-fledged mapping is that you can
"alias" and describe RNG sources and limit them to certain nodes, and I
am not sure that is worth all this machinery and an extra config file ;)
aliasing makes very little sense if there is only three valid choices
that have descriptive names anyway. I also expect that most people using
this would want to give the VM access to the hwrng on all nodes..

other than this the series looks good to me, just a few nits (see
individual patches)

> 
> Changes since v2:
> * Restrict RNG device format to enum of
> * Add descriptive commit message
> * Code style fixes
> * Remove outdated remarks about entropy stravation of /dev/random
> * Split helpers for VirtIO RNG command line arguments into its own
>   commit
> * Add explicit "use PVE::QemuServer::RNG;" statement to PVE/API2/Qemu.pm
> * Fix "map: type check ('array') failed" error when adding a mapping in
>   the UI
> * ui: split resource mapping types into tabbed views
> 
> Changes since v1:
> * Restrict use of /dev/hwrng to the root user
> * introduce hardware RNG mapping
> 
> pve-guest-common:
> 
> Filip Schauer (1):
>   mapping: add a hardware RNG mapping config
> 
>  src/Makefile             |   1 +
>  src/PVE/Mapping/HWRNG.pm | 147 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 148 insertions(+)
>  create mode 100644 src/PVE/Mapping/HWRNG.pm
> 
> 
> pve-cluster:
> 
> Filip Schauer (1):
>   cfs: add 'mapping/hwrng.cfg' to observed files
> 
>  src/PVE/Cluster.pm  | 1 +
>  src/pmxcfs/status.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> 
> pve-manager:
> 
> Filip Schauer (5):
>   introduce hardware rng mapping api
>   introduce hardware rng scanning api
>   ui: add hardware RNG resource mapping
>   ui: allow use of mapped hardware RNGs as entropy sources for VMs
>   ui: split resource mapping types into tabbed views
> 
>  PVE/API2/Cluster/Mapping.pm                   |   7 +
>  PVE/API2/Cluster/Mapping/HWRNG.pm             | 286 ++++++++++++++++++
>  PVE/API2/Cluster/Mapping/Makefile             |   5 +-
>  PVE/API2/Hardware.pm                          |   7 +
>  PVE/API2/Hardware/HWRNG.pm                    |  47 +++
>  PVE/API2/Hardware/Makefile                    |   1 +
>  www/manager6/Makefile                         |  12 +-
>  www/manager6/data/PermPathStore.js            |   1 +
>  www/manager6/dc/Config.js                     |  41 +--
>  www/manager6/form/HWRNGMapSelector.js         |  99 ++++++
>  www/manager6/qemu/HardwareView.js             |   9 +-
>  www/manager6/qemu/RNGEdit.js                  |  79 +++--
>  www/manager6/resource-map/HWRNGMapEdit.js     | 149 +++++++++
>  www/manager6/resource-map/HWRNGMapView.js     |  76 +++++
>  .../{window => resource-map}/PCIMapEdit.js    |   2 +-
>  .../{dc => resource-map}/PCIMapView.js        |   4 +-
>  www/manager6/resource-map/ResourceMapView.js  |  23 ++
>  .../{window => resource-map}/USBMapEdit.js    |   2 +-
>  .../{dc => resource-map}/USBMapView.js        |   4 +-
>  19 files changed, 778 insertions(+), 76 deletions(-)
>  create mode 100644 PVE/API2/Cluster/Mapping/HWRNG.pm
>  create mode 100644 PVE/API2/Hardware/HWRNG.pm
>  create mode 100644 www/manager6/form/HWRNGMapSelector.js
>  create mode 100644 www/manager6/resource-map/HWRNGMapEdit.js
>  create mode 100644 www/manager6/resource-map/HWRNGMapView.js
>  rename www/manager6/{window => resource-map}/PCIMapEdit.js (99%)
>  rename www/manager6/{dc => resource-map}/PCIMapView.js (96%)
>  create mode 100644 www/manager6/resource-map/ResourceMapView.js
>  rename www/manager6/{window => resource-map}/USBMapEdit.js (99%)
>  rename www/manager6/{dc => resource-map}/USBMapView.js (95%)
> 
> 
> qemu-server:
> 
> Filip Schauer (4):
>   refactor: move rng related code into its own module
>   add helpers for VirtIO RNG command line arguments
>   allow non-root users to set /dev/u?random as an RNG source
>   let VirtIO RNG devices source entropy from mapped HWRNGs
> 
>  PVE/API2/Qemu.pm        |  48 +++++++++++++
>  PVE/QemuServer.pm       |  97 ++++++-------------------
>  PVE/QemuServer/Makefile |   1 +
>  PVE/QemuServer/RNG.pm   | 153 ++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 224 insertions(+), 75 deletions(-)
>  create mode 100644 PVE/QemuServer/RNG.pm
> 
> 
> Summary over all repositories:
>   27 files changed, 1152 insertions(+), 151 deletions(-)
> 
> -- 
> Generated by git-murpp 0.6.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list