From nobody Sat Sep 28 18:14:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569594464; cv=none; d=zoho.com; s=zohoarc; b=jIqLJNGn0Ekf9M6JhenXkgEVo/DHBnQIAOgTeJm2LVtWGqRVm4VVbVetHGef1HAuV4hYTG08CiG/Zib/Ktjj8AsRd9DjbuZ6jqZolHnttUElifWQ0anzfmMVSQx0LQyld+cXG85fdyaCV2RTml9fl5E0ctQvIugc6ni7bXjncs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569594464; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eLGTPFDtpPulo2L1J/4cykwwqIg4tH1ycxg6KFzoNtI=; b=UvWITx0yZzIDWKfVNW8VXFaTMCkyplf2gotCypVv0g35N5YhR7KOheNMCJgI8Sj0xgCRW1EfnSgnnTORMHwBb9Qz1tW3B668rkSTVge2/M30klAv6bwjn7l8/wGgJ+VoVpd6SCv5NLAmHFSYYl08L6IZdh7q+64PHfv1GxCvNYU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569594464202387.4911875904478; Fri, 27 Sep 2019 07:27:44 -0700 (PDT) Received: from localhost ([::1]:51634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrDi-0002zA-9S for importer@patchew.org; Fri, 27 Sep 2019 10:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39045) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDqWP-00061v-Qe for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDqWN-0005OB-S4 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:42:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18791) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iDqWN-0005O0-JN for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:42:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEAE4A44AC7 for ; Fri, 27 Sep 2019 13:42:54 +0000 (UTC) Received: from localhost (ovpn-112-38.ams2.redhat.com [10.36.112.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AEB3194B6; Fri, 27 Sep 2019 13:42:50 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v4 3/7] docs: start a document to describe D-Bus usage Date: Fri, 27 Sep 2019 17:42:20 +0400 Message-Id: <20190927134224.14550-4-marcandre.lureau@redhat.com> In-Reply-To: <20190927134224.14550-1-marcandre.lureau@redhat.com> References: <20190927134224.14550-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Fri, 27 Sep 2019 13:42:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: berrange@redhat.com, quintela@redhat.com, mprivozn@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- MAINTAINERS | 5 +++ docs/interop/dbus.rst | 99 ++++++++++++++++++++++++++++++++++++++++++ docs/interop/index.rst | 1 + 3 files changed, 105 insertions(+) create mode 100644 docs/interop/dbus.rst diff --git a/MAINTAINERS b/MAINTAINERS index b97fdd80d0..219a76f0a1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2157,6 +2157,11 @@ F: tests/migration-test.c F: docs/devel/migration.rst F: qapi/migration.json =20 +D-Bus +M: Marc-Andr=C3=A9 Lureau +S: Maintained +F: docs/interop/dbus.rst + Seccomp M: Eduardo Otubo S: Supported diff --git a/docs/interop/dbus.rst b/docs/interop/dbus.rst new file mode 100644 index 0000000000..3d760e4882 --- /dev/null +++ b/docs/interop/dbus.rst @@ -0,0 +1,99 @@ +=3D=3D=3D=3D=3D +D-Bus +=3D=3D=3D=3D=3D + +Introduction +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +QEMU may be running with various helper processes involved: + - vhost-user* processes (gpu, virtfs, input, etc...) + - TPM emulation (or other devices) + - user networking (slirp) + - network services (DHCP/DNS, samba/ftp etc) + - background tasks (compression, streaming etc) + - client UI + - admin & cli + +Having several processes allows stricter security rules, as well as +greater modularity. + +While QEMU itself uses QMP as primary IPC (and Spice/VNC for remote +display), D-Bus is the de facto IPC of choice on Unix systems. The +wire format is machine friendly, good bindings exist for various +languages, and there are various tools available. + +Using a bus, helper processes can discover and communicate with each +other easily, without going through QEMU. The bus topology is also +easier to apprehend and debug than a mesh. However, it is wise to +consider the security aspects of it. + +Security +=3D=3D=3D=3D=3D=3D=3D=3D + +A QEMU D-Bus bus should be private to a single VM. Thus, only +cooperative tasks are running on the same bus to serve the VM. + +D-Bus, the protocol and standard, doesn't have mechanisms to enforce +security between peers once the connection is established. Peers may +have additional mechanisms to enforce security rules, based for +example on UNIX credentials. However, because the daemon has +controlled who can send/recv messages to who, doesn't magically make +this secure. The semantics of the actual methods implemented using +D-Bus are just as critical. Peers need to carefully validate any +information they received from a peer with a different trust level. + +dbus-daemon policy +------------------ + +dbus-daemon can enforce various policies based on the UID/GID of the +processes that are connected to it. It is thus a good idea to run +helpers as different UID from QEMU and set appropriate policies. + +Depending on the use case, you may choose different scenarios: + + - Everything the same UID + + - Convenient for developers + - Improved reliability - crash of one part doens't take + out entire VM + - No security benefit over traditional QEMU + + - Two UIDs, one for QEMU, one for dbus & helpers + + - Moderately improved security isolation + + - Many UIDs, one for QEMU one for dbus and one for each helpers + + - Best security isolation + - Complex to manager distinct UIDs needed for each VM + +For example, to allow only ``qemu`` user to talk to ``qemu-helper`` +``org.qemu.Helper1`` service, a dbus-daemon policy may contain: + +.. code:: xml + + + + + + + + + + + +dbus-daemon can also perfom SELinux checks based on the security +context of the source and the target. For example, ``virtiofs_t`` +could be allowed to send a message to ``svirt_t``, but ``virtiofs_t`` +wouldn't be allowed to send a message to ``virtiofs_t``. + +See dbus-daemon man page for details. + +Guidelines +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +When implementing new D-Bus interfaces, it is recommended to follow +the "D-Bus API Design Guidelines": +https://dbus.freedesktop.org/doc/dbus-api-design.html + +The "org.qemu.*" prefix is reserved for the QEMU project. diff --git a/docs/interop/index.rst b/docs/interop/index.rst index 3e33fb5933..ded134ea75 100644 --- a/docs/interop/index.rst +++ b/docs/interop/index.rst @@ -13,6 +13,7 @@ Contents: :maxdepth: 2 =20 bitmaps + dbus live-block-operations pr-helper qemu-ga --=20 2.23.0