Skip to content

Commit a5071c9

Browse files
committed
docs: [#296] move network security docs from template to Rust module
The security documentation about three-network segmentation now lives in src/domain/topology/network.rs where the network logic is defined. The template now has a simple reference to the Rust module.
1 parent cee9de8 commit a5071c9

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

src/domain/topology/network.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,31 @@
44
//! used for service isolation. Each network serves a specific security purpose
55
//! in the deployment topology.
66
//!
7-
//! ## Network Purposes
7+
//! ## Security: Three-Network Segmentation (Defense in Depth)
88
//!
9-
//! | Network | Purpose | Connected Services |
10-
//! |---------|---------|-------------------|
11-
//! | `Database` | Isolates database access | Tracker ↔ `MySQL` |
12-
//! | `Metrics` | Metrics scraping | Tracker ↔ Prometheus |
13-
//! | `Visualization` | Dashboard queries | Prometheus ↔ Grafana |
14-
//! | `Proxy` | TLS termination | Caddy ↔ backend services |
9+
//! Network isolation prevents lateral movement between services and reduces attack surface.
10+
//! Each service is placed in the minimum networks required for its function.
11+
//!
12+
//! ### Network Topology
13+
//!
14+
//! | Network | Purpose | Connected Services | Security Boundary |
15+
//! |---------|---------|-------------------|-------------------|
16+
//! | `Database` | Isolates database access | Tracker ↔ `MySQL` | Only tracker can access database |
17+
//! | `Metrics` | Metrics scraping | Tracker ↔ Prometheus | Prometheus cannot access database |
18+
//! | `Visualization` | Dashboard queries | Prometheus ↔ Grafana | Grafana cannot access tracker directly |
19+
//! | `Proxy` | TLS termination | Caddy ↔ backend services | External traffic goes through Caddy |
20+
//!
21+
//! ### Security Benefits
22+
//!
23+
//! 1. **`MySQL` isolation**: Only tracker has database access (least privilege)
24+
//! 2. **Metrics isolation**: Grafana must query through Prometheus (no direct tracker access)
25+
//! 3. **Lateral movement prevention**: Compromised service cannot access unrelated services
26+
//! 4. **Defense in depth**: Network segmentation + authentication + Docker port bindings + UFW
27+
//!
28+
//! ### References
29+
//!
30+
//! - ADR: `docs/decisions/docker-ufw-firewall-security-strategy.md`
31+
//! - Analysis: `docs/analysis/security/docker-network-segmentation-analysis.md`
1532
//!
1633
//! ## Usage
1734
//!

templates/docker-compose/docker-compose.yml.tera

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -188,32 +188,8 @@ services:
188188
start_period: 30s
189189
{%- endif %}
190190

191-
# SECURITY: Three-Network Segmentation (Defense in Depth)
192-
# =========================================================
193-
# Network isolation prevents lateral movement between services and reduces attack surface.
194-
# Each service is placed in the minimum networks required for its function.
195-
#
196-
# Network Topology:
197-
# database_network: Tracker ↔ MySQL
198-
# - Only tracker can access MySQL (reduces attack vectors from 3 services to 1)
199-
# - Prometheus/Grafana cannot access database even if compromised
200-
#
201-
# metrics_network: Tracker ↔ Prometheus
202-
# - Prometheus scrapes metrics from tracker
203-
# - Grafana cannot directly access tracker metrics
204-
#
205-
# visualization_network: Prometheus ↔ Grafana
206-
# - Grafana queries Prometheus as data source
207-
# - Grafana cannot access tracker or MySQL directly
208-
#
209-
# Security Benefits:
210-
# 1. MySQL isolation: Only tracker has database access (least privilege)
211-
# 2. Metrics isolation: Grafana must query through Prometheus (no direct tracker access)
212-
# 3. Lateral movement prevention: Compromised service cannot access unrelated services
213-
# 4. Defense in depth: Network segmentation + authentication + Docker port bindings + UFW
214-
#
215-
# See ADR: docs/decisions/docker-ufw-firewall-security-strategy.md
216-
# See Analysis: docs/analysis/security/docker-network-segmentation-analysis.md
191+
# Networks are derived from service configurations in Rust code.
192+
# See: src/domain/topology/network.rs for security rationale.
217193
{%- if required_networks | length > 0 %}
218194

219195
networks:

0 commit comments

Comments
 (0)