The only thing that can get hacked is something that responds on the World Wide Web.
So you limit the scope of what talks to the WWW:
Wireguard VPN will not respond unless the magic keys are correct, it’s ideal security and obscurity. Put everything you can behind it.
For things I want on the WWW without a VPN, I split out two options otherwise.
-
Caddy checking mTLS certificates that basically allows a device access without extra steps - relying on Caddy to be strong and mTLS to be strong.
-
Authentik’s proxy check, I think Authelia has this too, but to access a site you hit an Authentik login first.
For both of those, you rely on those services not having 0-day hacks. More likely for these services to stay ahead of the game and/or fix quick than something that doesn’t exist just to do authentication. I run them in containers that are run by independent users and are read-only with capabilities limited, in a VM.
I’d say the Caddy route is more secure than Authentik, but it needs more effort to setup the certificate stuff. Authentik route needs a web browser to log in with. Obviously the WG VPN is primo.