Give each app its own docker network, with caddy as the only hub #38
Labels
No labels
area/backups
area/ci
area/containers
area/mail
area/minecraft
area/network
area/observability
area/tls
area/tofu
kind
bug
kind
chore
kind
feature
kind
investigation
kind
security
priority
high
priority
low
priority
medium
status/blocked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
hutao/vps#38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every web-facing container shares one docker network,
proxy(infra.proxyNetwork): forgejo, dozzle, cloudflared, caddy, kuma, mailserver, searxng, navidrome, webmail and pages-hook. Docker lets every member reach every other member's ports by name, so a compromised app is one hop from all the others' internal listeners.Why it matters
Several controls in this repo exist only at caddy:
blockedPaths): forgejo's/adminand/api/v1/admin/*, kuma's/socket.io/basic_authin front of searxngA container on
proxytalks toforgejo:3000,kuma:3001and the rest directly, so none of those apply to it; each app's own login is all that remains. The ten members include five that face the internet. Splitting the box across machines would contain this too, but costs far more than splitting the network.Proposal
One network per app, with caddy joined to all of them as the only hub. In
modules/containers/default.nix,networksbecomes one entry per app (net-forgejo,net-navidrome, …), and the per-container ordering is already derived from that attrset, so a container joining two networks keeps its dependency on both units.The edges that are not caddy -> app, and have to survive:
mailserver:4190(mailserver.nix). IMAP and SMTP go to the public name and do not depend on the network. Put both on onenet-mail.FORGEJO__webhook__ALLOWED_HOST_LIST). pages-hook joinsnet-forgejo.Check before and after
docker network inspectper network: caddy plus the app (plus the pairs above), nothing else.Related, separate: the input chain's
iifname "br-*"rule admits every non-bot container to the host's 3000/8384/8443. Once caddy has its own fixed address, that rule can match caddy alone.