Skip to content

libnetwork/d/overlay: support encryption on any port#45636

Merged
corhere merged 1 commit intomoby:masterfrom
corhere:libn/fix-encrypted-overlay-nonstandard-port
May 26, 2023
Merged

libnetwork/d/overlay: support encryption on any port#45636
corhere merged 1 commit intomoby:masterfrom
corhere:libn/fix-encrypted-overlay-nonstandard-port

Conversation

@corhere
Copy link
Copy Markdown
Contributor

@corhere corhere commented May 26, 2023

- What I did
While the VXLAN interface and the iptables rules to mark outgoing VXLAN packets for encryption are configured to use the Swarm data path port, the XFRM policies for actually applying the encryption are hardcoded to match packets with destination port 4789/udp. Consequently, encrypted overlay networks do not pass traffic when the Swarm is configured with any other data path port: encryption is not applied to the outgoing VXLAN packets and the destination host drops the received cleartext packets. Use the configured data path port instead of hardcoding port 4789 in the XFRM policies.

We are not considering this to be a security issue as affected overlay networks are functionally non-operational. The only traffic which would be visible on the host network in cleartext would be simplex transmissions (ICMP echo requests, DNS queries, TCP SYN, etc.) shouting into the void, which the addressed recipient would never receive and thus never reply to.

- How I did it
Trivially.

- How to verify it
Initialize a swarm with a --data-path-port other than 4789. Create an encrypted overlay network, run containers on different nodes attached to the network, and verify that the containers can communicate with each other.

Run tcpdump on one of the nodes with the filter udp port $DATA_PATH_PORT or esp and verify that only IPSec ESP traffic is observed when the aforementioned containers are communicating, and not any cleartext UDP traffic.

- Description for the changelog

  • Fix an issue which prevented encrypted overlay networks from functioning when the Swarm data path port is not set to 4789.

- A picture of a cute animal (not mandatory but encouraged)

While the VXLAN interface and the iptables rules to mark outgoing VXLAN
packets for encryption are configured to use the Swarm data path port,
the XFRM policies for actually applying the encryption are hardcoded to
match packets with destination port 4789/udp. Consequently, encrypted
overlay networks do not pass traffic when the Swarm is configured with
any other data path port: encryption is not applied to the outgoing
VXLAN packets and the destination host drops the received cleartext
packets. Use the configured data path port instead of hardcoding port
4789 in the XFRM policies.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah added this to the 25.0.0 milestone May 26, 2023
@corhere
Copy link
Copy Markdown
Contributor Author

corhere commented May 26, 2023

The CI failure is unrelated. It's a windows-2022+c8d integration test, and we don't support encrypted overlay networks on Windows.

=== FAIL: github.com/docker/docker/integration/build TestBuildWithRemoveAndForceRemove/successful_build_with_no_removal (2.90s)
    build_test.go:114: assertion failed: 2 (c.numberOfIntermediateContainers int) != 1 (int): Expected 2 remaining intermediate containers, got 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encrypted overlay networks don't work on ports other than 4789

3 participants