I think mTLS is probably overkill here.
For a few unmanaged phones using native apps, you would be adding a second PKI lifecycle on top of the normal application credentials: issuing per-device keys, securely importing them into iOS/Android, handling app-specific certificate selection, expiry, replacement, revocation after loss/reset, and explaining all of that to the users. It works — but it is a lot of machinery for a small private setup.
A WireGuard-style overlay network seems like the more practical solution. WireGuard directly, Tailscale, Headscale, NetBird, or similar would let you make Immich and CalDAV/CardDAV private-only services. Then a new public-facing exploit in one of those services is much less likely to become an immediate “drop everything and patch it right now” event, because there is no publicly reachable login or API endpoint in the first place.
The Matrix part needs one important clarification, though: do you want federation with other Matrix homeservers?
If yes, Matrix cannot simply be made private in the same way. Other homeservers need to reach the federation API; by default that is port 8448, although Matrix delegation can direct federation to another host/port. Matrix clients and federation traffic can also be separated: clients normally use 443, while server-to-server federation defaults to 8448.
So I would split it roughly like this:
- Immich: private overlay/VPN only.
- CalDAV/CardDAV: private overlay/VPN only.
- Matrix, no federation: private overlay/VPN only.
- Matrix, federated: expose only the minimal, dedicated federation endpoint publicly; keep admin interfaces and anything else private. Client access could still be via the overlay, but that has UX implications for mobile push/background connectivity.
mTLS is a reasonable choice when a service must remain publicly reachable but should accept requests only from a tightly controlled set of devices. In your case, putting the services behind a private network seems both simpler and more effective at reducing exposed attack surface.
Also, “I can distribute keystores manually” is exactly the point where this tends to look easy — right up to the first lost phone, OS reset, certificate expiry, or app that suddenly stops offering the certificate picker because mobile ecosystems enjoy making infrastructure administration a lifestyle choice.
observantTrapezium@lemmy.ca
@observantTrapezium
I just saw your other reply on Lemmy regarding Headscale.
Headscale should already solve that use case without putting mTLS in front of every service.
By default, a Headscale tailnet is rather permissive, but you can load a policy and use Grants (or ACLs, though Grants are the preferred direction) to explicitly allow only the connections you want. A phone does not need access to “the whole tailnet” just because it is enrolled.
For example, each user/device group could be allowed to reach only:
…and nothing else. No SSH, no databases, no admin UIs, no access to other tailnet nodes. Start with an empty
grantspolicy — which denies all tailnet traffic — then add narrowly scoped allow rules for the relevant source devices and service destinations.That also means the client can simply connect when it needs those services; it does not need broad, permanent network access merely because the Headscale app is installed. And if a device is lost, removing that node from Headscale cuts off its network access immediately.
So I would still favour: private services behind Headscale plus a deny-by-default policy, instead of managing a separate mTLS PKI for several native mobile apps. The latter is viable, but it is solving device/network admission at the application TLS layer when you already operate a tool designed to do it at the network layer. Headscale explicitly supports access control policies for restricting traffic between nodes, and policies can deny all traffic by default until specific access is granted.
Ah, interesting. Looks like using grants does resemble what I envision and probably easier to set up that mTLS. I’ll certainly explore that!
@observantTrapezium
Sounds promising — have fun testing it 😆