Skip to content

[24.0 backport] libnetwork/d/overlay: support encryption on any port#45637

Merged
thaJeztah merged 1 commit intomoby:24.0from
corhere:backport-24.0/libn/fix-encrypted-overlay-nonstandard-port
May 26, 2023
Merged

[24.0 backport] libnetwork/d/overlay: support encryption on any port#45637
thaJeztah merged 1 commit intomoby:24.0from
corhere:backport-24.0/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>
(cherry picked from commit 9a692a3)
Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere corhere added area/networking Networking kind/bugfix PR's that fix bugs area/networking/d/overlay Networking labels May 26, 2023
@corhere corhere added this to the 24.0.3 milestone May 26, 2023
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 merged commit 0a59892 into moby:24.0 May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/networking/d/overlay Networking area/networking Networking kind/bugfix PR's that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants