On Tue, Mar 26, 2019 at 12:49:28PM +0100, Andrea Bolognani wrote:
Our current defaults are root:wheel on FreeBSD and macOS, root:root
everywhere else.
Looking at what downstream distributions actually do, we can see that
these defaults are overriden the vast majority of the time, with a
number of variations showing up in the wild:
* qemu:qemu -> Used by CentOS, Fedora, Gentoo, OpenSUSE, RHEL
and... As it turns out, our very own spec file :)
* libvirt-qemu:libvirt-qemu -> Used by Debian.
* libvirt-qemu:kvm -> Used by Ubuntu.
* nobody:nobody -> Used by Arch Linux.
Based on the above, we can conclude that qemu:qemu are the preferred
credentials to be used when spawning a QEMU process, while our
current defaults get very little love.
Changing our defaults aligns with what most downstreams are actually
doing, promotes running QEMU under a non-root user - which is a very
good idea anyway - and shields random people building libvirt from
source from unwittingly running their guests as root.
While I understand the motivation, this impl is problematic because
it will guarantee that someone building & installing libvirt from
source on Debian, Ubuntu and Arch will have a non-functional QEMU
driver as it will try to use a "qemu:qemu" user/group which does
not exist on those distros.
If we want to change this, we must ensure that we honour the distro
specific user/group names you show above, and fallback to root/root
for distros we don't know about.
Note that there are a very small number of downstreams that don't
override our defaults: Alpine Linux, FreeBSD and macOS. Of those,
only Alpine Linux is affected by this change; all three should
arguably have been setting --with-qemu-user and --with-qemu-group
explicitly regardless of this change.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Proof that I'm not making any of this up ;)
* Alpine Linux
https://github.com/alpinelinux/aports/blob/master/main/libvirt/APKBUILD
* Arch Linux
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libvirt-git#n113
* CentOS
https://git.centos.org/blob/rpms!libvirt.git/8d86411e5109d791edf49c7f43c0...
* Debian
https://salsa.debian.org/libvirt-team/libvirt/blob/debian/sid/debian/rule...
* Fedora
https://src.fedoraproject.org/rpms/libvirt/blob/f29/f/libvirt.spec#_204
* FreeBSD
https://github.com/freebsd/freebsd-ports/blob/master/devel/libvirt/Makefile
* Gentoo
https://github.com/gentoo/gentoo/blob/master/app-emulation/libvirt/libvir...
* macOS (Homebrew)
https://github.com/Homebrew/homebrew-core/blob/master/Formula/libvirt.rb
* OpenSUSE
https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0:Update/li...
* Ubuntu
https://git.launchpad.net/ubuntu/+source/libvirt/tree/debian/rules?h=ubun...
* Upstream
https://libvirt.org/git/?p=libvirt.git;a=blob;f=libvirt.spec.in;h=b7a35a0...
m4/virt-driver-qemu.m4 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/m4/virt-driver-qemu.m4 b/m4/virt-driver-qemu.m4
index cb05c34265..2a1b86e891 100644
--- a/m4/virt-driver-qemu.m4
+++ b/m4/virt-driver-qemu.m4
@@ -44,8 +44,8 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
default_qemu_user=root
default_qemu_group=wheel
else
- default_qemu_user=root
- default_qemu_group=root
+ default_qemu_user=qemu
+ default_qemu_group=qemu
This would need to be much more clever
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|