From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mPXKKS1D+2EgGQAAgWs5BA (envelope-from ) for ; Thu, 03 Feb 2022 03:51:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MC91Ji1D+2HnaQAAauVa8A (envelope-from ) for ; Thu, 03 Feb 2022 03:51:25 +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 385A61DB40 for ; Thu, 3 Feb 2022 03:51:25 +0100 (CET) Received: from localhost ([::1]:56178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFSDU-0001e1-DA for larch@yhetil.org; Wed, 02 Feb 2022 21:51:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFSD9-0001JR-No for bug-guix@gnu.org; Wed, 02 Feb 2022 21:51:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFSD8-0000aq-OR for bug-guix@gnu.org; Wed, 02 Feb 2022 21:51:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nFSD8-00012I-OM for bug-guix@gnu.org; Wed, 02 Feb 2022 21:51:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#25325: elogind does not set ACLs promptly Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 03 Feb 2022 02:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25325 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Chris Marusich Received: via spool by 25325-submit@debbugs.gnu.org id=B25325.16438566593943 (code B ref 25325); Thu, 03 Feb 2022 02:51:02 +0000 Received: (at 25325) by debbugs.gnu.org; 3 Feb 2022 02:50:59 +0000 Received: from localhost ([127.0.0.1]:54072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFSD4-00011W-Vz for submit@debbugs.gnu.org; Wed, 02 Feb 2022 21:50:59 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:36793) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFSD2-000112-0q for 25325@debbugs.gnu.org; Wed, 02 Feb 2022 21:50:58 -0500 Received: by mail-wr1-f43.google.com with SMTP id u15so2168570wrt.3 for <25325@debbugs.gnu.org>; Wed, 02 Feb 2022 18:50:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=vOmDMJl64HD76i0nbQn/KLcHH2VkpZtJhnKoc4TsvyI=; b=MInmNts2ctXj++0LNvgVV+p2pY5rOWMqyVBK+TNJJJJPQG7xxBaUBLjZJkfYJQl7f/ w1046NKjEJdJZ5gG9k+g74ig+YUtKeFoNNN+CAM0BDgB3eWKIA34EEU4m7Jb7LeCWCHj zVRwuxkCJPmX3nkGICrXi4BhGDRsHGDridYym6y/xg+Pl98nQB27XLgQqOMpJDAtc+zB LA8JV6pP09Tm1vQXnCt4lwhUAFukTK1uJk4WFgV9n/gDML022FRv3+T0T4EdZGbPJFn3 LKcf9X2LcLEuQsY0dhWT7j/5efkFfmgzejMytRNWEpgU27VlKVquW3J6uYceSNR2TIY9 ALfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=vOmDMJl64HD76i0nbQn/KLcHH2VkpZtJhnKoc4TsvyI=; b=oc6Id604nb94ZDra4HbZ8le4EmUFXkHNZXtw9DQJvTSww/KeTS/CFlSVxjQmsI+NF/ Qlt/WEr9Mx+xXNo9f5NdNNwOr43zfAGg2jiOeOiIKPHdRNmbxS27nMerneOQOo5JsGav bSJmo3dvL+rXHUJFMkONYTrN6PnlZi/1m7dg6g7t4Jl+7PdZUe1v7bgb8tzGTlHmy82g p5351Svj4ErP93/b/TX+TUnSXyiOHljO65Ko7BYl40OjdK+WzgupyWXd2TEX/9IgN7t3 6y+kJUAs7PDsJJ2P51XRqOmzXdK5KQ1NE8LyD6AWf1v4/XPadWTUHeyKqRAeJQt0JQfe IrAw== X-Gm-Message-State: AOAM531KaeQpG7kQklthKYM4Na9ARzES4PQM9O11Cf07fbaKmNQtOicC yVf1OsQYG3i3exq3PmDWixUJDkdVVI0= X-Google-Smtp-Source: ABdhPJx0E4MrFRpMvygkiB2NyTXcExBYASU6XvE86uq0WtY+hRHEwqlqtFzOjtvy2Qz0HSjWfc75hg== X-Received: by 2002:a5d:5589:: with SMTP id i9mr28096890wrv.316.1643856650144; Wed, 02 Feb 2022 18:50:50 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id f13sm18551009wrp.105.2022.02.02.18.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 18:50:49 -0800 (PST) From: zimoun References: <87k2aewfo5.fsf@gmail.com> <865yqzax7t.fsf@gmail.com> Date: Thu, 03 Feb 2022 03:42:38 +0100 In-Reply-To: <865yqzax7t.fsf@gmail.com> (zimoun's message of "Wed, 05 Jan 2022 00:37:58 +0100") Message-ID: <86a6f81xi9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 25325@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643856685; 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=vOmDMJl64HD76i0nbQn/KLcHH2VkpZtJhnKoc4TsvyI=; b=EoY/cNIMe9M4L9G6eYGJCYBmvnUTQhjDx1hLN3H5L63WWTmYUxUBkSREx+Sf46vAdD3r56 HHi8G/Hos0bp0RSRL3B3G7sx2iAmjKmc0WEolYuT5I6T33e1X39JY65JskV74eqoHYIzHh 44rdbJaAhj3nraWzxeBJzAvQjg9dB22/95gAXjTPKe0C+yDIO3zKc39hZpndK1H+RfJkcZ gvITWpocl37UtiKcvbwApn/CWUp7lknBie09MpgoMFjnoPoz9utB+6W0HFciCVGs4bhLYa vXRVTbMPC7C8uCmk//Kyc4BbkqbA04dgaff5MXH2ZjUTL16rkZgGLFFUac511Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643856685; a=rsa-sha256; cv=none; b=bfmFfrOPYB1H4t+c9CTv/Y/2A9bbjsFbBc6IaKEXQWbSu50EPn1jHyfAcGZUxwZbVqDaaG GfZLhuMMMYnTubmVyorg+AVVYL+LXfW1a8akS4mf68iIjDcIBwCbiLIYrn+eMuub3HXyt5 vdrTV/gbEL3atf68jYBxmaW3om+hbJWmdW/fXqjVY7y7JeCxCe7mjk5kpnVCfMur/THmfw Sxcq+d3irj7bDSXcNme2N/8HTPsn5WyeN/wbQd/defgbyVtBrko8aIdlsbI8EARdbCBsb5 QdUIGS0EgWVRggFbNFK+qzlAvEwbWKPGeB1D/IbSqDzYANboxkPCAliP0lNqXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=MInmNts2; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.53 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=MInmNts2; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 385A61DB40 X-Spam-Score: -2.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2UKbD1mJhooz Hi, On Wed, 05 Jan 2022 at 00:37, zimoun wrote: > I am doing some triage of old bug and I hit this one [1]. Since it is > from 2017 and many things changed since then, is it still an issue? > > 1: Can I assume it is not an issue anymore? > On Sun, 01 Jan 2017 at 14:58, Chris Marusich wrote: >> Please find attached a description of the bug, which came from the >> following email thread: >> >> https://lists.gnu.org/archive/html/guix-devel/2016-12/msg01126.html >> >> From: Chris Marusich >> Subject: Re: Let non-root users use MTP devices (Attempt #2) >> To: ludo@gnu.org (Ludovic Court=C3=A8s) >> Cc: guix-devel@gnu.org >> Date: Thu, 29 Dec 2016 16:41:10 -0800 (5 years, 5 days, 16 hours ago) >> >> ludo@gnu.org (Ludovic Court=C3=A8s) writes: >> >>> Chris Marusich skribis: >>> >>>> Chris Marusich writes: >>>> >>>>> Here's a second attempt to fix MTP support for GuixSD. It's simple a= nd >>>>> requires no special group permissions. >>>>> >>>>> It turns out that elogind (like systemd's logind) can be compiled with >>>>> support for ACLs (provided by libacl), in which case elogind will >>>>> automatically set an ACL on a device file granting access to a user w= hen >>>>> that user is logged in using a seat to which the device is attached. = In >>>>> short, by adding acl as an input to elogind, users will be able to >>>>> access devices without running programs as root, and without being a >>>>> member of any special group. >>>>> >>>>> That's just one piece of the puzzle, though. The other piece is the >>>>> udev rules provided by libmtp. It's necessary to install those udev >>>>> rules; if we don't, then the MTP device won't be tagged properly, so >>>>> elogind will not set any ACLs for it. I've chosen to install those >>>>> rules by modifying the base services in desktop.scm so that all deskt= ops >>>>> will get the rules, not just GNOME; if you know of a better way to >>>>> install them, please let me know. >>>>> >>>>> This patch has a happy side effect. Namely: because elogind is now >>>>> setting ACLs, it gives a user access to other devices that are attach= ed >>>>> to their seat. For instance, after this change, I can access /dev/kvm >>>>> and /dev/cdrom (and other devices) without being root, and without be= ing >>>>> in any special group. How nice! >>>> >>>> After sending this, I've noticed something odd: sometimes, it can take >>>> quite a while for elogind to set the ACLs. It's a bit of a mystery to >>>> me. I'm not sure how/when elogind decides to update the ACLs; I assum= ed >>>> it was continuously checking for changes in the hardware or receiving >>>> notifications about hardware changes, but it seems like elogind isn't >>>> noticing when I plug in my phone. Even though the device file shows u= p, >>>> elogind doesn't set the ACLs unless I do something. >>>> >>>> By "do something," I mean: Apparently, logging out and logging back in >>>> seems to trigger elogind to set the ACLs. Even just switching virtual >>>> terminals (i.e., Control + F1, followed by Control + F7) seems to >>>> trigger it, which is weird. Even when elogind has not yet set the ACL= s, >>>> the "uaccess" tag has in fact been correctly set for the device (as >>>> reported by e.g. "udevadm info /dev/libmtp-1-1"), which leads me to >>>> suspect that elogind is either failing to notice or just ignoring the >>>> hardware change. I wonder if this might be a bug of some kind. >>>> >>>> What do you think we should do? >>> >>> Good question! I don=E2=80=99t know. Does this happen only for MTP de= vices or >>> also with other things (KVM?)? >> >> Yes, this happens for other devices, too. For example, I observe >> exactly the same behavior for /dev/sr0 when I plug in an external CD-ROM >> drive (via USB cable) after logging in. The ACL doesn't get set until >> after I do something like switch to another virtual terminal and back. >> >>> Does =E2=80=9Cudevadm settle=E2=80=9D trigger the ACL change? >> >> No, neither "udevadm settle" nor "sudo udevadm settle" triggers the ACL >> change. I suspect that maybe elogind is ignoring or failing to notice >> the new device, or perhaps the mechanism that elogind relies on to learn >> about new devices is not working for some reason. >> >> It looks like elogind sets the ACLs via devnode_acl_all, defined in >> src/login/logind-acl.c. Ultimately it seems this gets called while in >> seat_set_active (specifically, invoked at src/login/logind-seat.c:213), >> under certain conditions. That's as far as I got. >> >> I cannot reproduce this issue on Ubuntu; there, the ACL gets set >> promptly. Cheers, simon