unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: "Ludovic Courtès" <ludo@gnu.org>,
	"Felix Lechner" <felix.lechner@gmail.com>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: A corner case of broken reproducibility
Date: Mon, 30 May 2022 22:50:10 +0200	[thread overview]
Message-ID: <31d13a6014b14c886686bca833d926604ce3379d.camel@telenet.be> (raw)
In-Reply-To: <87leuj108h.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2600 bytes --]

Ludovic Courtès schreef op ma 30-05-2022 om 17:58 [+0200]:
> Perhaps it should forcefully “chown -R” home directories at boot time,
> so they have the right UID?  This has been discussed a few times,

I haven't seen the "chown -R" suggestion yet in the context of homes
(only for system accounts, and at activation time, not only boot time).

> especially in the context of system accounts; systemd-homed appears to
> be doing exactly that.

I don't think the problem is that the uid of /home/... was wrong,
rather I think the problem is that Guix has forgotten the uid and hence
invents a new one to put in /etc/passwd instead of keeping the old one.

A pitfall (noticed in the context of system accounts): the user could
have created files outside /home (e.g. in /tmp).  IIUC, this would also
require a reboot to keep name<->uid consistent after "guix system
reconfigure".

A 'chown -R' doesn't seem great to me from a security perspective
(seems very easy to get something wrong, and the TOCTTOU-free chownat
hasn't been merged yet in Guile), a performance perspective (what if
you have a huge $HOME).  Also extra io -> slower boot + disk wear.
It also destroys some information, it's possible to intentionally have
files owned by other users inside $HOME.

Things that seem missing here to me:

  * a mechanism for remembering that an uid is still in use even though
    the user has been removed (previously mentioned solutions: keep the
    uid in /etc/passwd even though it is ‘removed’, or keep a separate
    /etc/passwd-graveyard or such, etc.).  For system accounts and user
    accounts.  Won't help in this particular case but would make more
    general adding/removing user accounts less fragile (avoid 
    accidental reuse).

  * a mechanism for telling Guix ‘I'm renaming the user account, not
    creating and removing a new one, so keep the uid’

  * some heuristics for detecting mistakes (e.g.: if Guix thinks it
    should create a directory /home/foo for uid 1234, but it notices
    there is already a directory /home/bar with that uid 1234, then
    that's super suspicious.  Likewise, if Guix thinks the home
    /home/foo should be owned by uid 1234, but it notices it's already
    owned by 1235!=1234, that's also suspicious).

    IIUC, Blake Shaw only changed their user name, not the home
    directory, so this would have detected the problem

  * some mechanism for resolving mistakes 

Or maybe something else entirely, whatever works without causing new
problems I guess.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2022-05-30 20:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  6:10 A corner case of broken reproducibility Blake Shaw
2022-05-25 11:35 ` Felix Lechner
2022-05-30 15:58   ` Ludovic Courtès
2022-05-30 20:50     ` Maxime Devos [this message]
2022-06-01 16:38       ` Ludovic Courtès
2022-06-01 19:59         ` Maxime Devos
2022-06-02 14:13           ` Ludovic Courtès
2022-06-02 14:43             ` Maxime Devos
2022-06-01 20:09         ` Maxime Devos
2022-06-01 20:41           ` raingloom
2022-06-01 21:50             ` Maxime Devos
2022-06-02 14:08           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31d13a6014b14c886686bca833d926604ce3379d.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=felix.lechner@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).