Commit 8323def
committed
fix: [#246] remove Prometheus port exposure for security
**Security Issue**: Prometheus port 9090 was exposed to external network due to
Docker bypassing UFW firewall rules when using 0.0.0.0:9090:9090 binding.
**Root Cause**: Docker manipulates iptables directly, taking precedence over UFW
rules. Even with UFW default policy 'deny incoming', Docker port bindings bypass
this protection.
**Solution**: Remove port mapping entirely for Prometheus service. Grafana can
still access Prometheus via Docker internal network (http://prometheus:9090).
**Changes**:
- Remove 'ports: - "9090:9090"' from Prometheus service in docker-compose.yml.tera
- Add comment explaining Prometheus is internal-only
- Update test to verify port is NOT exposed (security expectation)
- Grafana continues to work via Docker network communication
**Security Impact**:
- Before: Prometheus UI accessible at http://<vm-ip>:9090 (exposed)
- After: Prometheus UI NOT accessible externally (internal-only)
- Grafana access: Unchanged (uses Docker network)
**Verification**:
- All 1555 unit tests passing
- UFW firewall correctly denies incoming by default
- Only SSH, Tracker, and Grafana ports should be accessible
This issue existed since Prometheus slice implementation but was not detected
until Grafana integration testing revealed the exposure.1 parent 696fc0d commit 8323def
File tree
2 files changed
+6
-5
lines changed- src/infrastructure/templating/docker_compose/template/renderer
- templates/docker-compose
2 files changed
+6
-5
lines changedLines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | | - | |
391 | | - | |
| 390 | + | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
0 commit comments