-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint: Add a sysusers lint #1111
Conversation
OK here's an initial pass at a sysusers analysis. And of course it turns out our default c9s base image has a missing one:
I need to dig in to that one... But here's a better demo showing both tmpfiles.d and sysusers.d lints working together:
|
There's quite a bit more here; a big thing we need to lint against is the case of floating users that own files in the image. |
25e9cf6
to
5186bc0
Compare
Wow. Some archaeology with coreos/fedora-coreos-config@685f213 So yeah we've just been cargo culting this thing forward because Container Linux had it, it doesn't exist by default in other Fedora derivatives AFAICS... Edit: Filed https://gitlab.com/fedora/bootc/base-images/-/issues/41 |
In the interest of cleanliness. Signed-off-by: Colin Walters <walters@verbum.org>
There's probably an equivalent of this somewhere in a crate, but basically dealing with `&Path` and printing it is annoying because we always end up with quotes around a path, even if it's UTF-8 without any spaces. This takes a Path and displays it in a way that will be parsable by a shell, and takes care not to emit quotes in the simple case where a path has no shell metacharacters, just `/`, `.` and alphanumerics. Signed-off-by: Colin Walters <walters@verbum.org>
This was a copy-pasteo. Signed-off-by: Colin Walters <walters@verbum.org>
TODO add this to the base image Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Colin Walters <walters@verbum.org>
This imports the code from https://github.com/coreos/rpm-ostree/tree/main/rust/src/nameservice as of commit coreos/rpm-ostree@e1d43ae Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Colin Walters <walters@verbum.org>
This is not exhaustive yet, but catches things that invoke `useradd` (whether a dpkg/rpm `%post` or just a plain `RUN useradd` in a container) that don't have a sysusers.d entry. Signed-off-by: Colin Walters <walters@verbum.org>
On general principle; this fixes a test failure in the lint unit tests which don't create /etc/passwd. But also, someone might reasonably create an image this way. Signed-off-by: Colin Walters <walters@verbum.org>
This is more readable. Signed-off-by: Colin Walters <walters@verbum.org>
5186bc0
to
bf10e34
Compare
I think we can merge this one but the downside here is it will emit a warning on the current base image until we merge https://gitlab.com/fedora/bootc/base-images/-/merge_requests/94 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
tmpfiles: Drop an unused file
This was a copy-pasteo.
Signed-off-by: Colin Walters walters@verbum.org
hack: Add missing sysusers.d entry for sudo
TODO add this to the base image
Signed-off-by: Colin Walters walters@verbum.org
sysusers: New stub crate
Signed-off-by: Colin Walters walters@verbum.org
sysusers: Import nameservice code from rpm-ostree
This imports the code from
https://github.com/coreos/rpm-ostree/tree/main/rust/src/nameservice
as of commit
coreos/rpm-ostree@e1d43ae
Signed-off-by: Colin Walters walters@verbum.org
sysusers: Add analysis support
Signed-off-by: Colin Walters walters@verbum.org
lint: Add a sysusers lint
This is not exhaustive yet, but catches things that invoke
useradd
(whether a dpkg/rpm%post
or just a plainRUN useradd
in a container)that don't have a sysusers.d entry.
Signed-off-by: Colin Walters walters@verbum.org