From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SP/6A1Nc8WK1cAAAbAwnHQ (envelope-from ) for ; Mon, 08 Aug 2022 20:56:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2KbwA1Nc8WLYogAA9RJhRA (envelope-from ) for ; Mon, 08 Aug 2022 20:56:19 +0200 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 668DB1CE10 for ; Mon, 8 Aug 2022 20:56:18 +0200 (CEST) Received: from localhost ([::1]:51780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oL7vE-00082t-Sd for larch@yhetil.org; Mon, 08 Aug 2022 14:56:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL7v0-00081S-NK for guix-patches@gnu.org; Mon, 08 Aug 2022 14:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oL7v0-0004AQ-EZ for guix-patches@gnu.org; Mon, 08 Aug 2022 14:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oL7v0-0004m1-Ar for guix-patches@gnu.org; Mon, 08 Aug 2022 14:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56690] [PATCH] gnu: seatd-service-type: Should use seat group. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 18:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56690 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 56690@debbugs.gnu.org Received: via spool by 56690-submit@debbugs.gnu.org id=B56690.165998490818271 (code B ref 56690); Mon, 08 Aug 2022 18:56:02 +0000 Received: (at 56690) by debbugs.gnu.org; 8 Aug 2022 18:55:08 +0000 Received: from localhost ([127.0.0.1]:41999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL7u7-0004kc-Gr for submit@debbugs.gnu.org; Mon, 08 Aug 2022 14:55:08 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:59868 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL7u4-0004jt-L4 for 56690@debbugs.gnu.org; Mon, 08 Aug 2022 14:55:06 -0400 Received: from localhost ([127.0.0.1]:41944) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oL7tO-00026B-1N; Mon, 08 Aug 2022 18:54:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Type:MIME-Version:Message-ID:In-reply-to:Date:Subject:Cc:To :From:References:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JJ5GmDtzXto0sDMRc3eHBd62hUbicG28hkovC8jKZoI=; b=hyKZYqb8GBDntts8nr/M613j5L OyOXrSFe0Ijy1x2ORBnqUVAaK07/OgU/JSiTWF1vS05euIU95u+zrQUsGiCTXp6ZgQ33dOKbpUbFP ig+2buUADLT41wDNsMBN1aHorZBgWFA3KXejtI/1jmx+vqQhkWEH/0Tur18Sk3+2I6hAORV6mG5UO 6Hwc5iGwCficagP7OsjIx8w9HFD2RQV3ufflAz1Nb9qtShuo1EtCX4y12sIUFjL+8xQDWg2eCx13T nb1tXKqsIbuGuUTta+8m2hxIDrE8Gh5EGwzKT47ZW6UIpUJYgp0fLaR36tq0Ct62+guIJfaPZMVP/ HvD1pV5VNGwkukpj/mBtni7cO9ydpyh8uk7OO9eX9uGL89smmux5QX7pE6VY78GzVa7u2b2gtz4jH 4cWTgpwiBEHzc+BXehdWYsGpDvZxlirhvaIworT343buiD3CUeZLS7EZGNQjk9Zmc90qbkDILvAaq W/Lw9hl4M2y90luUP+p7/yFm; Received: from muradm by localhost with local (Exim 4.96) (envelope-from ) id 1oL7tp-0006BK-2o; Mon, 08 Aug 2022 21:54:49 +0300 References: <20220722042745.26745-1-mail@muradm.net> <87czdddrra.fsf@gnu.org> <87les00x51.fsf@muradm.net> <87h72n24ra.fsf@muradm.net> <55a3a3bf118f364b70cbd74d214998955d81eaa9.camel@ist.tugraz.at> User-agent: mu4e 1.8.7; emacs 29.0.50 From: muradm Date: Mon, 08 Aug 2022 21:50:43 +0300 In-reply-to: <55a3a3bf118f364b70cbd74d214998955d81eaa9.camel@ist.tugraz.at> Message-ID: <87mtcezhty.fsf@muradm.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659984978; 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: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=JJ5GmDtzXto0sDMRc3eHBd62hUbicG28hkovC8jKZoI=; b=R1eor6wsUVT/p8K4nhn8rVYvH0Oi4hTTLS20oy+bZgUyscUmTRCKSmDwpIIFYs6qggEqV7 WFfPfrVs0qdO+/BiG86Tut7MVVvVWO4T2Uz2TUXkRrcRT3BmZiiVZ6N+KGaab4pViq/9Rj su0k5zWKzC9b+gON3J2R2AHCvx55WHRppQ9JzTGV/hK8fEYg37Jvl6pG26QaYGj5m/YGAX btnzD+BJJdm0akxVkKHx3IpQe0FLVswwLjmCDe6GdPZxIvly9JTKM49+R5vQeX+uYeZ/bR Pdp4BwHS8YC1bC7EdTCRF5X8ng5XBIphOk1Z2yRY6zIZQxatwqltHmiBgFU4Rw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659984978; a=rsa-sha256; cv=none; b=IJvYbZbV1vBooSYW3YW1kYHB+KpUl0aL1tO/CiFMbic5yzNm/UiBeniUoKXmn3lXPeIz88 LptBh0KC45PJmSvylGppNgpVj07nJErcxI7lT0KH90gqcGo8RVCCw22bFzxr9y7z97wz+r 565X2wzj1//CzYT0IR496zNL/tmorrkY9EB2MmN5GeHOlnk/TqgcnRAG6/D8LCoMdDcTyq WR0VXAijCPIQJCgPPc6Uz1oUziKY7bzSTUta3BPLr/opcU3izWbDR/SGqXykt+aZVA7p/s 8kBMfxkINtUlPh7Khf2WoON8x9Bd9ZTq5Sww5bnF3zmygSjNWg7pFrtT+t5ltw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=muradm.net header.s=mail header.b=hyKZYqb8; dmarc=none; 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" X-Migadu-Spam-Score: -1.79 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=muradm.net header.s=mail header.b=hyKZYqb8; dmarc=none; 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" X-Migadu-Queue-Id: 668DB1CE10 X-Spam-Score: -1.79 X-Migadu-Scanner: scn0.migadu.com X-TUID: IYq7/2sRNmCK --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=v3-0001-gnu-seatd-service-type-Should-use-seat-group.patch Content-Transfer-Encoding: quoted-printable Content-Description: v3-0001-gnu-seatd-service-type-Should-use-seat-group.patch From=20e733977a5cbd2bb34cf129908b16a4a0af830f02 Mon Sep 17 00:00:00 2001 From: muradm Date: Fri, 22 Jul 2022 07:09:54 +0300 Subject: [PATCH v3] gnu: seatd-service-type: Should use seat group. To: 56690@debbugs.gnu.org * gnu/services/desktop.scm (seatd-service-type): Uses "seat" group. [extensions]: Added account-service-type with seatd-accounts. (seatd-accounts): Conditionally produces list with "seat" group. (): [user] Removed user field, since it is not going to be used. [group] Change default value to "seat". * doc/guix.texi: Mention that users may need to become members of "seat" group and update default value for group field. Add explanation on seatd.sock file. Remove dropped user field. =2D-- doc/guix.texi | 29 +++++++++++++++++++++++++---- gnu/services/desktop.scm | 14 +++++++++----- gnu/tests/desktop.scm | 9 +++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9a6a5c307d..92701fca10 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -23171,6 +23171,30 @@ input), without requiring the applications needing= access to be root. %base-services) =20 @end lisp + +@code{seatd} operates over a UNIX domain socket, with @code{libseat} +providing the client-side of the protocol. Then applications dealing +with seat management (e.g. @code{sway}) connects to @code{seatd} via +mentioned socket. + +When seat management is provided by @code{seatd}, @code{libseat} users +that acquire resources provided by @code{seatd} should have permissions +to access its UNIX domain socket. By default, @code{seatd-service-type} +provides ``seat'' group. And @code{libseat} user should become its +member. + +@lisp +(user-account + (name "alice") + (group "users") + (supplementary-groups '("wheel" ;allow use of sudo, etc. + "seat" ;interact with seatd + "audio" ;sound card + "video" ;video devices such as webcams + "cdrom")) ;the good ol' CD-ROM + (comment "Bob's sister")) +@end lisp + @end defvr =20 @deftp {Data Type} seatd-configuration @@ -23180,10 +23204,7 @@ Configuration record for the seatd daemon service. @item @code{seatd} (default: @code{seatd}) The seatd package to use. =20 =2D@item @code{user} (default: @samp{"root"}) =2DUser to own the seatd socket. =2D =2D@item @code{group} (default: @samp{"users"}) +@item @code{group} (default: @samp{"seat"}) Group to own the seatd socket. =20 @item @code{socket} (default: @samp{"/run/seatd.sock"}) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 29a3722f1b..fbd5a46a06 100644 =2D-- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -13,7 +13,7 @@ ;;; Copyright =C2=A9 2020 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2020 Reza Alizadeh Majd ;;; Copyright =C2=A9 2021 Brice Waegeneire =2D;;; Copyright =C2=A9 2021 muradm +;;; Copyright =C2=A9 2021, 2022 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -1645,8 +1645,7 @@ (define-record-type* seatd-conf= iguration make-seatd-configuration seatd-configuration? (seatd seatd-package (default seatd)) =2D (user seatd-user (default "root")) =2D (group seatd-group (default "users")) + (group seatd-group (default "seat")) (socket seatd-socket (default "/run/seatd.sock")) (logfile seatd-logfile (default "/var/log/seatd.log")) (loglevel seatd-loglevel (default "info"))) @@ -1660,7 +1659,6 @@ (define (seatd-shepherd-service config) (provision '(seatd elogind)) (start #~(make-forkexec-constructor (list #$(file-append (seatd-package config) "/bin/seatd= ") =2D "-u" #$(seatd-user config) "-g" #$(seatd-group config)) #:environment-variables (list (string-append "SEATD_LOGLEVEL=3D" @@ -1670,9 +1668,14 @@ (define (seatd-shepherd-service config) #:log-file #$(seatd-logfile config))) (stop #~(make-kill-destructor))))) =20 +(define seatd-accounts + (match-lambda + (($ _ group) + (list (user-group (name group) (system? #t)))))) + (define seatd-environment (match-lambda =2D (($ _ _ _ socket) + (($ _ _ socket) `(("SEATD_SOCK" . ,socket))))) =20 (define seatd-service-type @@ -1683,6 +1686,7 @@ (define seatd-service-type applications needing access to be root.") (extensions (list + (service-extension account-service-type seatd-accounts) (service-extension session-environment-service-type seatd-environment) ;; TODO: once cgroups is separate dependency we should not mount it h= ere ;; for now it is mounted here, because elogind mounts it diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm index 25971f9225..6fe6ec21be 100644 =2D-- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -255,6 +255,15 @@ (define (sock-var-sock var) (socks (map wait-for-unix-socket-m socks))) (and (=3D 2 (length socks)) (every identity socks))))) =20 + (test-equal "seatd.sock ownership" + '("root" "seat") + `(,(marionette-eval + '(passwd:name (getpwuid (stat:uid (stat "/run/seatd.sock")= ))) + marionette) + ,(marionette-eval + '(group:name (getgrgid (stat:gid (stat "/run/seatd.sock"))= )) + marionette))) + (test-assert "greetd is ready" (begin (marionette-type "ps -C greetd -o pid,args --no-headers > ps= -greetd\n" =2D-=20 2.37.1 --=-=-= Content-Type: text/plain; format=flowed Liliana Marie Prikler writes: > Am Sonntag, dem 07.08.2022 um 23:05 +0300 schrieb muradm: > >> * gnu/services/desktop.scm (seatd-service-type): Uses "seat" >> group. >> [extensions]: Added account-service-type with seatd-accounts. >> (seatd-accounts): Conditionally produces list with "seat" >> group. >> (): >> [user] Drop user field, since it is not going to be used. > Removed field. done >> [group] Change default value to "seat". >> [existing-group?] Add field which controls if group should be >> created or not. > Would be Added field, but see below. obsolete >> * doc/guix.texi: Mention that users may need to become members >> of >> "seat" group and update default value for group field. Add >> explanation on seatd.sock file. Remove dropped user field. > >> +When seat mamanagement is provided by @code{seatd}, users that >> acquire > management. done >> +resources provided by @code{seatd} should have permissions to >> access >> +its UNIX domain socket. By default, @code{seatd-service-type} >> provides >> +``seat'' group. And user should become its member. > Which user? Closely related, who acquires resources provided by > @code{seatd}? Just the greeter? A regular user logging in? > What access level is needed/provided? Read access? Write > access? While I understand what you are saying, for me user is fine, and I can't come up with better description, as my eyes too blurred on this subject. Anyway for now I specified it as "libseat user". >> + (group seatd-group (default "seat")) >> + (existing-group? seatd-existing-group? (default #f)) > AFAIK this is not necessary. accounts-service-type can handle > multiple > eq? groups, so as long as you're careful with what you put into > group, > you shouldn't get an error. ok field removed > Cheers --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmLxW/kACgkQ6M7O0mLO BeKKhxAA2g/jQGP0g6ZNMVS7IrCkcjy4rC28GaxL3z5ArkNkSVZBzmvjgTbar9vh XLnd7wdP8MNC5wDbMGpXG/fbJhD7BMf1UKNrxnzDuXPwSf/1LQrWMd7JG+rOlNuJ rMfV2OcHJPklUnJcsJ8ARCXOycETCID/onPpPiAWrjTEE1j3cC0bjn3oxW+weXko DTl+lopWCL4zAc/izR29HgtaCP9nRnV2NXm/xX1RFzV+Wz/Xucla4HbNynbiH3HF 7h0iYuvsfBG2knTD05XVHTXHmZAYqRXei0sBL0IgDPiH85rNz6+TWUw4MfRsOtqh 8me1d3TAbd77k0PeIDQcO1vWaJ3Y8OfMKL+Ir59685ZvAHbyjN9hPp6t99+AMzq6 N9fXQ3rMl/80E+B+zEskLTgQqtpw1uv/37eseqEPyzSdK3gUsnLAjl1qsYel3ZBo ONNEKRaRUq0i5BVlVrdNrfv6j5As/It8DK1U7g4qDi65oTZLjpZXyg87Ld3j5leg ZhQZoEDV5GFzkNp5SZZk/IOmbV4AIgdELcSAfGBmUOxlImxhDqyS+AiXxlLtfVyp 0aWeHRCzt11GRaATVW+/3LzJpfC7U4cY9/XTkKlCceCXwy+iZKjIMfLPR4r2sVNO udQMfNm7HPbu/fiFOWDb6GbcZJBMIMlFHgSMFQKLPH8FCYPaLC0= =xTDN -----END PGP SIGNATURE----- --==-=-=--