All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémy ROSEN" <jeremy.rosen@smile.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/3] support/scripts/mkusers: allow option for system uid/gid
Date: Wed, 16 Sep 2020 08:41:47 +0200	[thread overview]
Message-ID: <CAFvCimXckN_s=b3N0-Ys=o=q8=FQZxk3bqT5ngu8ggjXEgaOyQ@mail.gmail.com> (raw)
In-Reply-To: <CADYdroMULeB=so8q27z1PfK2yFh+myhBV_Dm6+5+AJzqKFDhQA@mail.gmail.com>

I'll give a bit more detail about the way journald handles system/user UID.
there might be other places where systemd treats them differently, but
that's the only
one I know from memory.

journald collects all logs on the system
* from the daemons running around
* from the kernel/audit system
* from containers
* from user sessions.

When a user logs in, a "per user" instance of systemd is spawned that
can starts daemons for that user (ssh-agent, pulseaudio, colord...
daemons that make sense at the user level but not at the system level)

To ease the handling of permissions and reading those files, journald does
not store all logs in a single file, but in one file per user. Journald uses
ACL to allow each user to have access to his logs through normal unix
permissions instead of relying on some sort of SUID mechanism.

However, it would be a bad idea to have a separate journal file for system
users, since system users are part of the system and the log they produce
are really only for the administrator to see. So those logs are stored with
the
system logs in the machine's main log file.

The separation between the two types of users uses the UID1000 split

A quick grep in systemd yields a couple of other usages
* systemd-coredumps will tweak access right to allow non-system users to
  read the core-dumps they generate
* When closing a session, logind may clean up IPC for non-system user.
  The explanation is a bit complex so i'll just copy/paste the comment in
the code

        /* Clean SysV + POSIX IPC objects, but only if this is not a system
user. Background: in many setups cronjobs
         * are run in full PAM and thus logind sessions, even if the code
run doesn't belong to actual users but to
         * system components. Since enable RemoveIPC= globally for all
users, we need to be a bit careful with such
         * cases, as we shouldn't accidentally remove a system service's
IPC objects while it is running, just because
         * a cronjob running as the same user just finished. Hence: exclude
system users generally from IPC clean-up,
         * and do it only for normal users. */

* there is a unit condition calle ConditionUser= (and AssertUser=) that
  allow to limit a unit file to only be allowed for a certain user. This
condition
  can take a user name, a UID or the magic value "@system" to be allowed
  to any system user


Regards
Jeremy


-- 
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asni?res-sur-Seine
*J?r?my ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook]
<https://www.facebook.com/smileopensource> [image: LinkedIn]
<https://www.linkedin.com/company/smile> [image: Github]
<https://github.com/Smile-SA>

[image: D?couvrez l?univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200916/dbf5dbef/attachment.html>

  reply	other threads:[~2020-09-16  6:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13 15:35 [Buildroot] [PATCH 1/3] support/scripts/mkusers: allow option for system uid/gid Norbert Lange
2020-01-13 15:35 ` [Buildroot] [PATCH 2/3] package/systemd: create system users Norbert Lange
2020-01-13 16:05   ` Thomas Petazzoni
2020-01-13 15:35 ` [Buildroot] [PATCH 3/3] package/openssh: " Norbert Lange
2020-09-15 20:47 ` [Buildroot] [PATCH 1/3] support/scripts/mkusers: allow option for system uid/gid Thomas Petazzoni
2020-09-15 21:29   ` Norbert Lange
2020-09-16  6:41     ` Jérémy ROSEN [this message]
2020-09-16  6:53     ` Thomas Petazzoni

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

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

  git send-email \
    --in-reply-to='CAFvCimXckN_s=b3N0-Ys=o=q8=FQZxk3bqT5ngu8ggjXEgaOyQ@mail.gmail.com' \
    --to=jeremy.rosen@smile.fr \
    --cc=buildroot@busybox.net \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.