Conversation
be6e84b to
ee70787
Compare
961e125 to
d17b732
Compare
|
@pebenito I think the policy is very close to being complete, but I want your opinion on this before moving forward: How do you feel about splitting the current implementation of the In its current state, I think overall this has a significant advantage over the current implementation, albeit at the cost of a little extra complexity. |
|
I'm fine with that. We could have a common set of rules between them, and then final |
42ab547 to
8ab0483
Compare
|
I think after a long while this is finally ready. Please go ahead with the review @pebenito ! |
|
BTW I'm reviewing and commenting in order of the diff github shows, since this will take some time. |
ghost
left a comment
There was a problem hiding this comment.
Just a random comment and heads-up
Are you differentiating between user containers and/or docker instances and system containers and/or docker instances?
If true then you may want to rethink, here is why:
Podman (and I guess Docker as well). by default labels "containers" as per what is specified in lxc_contexts.
For example the "process =" entry tells Podman (and I guess Docker) what label it should manually associate with container processes. (similar for "file", "init_process" etc)
This means in a nutshell that you can only have one default container label set. If you decide to implement more than one container label set (for example by differentiating between user and system containers) then eventually you will end up with issues.
Most of the defaults can be manually overriding on the command line with Podman (and I guess Docker) but not everything.
For example "Pod infra containers" are labeled with (I believe the context specified with "process =" in lxc_contexts and there is (I believe) no way to manually override that context on the Podman (and I guess Docker) command line.
So if you specify for example "proccess = system_u:system_r:system_container_t:s0" then "user pods" will (I believe)) and up with that context and there will be no way to override it (AFAIK)
One take away I have from looking into this matter is that:
"Walsh went too far trying to simplify it" and now "I have to go too far trying get stuff to work"
Granted that back when Docker and Podman were initially conceived there were no usable user name spaces and so it was probably never foreseen that there would eventually not only be a "system instances" but also "user instance(s)".
Now were essentially forced to treat them the same,, with all of the nasties associated with that.
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
systemd running inside containers needs to be able to manage cgroups. Add this feature behind a tunable. Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Make conmon run in a separate domain and allow podman types to transition to it. Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Add a type and allow execute access to executable files that may be freely managed by users in their home directories. Although users may normally execute anything labeled user_home_t, this type is intended to be executed by user services such as the user's systemd --user instance. Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Add an interface to allow systemd user daemons to use systemd notify and an interface to write to the systemd user runtime named socket. Signed-off-by: Kenton Groombridge <me@concord.sh>
Rootlesskit is required by rootless docker Signed-off-by: Kenton Groombridge <me@concord.sh>
Rootless docker runs as root in a user namespace. Because of this, rootless docker containers will run as spc_user_t as docker cannot be SELinux-aware in its own container. Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Signed-off-by: Kenton Groombridge <me@concord.sh>
Found to be required by a jellyfin container when testing. Signed-off-by: Kenton Groombridge <me@concord.sh>
|
Again, I really appreciate your effort on this. This is a massive contribution. Thanks! |
Thank you for your support! |
This adds a container module to refpolicy, bringing minimum viable support for container engines.
The
svirt_lxc_net_ttype was recycled intocontainer_tincontainer-selinux. This PR will do the same.This PR tries to maintain best semantics and nomenclature compatibility withcontainer-selinuxwhere possible, with the biggest deviation being thatcontainer_runtime_t(container-selinux) is calledcontainer_engine_tin this policy.Types were added for
podmananddockeras well as for rootlesspodmanhaving its own type for users. The same goes forspc_tandspc_user_t.I'm hoping that by the time this is merged it will encourage more contributions to the module in order to support a wider array of container engines, i.e. Docker and Kubernetes. So far I have been building this policy while using
podmanon a production server.Some things to consider:
container_engine_tconflicts with a type of the same name incontainer-selinux(https://github.com/containers/container-selinux/blob/db7dcc5b8377405ec8d47a940ef78e19199bebea/container.te#L1252)container_engine_ttocontainer_manager_tor something else (also helps with the above)DoneSplit out some access fromcontainer_engine_domainintocontainer_engine_t, since most of the testing was done with onlypodmananddocker`Create separate types forDonepodmananddockeras there are some accesses shared by both that are not used by bothSplit out some access fromDonecontainer_torcontainer_domaintocontainer_net_domainlikecontainer-selinuxsvirt_lxc_tout of thevirtmodule (probably won't do this sincesvirt_lxc_tis tied heavily tolibvirt)Fixes: #397
Relates-To: flatcar-linux/Flatcar/issues/479