From patchwork Tue Nov 14 14:09:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 56462 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1F70C27BBE9; Tue, 14 Nov 2023 14:11:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0E85D27BBE2 for ; Tue, 14 Nov 2023 14:11:12 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2u7c-00008j-Tk; Tue, 14 Nov 2023 09:10:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2u7U-0008WL-SG for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10:26 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2u7S-00028k-2x for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2u88-0005dd-6j; Tue, 14 Nov 2023 09:11:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67175] [PATCH 6/9] services: jami-dbus-session: Use =?utf-8?b?4oCYbGVhc3QtYXV0aG9yaXR5LXdyYXBwZXLigJku?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Tue, 14 Nov 2023 14:11:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67175 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67175@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Maxim Cournoyer Received: via spool by 67175-submit@debbugs.gnu.org id=B67175.169997104921587 (code B ref 67175); Tue, 14 Nov 2023 14:11:04 +0000 Received: (at 67175) by debbugs.gnu.org; 14 Nov 2023 14:10:49 +0000 Received: from localhost ([127.0.0.1]:60597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7t-0005c2-4l for submit@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7l-0005aL-R8 for 67175@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2u6z-0001s7-GT; Tue, 14 Nov 2023 09:09:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=j7dQB2VANLfzcj2zYZyAVwxUHSkKgm7CCa+nV9XFbKU=; b=qlXU8akTAolj/MXOruuK MFOQ6vvULiHtKmmSdxKH5tbfJ5AIUr2xjoZiJmq6Tr1O+CT5RR8Mt874YCYFFWsinVHyE5nYX8vQr ppaIk7BraF7JoknQ+TqfdVpZBP+j9AcPs5yLGDuUdAXse7E+c9rfK6nzeyU8sMQJ7IvAGqvIHTGMa X4x0RNxC1uiDpbDnP9iJmZNx58vP6OgmiSu3hqC3Ms6S2eCWm8CSil565ZXenZsBJ0eLUX2qlBdi0 ZJkV4O4Mi+kFRW3V5cvt5D06KRvF+ZldgDdMtAiSe3CtpoiYcmosgEZ76QM5/aSbiwdQdbfFNSnnE sXapM40uCm2DPw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 14 Nov 2023 15:09:15 +0100 Message-ID: <05c3a9993783b02b89083b1ae0562a79af4c61b2.1699970930.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/telephony.scm (jami-shepherd-services): Use ‘least-authority-wrapper’ for ‘dbus-daemon’. Use ‘fork+exec-command’ instead of ‘make-forkexec-constructor/container’ in the ‘start’ method’. Remove reference to (gnu build shepherd). Change-Id: I9d9f8de6ecea77950000ff64aa8c8d097dc028a0 Reviewed-by: Maxim Cournoyer --- gnu/services/telephony.scm | 66 +++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index c9b5d6cd99..832470527d 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -34,6 +34,9 @@ (define-module (gnu services telephony) #:use-module (guix modules) #:use-module (guix packages) #:use-module (guix gexp) + #:autoload (guix least-authority) (least-authority-wrapper) + #:autoload (gnu system file-systems) (file-system-mapping) + #:autoload (gnu build linux-container) (%namespaces) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) #:use-module (srfi srfi-26) @@ -298,7 +301,28 @@ (define (jami-shepherd-services config) (let* ((libjami (jami-configuration-libjami config)) (nss-certs (jami-configuration-nss-certs config)) (dbus (jami-configuration-dbus config)) - (dbus-daemon (file-append dbus "/bin/dbus-daemon")) + (dbus-daemon (least-authority-wrapper + (file-append dbus "/bin/dbus-daemon") + #:name "dbus-daemon" + #:user "jami" + #:group "jami" + #:preserved-environment-variables + '("XDG_DATA_DIRS") + #:mappings + (list (file-system-mapping + (source "/dev/log") ;for syslog + (target source)) + (file-system-mapping + (source "/var/run/jami") + (target source) + (writable? #t)) + (file-system-mapping + (source (gexp-input libjami "bin")) + (target source))) + ;; 'dbus-daemon' wants to look up users in /etc/passwd + ;; so run it in the global user namespace. + #:namespaces + (fold delq %namespaces '(net user)))) (accounts (jami-configuration-accounts config)) (declarative-mode? (maybe-value-set? accounts))) @@ -490,8 +514,7 @@ (define (jami-shepherd-services config) (list (shepherd-service (documentation "Run a D-Bus session for the Jami daemon.") (provision '(jami-dbus-session)) - (modules `((gnu build shepherd) - (gnu build dbus-service) + (modules `((gnu build dbus-service) (gnu build jami-service) (gnu system file-systems) ,@%default-modules)) @@ -499,26 +522,23 @@ (define (jami-shepherd-services config) ;; activation for D-Bus, such as a /etc/machine-id file. (requirement '(dbus-system syslogd)) (start - #~(make-forkexec-constructor/container - (list #$dbus-daemon "--session" - "--address=unix:path=/var/run/jami/bus" - "--syslog-only") - #:pid-file "/var/run/jami/pid" - #:mappings - (list (file-system-mapping - (source "/dev/log") ;for syslog - (target source)) - (file-system-mapping - (source "/var/run/jami") - (target source) - (writable? #t))) - #:user "jami" - #:group "jami" - #:environment-variables - ;; This is so that the cx.ring.Ring service D-Bus - ;; definition is found by dbus-daemon. - (list (string-append "XDG_DATA_DIRS=" - #$libjami:bin "/share")))) + #~(lambda () + (define pid + (fork+exec-command + (list #$dbus-daemon "--session" + "--address=unix:path=/var/run/jami/bus" + "--syslog-only") + #:environment-variables + ;; This is so that the cx.ring.Ring service D-Bus + ;; definition is found by dbus-daemon. + (list (string-append "XDG_DATA_DIRS=" + #$libjami:bin "/share")))) + + ;; The PID file contains the "wrong" PID (the one in the + ;; separate PID namespace) so ignore it and return the + ;; value returned by 'fork+exec-command'. + (and (read-pid-file "/var/run/jami/pid") + pid))) (stop #~(make-kill-destructor))) (shepherd-service