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

Shouldn't be fatal: Unable to disable IPv6 router advertisement: open /proc/sys/net/ipv6/conf/docker0/accept_ra: read-only file system #1033

Closed
2 of 3 tasks
poige opened this issue Jun 4, 2020 · 10 comments · Fixed by moby/moby#41189

Comments

@poige
Copy link

poige commented Jun 4, 2020

  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

Proceed start

Actual behavior

Aborted start

Steps to reproduce the behavior

I ran Docker in systemd-nspawn "machine" — in particular to avoid cluttering of the netfilter's rule set. Generally it worked until recent update.
Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.11
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        42e35e61f3
 Built:             Mon Jun  1 09:12:22 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Output of docker info:
— not applicable, since system service is down

The whole error message:

dockerd[…]: failed to start daemon: Error initializing network controller: Error creating default "bridge" network: libnetwork: Unable to disable IPv6 router advertisement: open /proc/sys/net/ipv6/conf/docker0/accept_ra: read-only file system

@Motophan
Copy link

Motophan commented Jun 5, 2020

#1026 appears to be related

@poige
Copy link
Author

poige commented Jun 5, 2020

#1026 appears to be related

O_o

Very remotely, because the thing I'm talking about is pretty different in nutshell — recent changes(?) broke ability to start-up Docker's daemon in IPv4 environment. There're no configuration's requests for Docker to run with IPv6 mode enabled.

It started failing only recently and (I repeat) the environment is IPv4 based.

Also when I entered that network namespace manually from the host system and flipped accept_ra to 0 it didn't fix broken Docker's start because its code seems to try (un)setting this knob anyways, treating the failure to do so as a fatal one.

I don't see the point treating it that hard — what's wrong if even accept_ra is 1, how does it hurt Docker at all?

@poige
Copy link
Author

poige commented Jun 5, 2020

Downgrading to docker-ce=5:19.03.10~3-0~ubuntu-bionic resolves the issue, proving it's of a recent change.

@thaJeztah
Copy link
Member

Looks related to a CVE that was addressed in 19.03.11; https://docs.docker.com/engine/release-notes/#190311

Disable IPv6 Router Advertisements to prevent address spoofing. CVE-2020-13401

Description

In the Docker default configuration, the container network interface is a virtual ethernet link going to the host (veth interface).
In this configuration, an attacker able to run a process as root in a container can send and receive arbitrary packets to the host using the CAP_NET_RAW capability (present in the default configuration).

If IPv6 is not totally disabled on the host (via ipv6.disable=1 on the kernel cmdline), it will be either unconfigured or configured on some interfaces, but it’s pretty likely that ipv6 forwarding is disabled, that is, /proc/sys/net/ipv6/conf//forwarding == 0. Also by default, /proc/sys/net/ipv6/conf//accept_ra == 1. The combination of these 2 sysctls means that the host accepts router advertisements and configures the IPv6 stack using them.

By sending “rogue” router advertisements from a container, an attacker can reconfigure the host to redirect part or all of the IPv6 traffic of the host to the attacker-controlled container.

Even if there was no IPv6 traffic before, if the DNS returns A (IPv4) and AAAA (IPv6) records, many HTTP libraries will try to connect via IPv6 first then fallback to IPv4, giving an opportunity to the attacker to respond.
If by chance the host has a vulnerability like last year’s RCE in apt (CVE-2019-3462), the attacker can now escalate to the host.

As CAP_NET_ADMIN is not present by default for Docker containers, the attacker can’t configure the IPs they want to MitM, they can’t use iptables to NAT or REDIRECT the traffic, and they can’t use IP_TRANSPARENT.
The attacker can however still use CAP_NET_RAW and implement a tcp/ip stack in user space.

See kubernetes/kubernetes#91507 for related issues.

@justincormack @arkodg

@justincormack
Copy link
Member

justincormack commented Jun 5, 2020

yes we should not fail if this file does not exist or is read only cc @arkodg @samuelkarp I think its fine to ignore any failures.

@thaJeztah
Copy link
Member

Opened moby/libnetwork#2563

@poige
Copy link
Author

poige commented Jun 5, 2020

Looks related to a CVE that was addressed in 19.03.11

It might be true, the q-n is only why anyone thought it's the Docker's issue?
The same kind of attack is quite possible with bridged KVMs as well, right?
So what now, should QEMU-KVM devs go and shutdown IPv6 completely as well?
I don't think so, it sounds pretty much absurd, as to me.

@tiborvass
Copy link
Contributor

@poige would you be able to test if things are fixed for you by running make on moby/moby#41124 and replacing (dont forget backup) your dockerd binary with ./bundles/binary-daemon/dockerd-dev ?

@poige
Copy link
Author

poige commented Jun 18, 2020

would you be able to test

I will try at least.

@thaJeztah
Copy link
Member

Packages for docker 19.03.12 should now be up on download.docker.com, and contain a fix for this. I'll go ahead and close this issue, but feel free to comment if the issue still persists

thaJeztah added a commit to thaJeztah/docker that referenced this issue Jul 8, 2020
full diff: moby/libnetwork@2e24aed...9e99af2

- moby/libnetwork#2548 Add docker interfaces to firewalld docker zone
    - fixes docker/for-linux#957 DNS Not Resolving under Network [CentOS8]
    - fixes moby/libnetwork#2496 Port Forwarding does not work on RHEL 8 with Firewalld running with FirewallBackend=nftables
- store.getNetworksFromStore() remove unused error return
- moby/libnetwork#2554 Fix 'failed to get network during CreateEndpoint'
    - fixes/addresses docker/for-linux#888 failed to get network during CreateEndpoint
- moby/libnetwork#2558 [master] bridge: disable IPv6 router advertisements
- moby/libnetwork#2563 log error instead if disabling IPv6 router advertisement failed
    - fixes docker/for-linux#1033 Shouldn't be fatal: Unable to disable IPv6 router advertisement: open /proc/sys/net/ipv6/conf/docker0/accept_ra: read-only file system

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this issue Jul 13, 2020
full diff: moby/libnetwork@2e24aed...9e99af2

- moby/libnetwork#2548 Add docker interfaces to firewalld docker zone
    - fixes docker/for-linux#957 DNS Not Resolving under Network [CentOS8]
    - fixes moby/libnetwork#2496 Port Forwarding does not work on RHEL 8 with Firewalld running with FirewallBackend=nftables
- store.getNetworksFromStore() remove unused error return
- moby/libnetwork#2554 Fix 'failed to get network during CreateEndpoint'
    - fixes/addresses docker/for-linux#888 failed to get network during CreateEndpoint
- moby/libnetwork#2558 [master] bridge: disable IPv6 router advertisements
- moby/libnetwork#2563 log error instead if disabling IPv6 router advertisement failed
    - fixes docker/for-linux#1033 Shouldn't be fatal: Unable to disable IPv6 router advertisement: open /proc/sys/net/ipv6/conf/docker0/accept_ra: read-only file system

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 219e7e7ddcf5f0314578d2a517fc0832f03622c1
Component: engine
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 a pull request may close this issue.

5 participants