From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id +J3dEwCAU2UIXAAAG6o9tA:P1 (envelope-from ) for ; Tue, 14 Nov 2023 15:11:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +J3dEwCAU2UIXAAAG6o9tA (envelope-from ) for ; Tue, 14 Nov 2023 15:11:12 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 24AA4357D0 for ; Tue, 14 Nov 2023 15:11:12 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=qlXU8akT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699971072; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=j7dQB2VANLfzcj2zYZyAVwxUHSkKgm7CCa+nV9XFbKU=; b=fZrTecUSzUPF+RpsDibum/5J44d61vsahU6zGfUlNjH4NQzOwQXFyzYRS6/D8Pgpxl1fr5 BHrTFWRCQvlOl7qPm+6eYRsP/0LB/GLlDfzy/zt0IB/yFZ0HTIitDfDiJEk5ibNew0L/MO DpWhzmG5S8G039Nfmz/MhHwLABl9PqcaLfDmrgMb53u8iCv7L6aBk05CpxPj5ZKY+l27Ix G06oV1aCiqQzLpVtilTzGhK+KbDKNQ/+el0KgrAPoiRTboCNHfiwX9WbLpvnzYU6cOu2qV lLqjEUT/Om5uRGfbCq1RpVJG9x91GLAFqEmN5BK5pk7tUsFw4luAFm87oKRoSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=qlXU8akT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699971072; a=rsa-sha256; cv=none; b=O8gzz9nMwauhtS2OcHsvXCgb6kqRm5KYOJXgJERAegvipUSqg6pQTnnrW6YSXlaRDvXJnx 4G5dbZQ+bXGDV7ImdPIfTLiX9UNsl65Az/agaIuSh/1z60dGss7dXp1/jEOpHW4paiB4nS btHriNNvoGGFj9gZjsEUn7Vjutm4RKrqXgf2klqo9dCWptyctpFFzZFeR+t7qTg8l0HyeU chS6zrQh9ja4R4JWbSFMJxF5GSLEaDbPZh4Ay20uMaVsmVuoMQ+lTL1OrW7u2+62/UmZMn qC5BxoqMM5Sby1ZnimMMB5UhJc68y4PNOOytjmIvTJKoNlKlPLPxJSPDhDmwvQ== 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?Q?=E2=80=98least-authority-wrapper=E2=80=99.?= 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.79 X-Spam-Score: -5.79 X-Migadu-Queue-Id: 24AA4357D0 X-Migadu-Scanner: mx10.migadu.com X-TUID: iV5D1/awtbHg * 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 --- 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 -- 2.41.0