unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 34730@debbugs.gnu.org
Subject: [bug#34730] [PATCH 0/4] Add (gnu build accounts) and use it to create /etc/passwd & co.
Date: Mon,  4 Mar 2019 12:12:13 +0100	[thread overview]
Message-ID: <20190304111213.8436-1-ludo@gnu.org> (raw)

Hello Guix!

This patch series adds a new module, (gnu build accounts), and
uses it to create /etc/{passwd,group,shadow} upon system activation.

This replaces functionality currently provided by the Shadow
command-line tools (‘useradd’, ‘usermod’, etc.) and libc (‘getspnam’,
‘putpwent’, and all these wonderful APIs.)

It’s more code on our side, but it’s overall much less code involved
to create those databases.  The code makes the UID/GID allocation
strategy and state handling (preserving passwords and UIDs/GIDs, not
reusing currently-used UIDs/GIDs, etc.) much clearer and auditable.
Previously all this was buried in imperative calls to ‘useradd’ & co.,
which in turn have an ID allocation strategy baked deep down into
the Shadow code.

As a side effect the system boots slightly faster and we get PIDs
starting at ~190 instead of ~300 on a bare-bones system.  :-)

Feedback welcome!

Ludo’.

Ludovic Courtès (4):
  system: Add (gnu system accounts).
  activation: Operate on <user-account> and <user-group> records.
  Add (gnu build accounts).
  activation: Build account databases with (gnu build accounts).

 Makefile.am              |   1 +
 gnu/build/accounts.scm   | 561 +++++++++++++++++++++++++++++++++++++++
 gnu/build/activation.scm | 245 +++--------------
 gnu/build/install.scm    |   3 +-
 gnu/local.mk             |   2 +
 gnu/system/accounts.scm  | 109 ++++++++
 gnu/system/shadow.scm    |  92 +++----
 tests/accounts.scm       | 309 +++++++++++++++++++++
 8 files changed, 1061 insertions(+), 261 deletions(-)
 create mode 100644 gnu/build/accounts.scm
 create mode 100644 gnu/system/accounts.scm
 create mode 100644 tests/accounts.scm

-- 
2.21.0

             reply	other threads:[~2019-03-04 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 11:12 Ludovic Courtès [this message]
2019-03-04 11:16 ` [bug#34730] [PATCH 1/4] system: Add (gnu system accounts) Ludovic Courtès
2019-03-04 11:16   ` [bug#34730] [PATCH 2/4] activation: Operate on <user-account> and <user-group> records Ludovic Courtès
2019-03-04 11:16   ` [bug#34730] [PATCH 3/4] Add (gnu build accounts) Ludovic Courtès
2019-03-04 11:16   ` [bug#34730] [PATCH 4/4] activation: Build account databases with " Ludovic Courtès
2019-03-07 19:49 ` bug#34730: [PATCH 0/4] Add (gnu build accounts) and use it to create /etc/passwd & co 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=20190304111213.8436-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=34730@debbugs.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).