Skip to content
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

Add an option to provide externally configured Command #15

Merged
merged 1 commit into from Nov 23, 2021

Conversation

cgwalters
Copy link
Collaborator

This will allow higher level tooling to inject their own
sandboxing.

I would like to add opinionated usage of e.g. systemd-run but
this is a useful start.

cgwalters added a commit to cgwalters/rpm-ostree that referenced this pull request Nov 22, 2021
Depends: containers/containers-image-proxy-rs#15

A core principle I want to maintain going forward is that the host
updates is isolated from containerized applications.

Today for example the containers/storage stack will do things like
access `~/.docker` and worse things like `/var/lib/containers` for
caching purposes.

By using systemd to spawn a `DynamicUser` for the `skopeo` process,
we are guaranteed that the fetcher process runs with very low
privileges (no access to application containers) and has no persistent
state.

Now, it turns out that today this is actually blocked by the Fedora
selinux policy:
`[ 3589.002130] audit: type=1400 audit(1637602145.194:288): avc:  denied  { read } for  pid=1223 comm="dbus-broker" path="pipe:[14969]" dev="pipefs" ino=14969 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:install_t:s0-s0:c0.c1023 tclass=fifo_file permissive=0`
because we're trying to pass a pipe fd across the system bus.

It may work to talk to the system private socket directly; would
require switching to the raw DBus API instead of having `systemd-run`
do it for us.

Longer term though, I think what we really want is to teach systemd
APIs to support this kind of "unprivileged worker process that is bound
to the lifecycle of a larger unit".  In particular the above bug
with passing a pipe would be fixed if we could have this unit log
using the same journal stream as the main daemon.
@cgwalters
Copy link
Collaborator Author

Example user in coreos/rpm-ostree#3239

(Tested with that and... 😢 ... setenforce 0)

src/imageproxy.rs Outdated Show resolved Hide resolved
This will allow higher level tooling to inject their own
sandboxing.

I would like to add opinionated usage of e.g. `systemd-run` but
this is a useful start.
@jlebon jlebon merged commit b9032c9 into containers:main Nov 23, 2021
cgwalters added a commit to cgwalters/rpm-ostree that referenced this pull request Jul 13, 2022
Depends: containers/containers-image-proxy-rs#15

A core principle I want to maintain going forward is that the host
updates is isolated from containerized applications.

Today for example the containers/storage stack will do things like
access `~/.docker` and worse things like `/var/lib/containers` for
caching purposes.

By using systemd to spawn a `DynamicUser` for the `skopeo` process,
we are guaranteed that the fetcher process runs with very low
privileges (no access to application containers) and has no persistent
state.

Now, it turns out that today this is actually blocked by the Fedora
selinux policy:
`[ 3589.002130] audit: type=1400 audit(1637602145.194:288): avc:  denied  { read } for  pid=1223 comm="dbus-broker" path="pipe:[14969]" dev="pipefs" ino=14969 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:install_t:s0-s0:c0.c1023 tclass=fifo_file permissive=0`
because we're trying to pass a pipe fd across the system bus.

It may work to talk to the system private socket directly; would
require switching to the raw DBus API instead of having `systemd-run`
do it for us.

Longer term though, I think what we really want is to teach systemd
APIs to support this kind of "unprivileged worker process that is bound
to the lifecycle of a larger unit".  In particular the above bug
with passing a pipe would be fixed if we could have this unit log
using the same journal stream as the main daemon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants