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 OO4BHqZx0WH5vAAAgWs5BA (envelope-from ) for ; Sun, 02 Jan 2022 10:34:30 +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 LpymGqZx0WH6ygAAauVa8A (envelope-from ) for ; Sun, 02 Jan 2022 10:34:30 +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 CA1432D61D for ; Sun, 2 Jan 2022 10:34:29 +0100 (CET) Received: from localhost ([::1]:60746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3xG0-0001G6-6e for larch@yhetil.org; Sun, 02 Jan 2022 04:34:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3xFS-0001Fy-Ba for help-guix@gnu.org; Sun, 02 Jan 2022 04:33:54 -0500 Received: from bumble.birch.relay.mailchannels.net ([23.83.209.25]:12038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3xFP-0004aD-TW for help-guix@gnu.org; Sun, 02 Jan 2022 04:33:54 -0500 X-Sender-Id: instrampxe0y3a|x-authuser|paul@teulu.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id BEB5862237E; Sun, 2 Jan 2022 09:33:08 +0000 (UTC) Received: from cpanel-008-lon.hostingww.com (unknown [127.0.0.6]) (Authenticated sender: instrampxe0y3a) by relay.mailchannels.net (Postfix) with ESMTPA id 8D98362124C; Sun, 2 Jan 2022 09:33:07 +0000 (UTC) X-Sender-Id: instrampxe0y3a|x-authuser|paul@teulu.org Received: from cpanel-008-lon.hostingww.com (cpanel-008-lon.hostingww.com [35.177.91.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.97.65.167 (trex/6.4.3); Sun, 02 Jan 2022 09:33:08 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: instrampxe0y3a|x-authuser|paul@teulu.org X-MailChannels-Auth-Id: instrampxe0y3a X-Bitter-Supply: 4c41a56f03013acd_1641115988593_3070161023 X-MC-Loop-Signature: 1641115988593:748913456 X-MC-Ingress-Time: 1641115988593 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=teulu.org; s=default; h=In-Reply-To:Subject:From:References:Cc:To:MIME-Version:Date: Message-ID:Content-Type: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=fSJCT/v/2ovCf2YoD3Nwdm7HsXHOk9K8u5BUtX+soBU=; b=LrEnS/jT9GSW67WdaKHtaKdzeG j0a5qKQmq48nNVjA9M/gTpp4oRduW59ELqTrGtf89iOOhL6SpWeLENKEyGeMXtmho7w8x8fkK6ck7 y3/P4ElYTERTTPRWYBfcu9BK9qjPxX3FL597w8sbt0oXKg1wuvlkC+jWk0kTw32XfkafbxxL8p9xv kua/yzlwVMAeBHau/dpAM+ZATbN38cB4u7Ffcbxj/LdKQTn5dHmPFcEy1wAXoFmqpDBwXlcwTL1ig FzOObsHb83lWrCZtsjSlz64nSlSK6mevUwPsR71EK27zU2zsFAjmwmrxrAoA9UdrGAIgOnD0PbVTg JDCZ7Hcg==; Received: from 67.26.169.217.in-addr.arpa ([217.169.26.67]:59864 helo=[192.168.1.161]) by cpanel-008-lon.hostingww.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1n3xEa-0004Cd-AV; Sun, 02 Jan 2022 20:33:05 +1100 Message-ID: Date: Sun, 2 Jan 2022 09:32:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-GB To: Josselin Poiret , raingloom References: <0f941db1-51a5-b579-7f2c-7333057cb402@teulu.org> <6404264d-e6c9-831c-9e5f-8327488201eb@teulu.org> <20211229015029.7f75bb7b@riseup.net> <20211230200023.7aec38ae@riseup.net> <878rw0fwgr.fsf@jpoiret.xyz> From: Paul Jewell Subject: Re: bug#52904: nmtui - user authorisation In-Reply-To: <878rw0fwgr.fsf@jpoiret.xyz> X-OutGoing-Spam-Status: No, score=-1.0 X-AuthUser: paul@teulu.org Received-SPF: softfail client-ip=23.83.209.25; envelope-from=paul@teulu.org; helo=bumble.birch.relay.mailchannels.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, NICE_REPLY_A=-3.024, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=unavailable autolearn_force=no X-Spam_action: no action Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: help-guix@gnu.org, 52904@debbugs.gnu.org Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-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=1641116070; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=cqTbfUG39G1p+Le7O2atHa6MYo9pAim/i4Y7nV0ianA=; b=NH7sqceJbJ3/JFJ7qJxKwf0FU5SpLGAN2JUt67fzThZIbNnq61N3oJcx2BRfKJA5T5IKKd YN0dv86qrUgtjcLSwTQN8LzBGsDSar44rN0EU8bMjSGhHRSM5jJZHrkV21h0yJKfXQIHMj ySqB6p3o/Gq82wsYR5YjcNdCGrS/uX8PtyotUlrhxmZXT2yN+f1B80YHvEPOMyUH6CbQl0 ucmJganKa6xXJh/MYnMnlsUxMIZqsVYNxVD5jbHEtgcZWzDNWLcm7eo244Novaun581Hse RLZL1i3704OhULwLxYqA5H78Wqpc8BPqkkE7TkjRo5J9WxpIcq1J/7Ke0dZQIA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641116070; a=rsa-sha256; cv=none; b=QmnoxD66GF4qe+oVsgeu3YxmRiDSHe5uXKy2aK1OSKBsRb+2be1XdNjWbunL1LTqr5JgOK Sm3GomIiwSARIQw1S9HpL7XSuX6dTSqGyWEEOv0/Ugyy2QSsBLuUW4Ft6CygMvHTctDHqE 2vODy5ZTNWG3FyCmO+rgBD8QovXQzj0U1oLPISTkprWT6+6ytm4zS0TElum2fbcClXzW3o 7hAyfQinxCJBriGoSESKr2qez+LLglzEeh2hitAToq7H4IpHnh0C0EKdB73v7Sp4G+WVlI 6XnFUIGPNKKAd/eQvICpKydnigM57jzUExLDuBLZB/VPj1wozwJL6UwuwSP63Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=teulu.org header.s=default header.b="LrEnS/jT"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.08 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=teulu.org header.s=default header.b="LrEnS/jT"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: CA1432D61D X-Spam-Score: -2.08 X-Migadu-Scanner: scn1.migadu.com X-TUID: Gs3XHeKV1epY On 31/12/2021 18:41, Josselin Poiret wrote: > Hello, > raingloom writes: > >> On Wed, 29 Dec 2021 11:04:39 +0000 >> Paul Jewell wrote: >> >>> On 29/12/2021 00:50, raingloom wrote: >>>> On Tue, 28 Dec 2021 18:39:52 +0000 >>>> Paul Jewell wrote: >>>> >>>>> On 27/12/2021 23:20, Leo Famulari wrote: >>>>>> On Mon, Dec 27, 2021 at 10:07:17PM +0000, Paul Jewell wrote: >>>>>>> Solved this - nmtui needs to be run as root; my script which >>>>>>> invoked the program didn't consider that. Changing it to run as >>>>>>> sudo gives me an opportunity to enter my password, and then >>>>>>> successfully setup the wifi interface details. >>>>>> Another option is to add nmtui to the list of programs that are >>>>>> setuid. That way, any user on your system could configure wifi, >>>>>> which may be more ergonomic. >>>>>> >>>>>> https://guix.gnu.org/manual/devel/en/html_node/Setuid-Programs.html >>>>>> >>>>> This option did work as expected. The only additional point for >>>>> anyone else coming across this post with the same issue: remember >>>>> to add the >>>>> >>>>> #:use-module (gnu system setuid) >>>>> >>>>> so the setuid record is known. >>>>> >>>>> Thanks Leo! >>>> Uhm, I'm pretty sure NetworkManager lets any user modify networking >>>> settings as long as they are in a certain group? >>>> https://wiki.archlinux.org/title/NetworkManager#Set_up_PolicyKit_permissions >>>> >>>> At least that's how it is on postmarketOS and I'm also fairly >>>> certain I never needed root access to set up WiFi under Guix >>>> either, but I don't have a system at hand to verify that on. >>> I did also think this, but I couldn't identify which group would let >>> this happen. I thought it would be the netdev group, but my user >>> account is already a member of that group. The network group is >>> unknown to the system (as in I had an error when trying to add the >>> user to the supplementary group) so I added it, but it didn't have >>> any effect (after rebooting). If there is another group I should be >>> in, I am not sure how to find out. At the moment, the setuid approach >>> seems to work OK (although I would prefer a group solution!). >>> >>> I am interested in anyone else's experience! >> It might be that everyone else is including some default configuration >> for NetworkManager and we aren't. At the very least it should be >> documented how to set it up to use groups. >> >> CC-ing bugs-guix > NetworkManager uses dbus to communicate with its root-run service, and > Polkit to check for permissions. By default, the NetworkManager actions > are pretty permissive, you can do most of them without reauthenticating, > except for a couple specific ones. > > More in detail, Polkit works by looking up the PID of processes that > ask for specific actions, and then asking systemd-logind/elogind which > session that process is attached to. Then, there are three different > cases: > * the session is active (not locked, I think that means in logind > parlance). In this case, Polkit looks at the `allow_active` rule. > * the session is inactive (or locked). Then, Polkit looks at the > `allow_inactive`. > * there is no session attached to the process (possible for eg. system > services). Then, Polkit looks at the `allow_any` rule. > > Now, if you look at network-manager's > /share/polkit-1/actions/org.freedesktop.NetworkManager.policy, you can > see that some actions are possible for active sessions, while impossible > for inactive sessions, or even processes not attached to the session. > > So, I think the issue is that you are trying to do some actions outside > of a session, or in an inactive session, and Polkit refuses to let you > do that. I don't think there is a way to circumvent that, since there > is no `allow_any` rule for many actions, but I don't know what this > entails (if it is an implicit `no`, `auth_admin`, etc...). > > Note that we have a catch-all rule defined at `polkit-wheel` in > gnu/services/desktop.scm that says that administrative users are exactly > the users in the group `wheel`. That means that when Polkit needs to > authenticate an administrative user, it will ask for your own password > if you're in the `wheel` group, but you still need to reauthenticate, > you cannot bypass that check. > > I hope this clears up how Polkit works, and why the action is denied. > Good morning Josselin, and Happy New Year! Many thanks for taking the time to explain this in detail for us. If I have properly understood your explanation, it suggests I am running network-manager from outside of the dbus session. If I look at the processes running on my system at this moment, the dbus-launch process has an id of 881, while the network-manager session has an id of 463, suggesting that it was started before dbus. My system configuration is relatively standard (if there is such a thing) - I don't do anything to change how dbus or network manager are launched, but rely on the defaults provided by the the desktop-service. Is there any way to ensure network-manager is launched inside the dbus session? I am using slim rather than gdm, and as a desktop manager I am using dwm (with some local changes). Regarding the wheel group - my user is in this group, but I don't get any request for a password - nmtui simply informs me that I don't have the necessary authorisation.