Security Hardening

← Back to Index


Overview

Security audit identified critical vulnerabilities in Docker configurations. The following hardening was applied to reduce container escape and privilege escalation risks.

Date: 2026-02-03


Changes Applied

ServiceIssueFix
cAdvisorprivileged: true grants full host accessReplaced with cap_add: SYS_PTRACE + security_opt: no-new-privileges:true
GrafanaDefault password fallback :-adminRemoved fallback - requires explicit GRAFANA_PASSWORD in .env
Uptime KumaDocker socket without read-onlyAdded :ro flag to /var/run/docker.sock mount
DockhandDocker socket without read-onlyAdded :ro flag to /var/run/docker.sock mount

Why These Matter

Docker Socket Exposure (/var/run/docker.sock)

  • Full Docker API access = root equivalent on host
  • Can spawn privileged containers, read all secrets
  • Mitigation: :ro flag limits to read-only operations

Privileged Mode (privileged: true)

  • Disables all container isolation
  • Full access to host devices, kernel capabilities
  • Mitigation: Use specific capabilities instead (SYS_PTRACE for process metrics)

Default Credentials

  • Fallback passwords create security holes if .env is misconfigured
  • Mitigation: Remove fallbacks, fail explicitly if not configured

Additional Security Improvements (2026-02-04)

ServiceIssueFix
cAdvisor/dev/kmsg device mountRemoved (not essential, causes startup errors)
Minecraft-ServerOver-allocated JVM heap (6G)Reduced to 4G for better resource sharing

Remaining Recommendations (Future)

PriorityItem
HIGHPin container images to specific versions (currently using :latest)
MEDIUMAdd memory/CPU limits to all services - ✅ COMPLETED 2026-02-04
MEDIUMAdd health checks to critical services
LOWAdd security_opt: no-new-privileges:true to all containers
LOWCreate isolated Docker networks for service tiers

Commit References

  • Security hardening: d403912 - Fix critical container vulnerabilities (2026-02-03)
  • Container resources: e266a08, e301826 - Memory limits across all services (2026-02-04)

Security+ Tie-ins

These changes demonstrate:

  • Least Privilege (SYS_PTRACE instead of privileged mode)
  • Defense in Depth (read-only mounts + no default passwords)
  • Attack Surface Reduction (removed unnecessary device mounts)
  • Resource Controls (memory limits prevent DoS via resource exhaustion)