[libvirt] [PATCH] m4: Change default QEMU credentials to qemu:qemu

Andrea Bolognani abologna at redhat.com
Tue Mar 26 11:49:28 UTC 2019


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.

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 at 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/8d86411e5109d791edf49c7f43c08a06b80896af/SPECS!libvirt.spec#L226

  * Debian
    https://salsa.debian.org/libvirt-team/libvirt/blob/debian/sid/debian/rules#L94-95

  * 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/libvirt-5.1.0.ebuild#L296-L297

  * 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/libvirt/libvirt.spec?expand=1

  * Ubuntu
    https://git.launchpad.net/ubuntu/+source/libvirt/tree/debian/rules?h=ubuntu/disco#n99

  * Upstream
    https://libvirt.org/git/?p=libvirt.git;a=blob;f=libvirt.spec.in;h=b7a35a0fb14f3360eb795c4ec9b0e46171d2e4ec;hb=HEAD#l196

 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
   fi
 
   if test "x$with_qemu_user" = "xplatform dependent" ; then
-- 
2.20.1




More information about the libvir-list mailing list