Description
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:
- User installs firewall in jail and enables it
- Program install firewall rules
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:
- Create jail
- Make jail docker compatible
- Apply any kind of firewall rules inside jail. ex.
iptables -A INPUT -s 1.2.3.4 -j DROP
- View rule on host
iptables -L | grep 1.2.3.4
Resolution Proposals:
- Only add the capabilities for docker to the jail and warn the user if using host networking that it can be destructive to host networking
- Do not allow host networking when using
docker_compatible
, insist on macvlan or bridge networking - No.2 and drop all capabilities for the jail as they should not be required
Docker is able to be installed and run without any capabilities if using macvlan
or bridge
interfaces and setting --setenv=SYSTEMD_SECCOMP=0