Skip to content

Jail capabilities for docker are dangerous for host networking #119

Closed
@templehasfallen

Description

@templehasfallen

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:

  1. Create jail
  2. Make jail docker compatible
  3. Apply any kind of firewall rules inside jail. ex. iptables -A INPUT -s 1.2.3.4 -j DROP
  4. View rule on host iptables -L | grep 1.2.3.4

Resolution Proposals:

  1. 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
  2. Do not allow host networking when using docker_compatible, insist on macvlan or bridge networking
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions