Skip to content

Commit

Permalink
WIP: compose: Add experimental/sysusers option
Browse files Browse the repository at this point in the history
First, we add support for a new `experimental:` key.  Then
there's a new `sysusers` key underneath that.

When enabled, we drop all of the other previous passwd handling.
In practice the only one that was used was having static files.
That is a pain to maintain.

However, we need to statically assign non-zero uid/gid for any
files that come from a base ostree commit.  Anything else
would mean the user/groups could be unpredictably assigned in different
rpm-ostree runs.

This code now checks for an errors out on that.

In order to convert *fully* to sysusers, we install an interceptor for
`useradd/groupadd` that talk back via a pipe to the compose process.
These invocations then get translated to drop into a new`
`sysusers.d/rpmostree-auto.conf` file.

This way we don't need to require that every RPM have ported to
sysusers.d.

At the end, we drop everything in `/etc/passwd` and `/etc/group`
except for the `root:` entries, relying on `systemd-sysusers` to
readd everything at boot time.

Closes: #49
  • Loading branch information
cgwalters committed Apr 15, 2019
1 parent 6b2ac58 commit d6a0ef7
Show file tree
Hide file tree
Showing 16 changed files with 1,395 additions and 61 deletions.
11 changes: 11 additions & 0 deletions docs/manual/treefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,14 @@ version of `rpm-ostree`.

* `rojig`: Object, optional. Sub-keys are `name`, `summary`, `license`,
and `description`. Of those, `name` and `license` are mandatory.

* `sysusers`: boolean, optional: Defaults to `false`. Enable generation of
systemd sysusers.d entries based on `useradd`/`gruopadd` invocations. If enabled,
this overrides `preserve-passwd`. It also obsoletes `check-passwd`.

* `syusers-users`: List of `string` -> `number` mappings. When sysusers is
enabled, it is required that any non-root-owned files that are in `/usr`
(and hence shipped with the ostree commit) have static mappings. Otherwise,
the values could change across builds.

* `sysusers-groups`: Same as `sysusers-users` but for groups.
3 changes: 3 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ mod treefile;
pub use self::treefile::*;
mod utils;
pub use self::utils::*;
mod sysusers;
pub use self::sysusers::*;

Loading

0 comments on commit d6a0ef7

Please sign in to comment.