From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id C3BB71FF15C
	for <inbox@lore.proxmox.com>; Fri, 18 Apr 2025 15:26:16 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 3F7413C436;
	Fri, 18 Apr 2025 15:26:13 +0200 (CEST)
References: <20250416125651.334868-1-m.sandoval@proxmox.com>
 <af6e3b28-768d-424e-ada7-ce9d7977362e@proxmox.com>
 <s8ott6liq4q.fsf@proxmox.com>
 <567b74be-6551-497d-82b7-03a2a0690a87@proxmox.com>
User-agent: mu4e 1.10.8; emacs 30.1
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Date: Fri, 18 Apr 2025 15:20:29 +0200
In-reply-to: <567b74be-6551-497d-82b7-03a2a0690a87@proxmox.com>
Message-ID: <s8oplh9iotn.fsf@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.096 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH backup v3 1/2] http_client: store tickets in
 the user's config directory
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>,
 Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>


Thomas Lamprecht <t.lamprecht@proxmox.com> writes:

> Am 18.04.25 um 14:47 schrieb Maximiliano Sandoval:
>> Regarding kernel keyring or systemd creds, at least the later requires
>> root access as of debian 12. An issue common to these three mechanisms
>> is that they all make assumptions about permissions, the backup client
>> could be run as an arbitrary user which might not have permissions to
>> any of /run, the keyring, nor the system credentials.
>
> The kernel keyring does not read root, it works as every user and has
> a per user (uid) keyring as one of it default keyrings, which makes it
> quite neat and normally exactly the right choice for such stuff.
>

Interesting. I will take a look.

>
> You can use the keyctl as CLI tool to experiment with the keyring without
> having to write a program using the syscalls directly.
>
> The following example works just fine a standard user, as it should work
> for every UID on the system. It adds a user key named "test" in the "@u"
> uid keyring:
>
>   keyctl add user test "super secure ticket" @u
>
> It returns the key serial number (ID), but you can also list the keys
> from a keyring:
>
>   keyctl list @u
>
>
> Or search by name:
>
>   keyctl search @u user test
>
> And then use the serial number to read the content, e.g.:
>
>   keyctl print 304368094
>
> The only "downside" is that it won't survive a reboot, so if a user

Not an issue in this particular case, as the current approach won't
survive the user logging out either.

> frequently reboots but would like to stay logged in then this won't
> work, but tbh. I'd just tell them: though luck, use an API token and
> handle passing it yourself in that case that is IMO rather.
>
> I'd not be surprised if Wolfgang either has rust code for accessing
> the keyring nicely or maybe knows a sane and current crate for that.
> In any case, this seems like a much nicer solution all around to me,
> but I naturally could have overlooked some drawback.

Regarding the system credentials, it is also possible to use them as a
regular user on newer systemd versions (than the one offered by Debian
12), however I have not read yet about what security guarantees they
offer.


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel