-
Notifications
You must be signed in to change notification settings - Fork 48
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
Jail capabilities for docker are dangerous for host networking #119
Comments
Sorry to hear you ran into issues while using jailmaker. Thanks for reporting though! You're right, this area needs improvement. I plan to remove the To provide some context, jailmaker evolved from my workaround to run docker on the TrueNAS host directly (when the docker binaries were still included on the base system). This is equivalent to running docker inside a jail with host networking and I never ran into the issues you describe, even when I was running docker inside a jail with
By the way, instead of disabling seccomp completely:
You could also add: Out of curiosity, what exactly did you do which caused:
This may be a good example scenario to put in a warning. Were you not aware of the fact that the jail is using host networking by default? |
Thanks, I'm aware of all this, I actually read through virtually every single line in this repo already
I assume you mean
This sadly affects everything, including bridges on the host, VMs etc, not only apps.
Thank you, I will test it out.
Basically I ran a jail with host networking and
I was aware that it was using host networking, I was unaware that literally all capabilities were enabled in the jail - I didn't expect it and I'm sure others won't expect it either. My point is there should be a fair warning when combining host networking and |
Yes that's what I meant. When creating a jail with host networking for the purpose of running docker, then docker needs to be able to create firewall rules in the host networking namespace. So the jail does need CAP_NET_ADMIN in this case. It's no longer is the recommended way of running docker in a jail though so as a first step it would be a good idea to remove the docker_compatible setup question from the interactive create process and refer users to the docker config template instead. What do you think? |
Yeah, exactly, I absolutely agree. Also, if you disallow the combination of host networking and CAP_NET_ADMIN, you could go as far as considering jailmaker safe. |
Remove --property=DeviceAllow= so it won't interfere with DevicePolicy=auto Added seccomp config option Deprecated docker_compatible config option Deprecated gpu_passthrough config option Removed the docker_compatible question during interactive create Updated readme and config templates Closes #119
@templehasfallen could you review/test #121? |
Hey, just tested on both 23.10.2 and 24.04-RC1 without any issues. All of the functionality seems to work both using a template and manually for a docker compatible jail, including running containers and exposing them. Thanks a lot and great work :) |
Thank you! |
I never hit this as I immediately used the docker template with bridge networking, to simplify replacing my docker vm |
Remove --property=DeviceAllow= so it won't interfere with DevicePolicy=auto Added seccomp config option Deprecated docker_compatible config option Deprecated gpu_passthrough config option Removed the docker_compatible question during interactive create Updated readme and config templates Closes #119
I noticed a severe issue with the current "docker_compatible" flag.
From what I see,
--capabilities=all
is passed to systemd-nspawn which is reckless on many levels and poses various problems and security risks.This does not happen when
docker_compatible=0
as the jail does not have CAP_NET_ADMIN and cannot access host firewall.As an example, my whole host iptables was wrecked by the hands of the jail. The combination of CAP_NET_ADMIN and host-networking is very dangerous and should at least include a warning if not being disallowed. The result was complete connectivity loss from all clients to the TrueNAS server, which can happen in many scenarios such as:
To be completely clear, I ended up with a bunch of iptables rules which were added inside a jail, on the host.
Steps to reproduce:
iptables -A INPUT -s 1.2.3.4 -j DROP
iptables -L | grep 1.2.3.4
Resolution Proposals:
docker_compatible
, insist on macvlan or bridge networkingDocker is able to be installed and run without any capabilities if using
macvlan
orbridge
interfaces and setting--setenv=SYSTEMD_SECCOMP=0
The text was updated successfully, but these errors were encountered: