askbuy/guides/vpn-security
Last audited 05 Jun 2026·● live
▶ The question

best self-hosted 2fa for home labs

If you run a home lab, you've probably got a dozen services exposed behind a reverse proxy — and every single one of them is a potential entry point. The smartest thing you can do is layer on multi-factor authentication (MFA) that you control. Here are the best self-hosted 2FA solutions, from lightweight TOTP storage to full identity and access management suites.

Jump to →§ the picks§ how we ranked§ who should skip what§ sources§ ask follow-up
▲ How this page was builtangle_scoutauditedproduct_mining4 picks · 4 sourcespage_writergemma-4-31baudit_scorefreshrewrite_countv1
§ 01The picks

The picks

Pick
A
authentik
The most comprehensive self-hosted identity provider for home labs, with MFA, SSO, custom auth flows, and reverse proxy mode — the best all-in-one choice for serious setups.
/go/e4b26e94-84ab-419d-b7bb-ece013d059b5Check ↗
Pick
A
Authelia
A lightweight, high-performance 2FA gate that sits in front of your reverse proxy — ideal for small home labs that just want to add MFA with minimal overhead.
/go/0275b09e-38cb-44af-b570-9a85757c44eaCheck ↗
Pick
K
Keycloak
The enterprise-grade IAM standard from Red Hat — best for home labbers who want to learn professional-grade SSO and MFA with full protocol support.
/go/40777d7b-4521-4f4c-ab19-a1d4462db150Check ↗
Pick
2
2FAuth
A dead-simple self-hosted TOTP code vault that replaces Google Authenticator — perfect if you just want to host your own 2FA codes without any complexity.
/go/30b3f412-1d3c-4cb6-962a-1a2200697a53Check ↗
§ 02Why this list

Why
this list

If you run a home lab Plex, Grafana, Home Assistant, a NAS, whatever you've probably got a dozen web UIs exposed behind a reverse proxy. Each one is a potential entry point. The smartest thing you can do is layer on multi-factor authentication (MFA) that you control, not a third-party cloud service.

Self-hosting your 2FA means no vendor lock-in, no per-seat licensing, and full control over your authentication data. Here's a breakdown of the best options, from a simple code vault to a full enterprise identity provider.

the contenders

1. authentik the all-in-one identity powerhouse

authentik is the most comprehensive self-hosted identity provider you can run today. It handles MFA, single sign-on (SSO), user provisioning, and even acts as a reverse proxy for legacy apps that don't support auth natively.1

It supports TOTP, WebAuthn (passkeys), SMS, email codes, and DUO push. You can build custom authentication flows with a visual builder think "if the user is on the LAN, skip MFA; if they're external, require WebAuthn." It integrates with LDAP, OAuth2, SAML, and SCIM, so it plays nicely with everything from Nextcloud to GitLab.

The trade-off: it's resource-hungry. You'll want at least 2 GB of RAM and a decent CPU. Setup is Docker Compose with a few YAML files, but the learning curve is real.

Best for: Home labs with multiple users, many services, and a need for granular access policies.

2. authelia lightweight proxy guardian

Authelia is the lightweight alternative. It sits in front of your reverse proxy (Caddy, Nginx, Traefik) and intercepts unauthenticated requests, presenting a login portal with 2FA before traffic reaches your apps.2

It supports TOTP, WebAuthn, DUO push, and one-time backup codes. Configuration is a single YAML file, and it runs comfortably on a Raspberry Pi 4 with 512 MB of RAM. Integration is dead simple add a few lines to your reverse proxy config and you're done.

What it doesn't do: SSO across apps (no OAuth/SAML provider), no user directory beyond a simple file or LDAP backend, and no visual flow builder. It's a gatekeeper, not an identity platform.

Best for: Small home labs where you just want to put a 2FA wall in front of everything with minimal overhead.

3. keycloak the enterprise standard

Keycloak is the industry-standard open-source IAM solution, backed by Red Hat. It's used by Fortune 500 companies, and it's free.3

It supports OAuth2, OpenID Connect, SAML, LDAP, and a full suite of MFA methods including TOTP, WebAuthn, and conditional policies. The admin console is polished, and it integrates with virtually any application that supports standard auth protocols.

The catch: it's Java-based, which means it's heavy (24 GB RAM recommended), and the setup is more involved than Authelia or even authentik. It's overkill if you just want to protect three Docker containers.

Best for: Learning enterprise-grade IAM at home, or labs that need real SSO across many standards-compliant apps.

4. 2FAuth simple TOTP code storage

2FAuth does one thing and does it well: it stores your TOTP secrets in a self-hosted web app so you don't need Google Authenticator or Authy on your phone.4

It supports TOTP and HOTP codes, has a clean mobile-friendly UI, and can generate QR codes for easy setup. It runs in a single Docker container with SQLite and uses practically no resources 128 MB RAM is plenty.

It does not do SSO, proxy authentication, or user management beyond a single admin account. It's a personal 2FA code vault, not an identity provider.

Best for: Anyone who wants to ditch cloud-based authenticator apps and host their own TOTP codes with zero complexity.

side-by-side comparison

DimensionauthentikAutheliaKeycloak2FAuth
RAM usage~2 GB~256 MB~24 GB~128 MB
Setup complexityModerateSimpleComplexVery simple
Primary use caseFull IAM + SSOProxy 2FA gateEnterprise SSOTOTP code vault

which one should you pick?

  • Tiny lab, single user, just want 2FA on everything? Go with Authelia. It's the fastest path from zero to protected.
  • Multiple services, multiple users, want SSO and fine-grained policies? authentik is worth the setup time. It's the sweet spot for serious home labs.
  • Learning IAM for work or studying for certifications? Run Keycloak. The skills transfer directly to enterprise environments.
  • Don't need a proxy gate just want to host your own TOTP codes? 2FAuth is perfect. It replaces Google Authenticator with something you control.

Disclosure: Some links on this page are affiliate links. We only recommend tools we'd use ourselves, and using these links helps support the site.

§ 03Who should skip what

Who should skip what

Skip authentik if…
The most comprehensive self-hosted identity provider for home labs, with MFA, SSO, custom auth flows, and reverse proxy mode — the best all-in-one choice for serious setups.
→ consider Authelia
Skip Authelia if…
A lightweight, high-performance 2FA gate that sits in front of your reverse proxy — ideal for small home labs that just want to add MFA with minimal overhead.
→ consider Keycloak
Skip Keycloak if…
The enterprise-grade IAM standard from Red Hat — best for home labbers who want to learn professional-grade SSO and MFA with full protocol support.
→ consider 2FAuth
§ 05keep going

Got a follow-up?

This page was written by the engine and the engine is still on the line. The conversation below picks up where the article stops.

▶ Live conversation · context loaded
Does the engine have anything to add to “best self-hosted 2fa for home labs”?
askbuy~1s · cited every claim

Yes — the picks above are the engine's current verdicts. Ask a sharper version of this question below and you'll get a custom answer with the latest pricing.

▸ Or try one of these
⌘↵
§ 04Sources · 4

Sources
· 4

1
authentik Official Site
open ↗
2
Authelia Official Site
open ↗
3
Keycloak Official Site
open ↗
4
2FAuth GitHub
open ↗
ⓘ links above are tracked through /go/<id> · we earn a commission, price unchanged for youhow askbuy makes money →
best self-hosted 2fa for home labs (2025)