Skip to content

Commit abe1eae

Browse files
szachovyCopilot
andcommitted
Enable Swarm overlay network encryption
Add data_path_port=4789 to swarm.init() and options={"encrypted": "true"} to overlay network creation. Enables IPsec ESP encryption for all inter-node container traffic on the superset-network overlay. Update SECURITY.md and ARCHITECTURE.md to document overlay encryption. Closes #92 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit abe1eae

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* Dependabot updates for `github-actions` and `terraform` ecosystems. (#29)
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
18+
* Swarm overlay network encryption via IPsec and explicit data path port. (#92)
1819

1920
### Changed
2021

docs/ARCHITECTURE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Redis and Superset run on the `superset-network` overlay network, which provides
133133

134134
* Service discovery: Superset connects to Redis using the hostname `redis`.
135135
* Port publishing: Swarm publishes port 443 on all Swarm nodes via VIP-based routing.
136+
* IPsec encryption: all inter-container traffic is encrypted at the network level (`encrypted: true`).
136137

137138
| Port | Protocol | Service | Scope |
138139
|------|----------|---------|-------|

docs/SECURITY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ sources.
116116
- Only port **443** (HTTPS) is intended to be exposed externally on the management nodes.
117117
- MySQL (port 3306) and MySQL Router (port 6446) communicate over the internal network only.
118118
- Redis (port 6379) is accessible only within the Docker Swarm overlay network (`superset-network`).
119+
- The `superset-network` overlay is created with `encrypted: true`, enabling IPsec ESP encryption for all
120+
inter-container traffic (Superset ↔ Redis). The Swarm data path uses port 4789 (VXLAN).
119121
- Gunicorn (port 8088) binds to `localhost` only, accessible exclusively through the Nginx reverse proxy.
120122
- IPv6 should be disabled or configured to be non-routable to prevent unintended network exposure.
121123
- DNS resolution between nodes is required for InnoDB Cluster group replication and SSH connectivity.

src/container.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,18 @@ def __init__(self, client: docker.client.DockerClient, virtual_ip_address: str)
384384
self.healthcheck_retries = 5
385385

386386
def initialize_swarm(self) -> None:
387-
self.client.swarm.init(advertise_addr=self.virtual_ip_address)
387+
self.client.swarm.init(
388+
advertise_addr=self.virtual_ip_address,
389+
data_path_port=4789
390+
)
388391

389392
def create_network(self) -> None:
390-
self.client.networks.create(name='superset-network', driver='overlay', attachable=True)
393+
self.client.networks.create(
394+
name='superset-network',
395+
driver='overlay',
396+
attachable=True,
397+
options={"encrypted": "true"}
398+
)
391399

392400
def run(self) -> None:
393401
self.initialize_swarm()

0 commit comments

Comments
 (0)