Cómo instalar Authentik en Docker - SSO/IdP moderna autohospedada

Authentik | SSO | IdP | SAML | OAuth2 | OIDC | LDAP | RADIUS | Docker | Self-Hosted | Okta Alternative | 24.7k stars

Authentik en Docker: Identity Provider (IdP) moderna autohospedada con SSO (SAML, OAuth2, OIDC, LDAP, RADIUS), reemplazo Okta/Auth0/Entra/Ping, reverse proxy integrado, multi-tenant, blueprints, flows, autenticación flexible, auditing, 24.7k stars, MIT open source, Kubernetes ready, production-scale 🔐🆔

Authentik es un Identity Provider (IdP) open source moderno para SSO (Single Sign-On) autohospedado. Reemplazo profesional Okta, Auth0, Entra ID, Ping Identity. Soporta SAML, OAuth2/OIDC, LDAP, RADIUS. Reverse proxy integrado (proxy outpost). Multi-tenant architecture. Blueprints (automation). Flows (auth logic). Access policies. Auditing completo. Scalable Docker + Kubernetes. 24.7k GitHub stars. MIT open source. Enterprise edition disponible. Production-ready.

¿Qué es Authentik en Docker?

Authentik es un Identity Provider (IdP) open source moderno que proporciona SSO (Single Sign-On) profesional autohospedado compatible SAML, OAuth2/OIDC, LDAP, RADIUS, con arquitectura multi-tenant, flows visuales para lógica autenticación, access policies, blueprints (automations), reverse proxy integrado (outpost), auditing completo, escalable Docker/Kubernetes, todo bajo tu control sin vendor lock-in. El reemplazo Okta/Auth0/Entra que pedías para autohospedado.

Propuesta clave: Open-source IdP self-hosted. Replace Okta, Auth0, Entra ID, Ping Identity. SAML 2.0 protocol (enterprise). OAuth2/OIDC (modern). LDAP directory sync. RADIUS server. Multi-protocol single source-of-truth. Reverse proxy outpost (proxy any app via authentik). Multi-tenant (multiple organizations). Visual flow editor (drag-drop auth logic). Access policies (conditional auth, MFA, risk-based). Blueprints (automation, bulk config). User management (local + directory sync). Group management. Applications directory (pre-configured integrations). Social login (GitHub, Google, Apple, Discord, etc). MFA support (TOTP, backup codes, WebAuthn). Password policy. Session management. Audit logging (all events tracked). API REST + webhooks. Rate limiting. RBAC. Kubernetes-native. Docker Compose + Helm chart. PostgreSQL backend. Redis for caching/sessions. Enterprise edition (features avanzadas). 24.7k stars. Active development. 23.6k commits. MIT licensed (core) + commercial support available.

Para homelabs + empresas: SSO profesional self-hosted. Multi-protocolo. Escalable. Zero vendor lock-in. Self-managed.

Características principales

Multi-protocolo SSO

SAML 2.0, OAuth2, OIDC, LDAP, RADIUS. Un IdP para todo.

Reverse proxy integrado

Outpost proxy. Protege cualquier app legacy. Sin cambios código.

Multi-tenant

Múltiples organizations en instalación. Branding customizable.

Visual flow editor

Drag-drop auth logic. Conditional, MFA, risk-based. No código.

Access policies

Conditional auth. Geo-blocking. Device trust. MFA enforcement.

Blueprints

Automation, bulk config, IaC. YAML-based deployment.

Directory sync

LDAP, Active Directory, Google Workspace sync. Users + groups.

Social login

GitHub, Google, Apple, Discord, OIDC providers custom.

MFA + WebAuthn

TOTP, backup codes, WebAuthn (FIDO2). Security modern.

Audit logging

Todos events tracked. User actions, auth, policy changes.

App library

500+ pre-configured app integrations. Instant SSO setup.

Kubernetes-native

Helm chart oficial. Scalable. Cloud-ready. Production.

Requisitos del sistema

  • Docker & Docker Compose v2+
  • 2 GB - 4 GB RAM mínimo (Python + Go app)
  • 10 GB - 50+ GB espacio disco (según users, audit logs)
  • Puerto TCP: 9000 (web UI), 9300 (LDAP outpost), 9400 (RADIUS outpost)
  • PostgreSQL 14+ (bundled o externo)
  • Redis (sessions, caching, optional pero recomendado)
  • Python 3.11+ (bundled en imagen)
  • Go 1.20+ (outpost proxy, bundled)
  • Opcional: LDAP/AD servidor para directory sync
  • Opcional: External PostgreSQL (para HA production)
Compute requirements: Authentik requiere bastante recursos (Python backend + Go outpost). 2GB RAM mínimo pero 4GB recomendado. Audit logging puede llenar disco rápido, plan retencion.
HA/Production: Para producción usar external PostgreSQL (replicación), Redis externo, múltiples replicas. Kubernetes + Helm recomendado para escala.

Instalación con Docker Compose

Paso 1: docker-compose.yml

version: '3.8' services: authentik_postgres: image: postgres:16-alpine container_name: authentik-postgres restart: unless-stopped environment: - POSTGRES_DB=authentik - POSTGRES_USER=authentik - POSTGRES_PASSWORD=changeme123 healthcheck: test: ["CMD-SHELL", "pg_isready -U authentik"] interval: 10s timeout: 5s retries: 5 volumes: - authentik_postgres:/var/lib/postgresql/data authentik_redis: image: redis:8-alpine container_name: authentik-redis restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 3s retries: 5 volumes: - authentik_redis:/data authentik_server: image: ghcr.io/goauthentik/server:latest container_name: authentik-server restart: unless-stopped environment: - AUTHENTIK_POSTGRESQL__HOST=authentik_postgres - AUTHENTIK_POSTGRESQL__NAME=authentik - AUTHENTIK_POSTGRESQL__USER=authentik - AUTHENTIK_POSTGRESQL__PASSWORD=changeme123 - AUTHENTIK_REDIS__HOST=authentik_redis - AUTHENTIK_SECRET_KEY=$(openssl rand -hex 32) ports: - "9000:9000" depends_on: authentik_postgres: condition: service_healthy authentik_redis: condition: service_healthy command: server authentik_worker: image: ghcr.io/goauthentik/server:latest container_name: authentik-worker restart: unless-stopped environment: - AUTHENTIK_POSTGRESQL__HOST=authentik_postgres - AUTHENTIK_POSTGRESQL__NAME=authentik - AUTHENTIK_POSTGRESQL__USER=authentik - AUTHENTIK_POSTGRESQL__PASSWORD=changeme123 - AUTHENTIK_REDIS__HOST=authentik_redis - AUTHENTIK_SECRET_KEY=$(openssl rand -hex 32) depends_on: authentik_postgres: condition: service_healthy authentik_redis: condition: service_healthy command: worker volumes: authentik_postgres: authentik_redis:

Paso 2: Generar SECRET_KEY

# Generar secret aleatorio openssl rand -hex 32 # Copiar y reemplazar AUTHENTIK_SECRET_KEY en compose

Paso 3: Iniciar Authentik

# Guardar como docker-compose.yml docker compose up -d # Espera ~20 segundos para migrations docker compose logs -f authentik_server # Debería ver "Starting application server" cuando listo

Acceder a Authentik

🔐 Authentik Admin UI: http://localhost:9000
🆔 Authentik Login: http://localhost:9000/auth/login/

Setup inicial (primer acceso)

  1. Abre http://localhost:9000
  2. Setup wizard automático → crea admin user
  3. Ingresa email + password admin
  4. Dashboard admin aparece
  5. Configura LDAP sync (opcional), social logins, apps
  6. ¡Listo SSO!
💡 Desde otros dispositivos: Usa la IP de tu servidor:
http://192.168.1.100:9000
Para obtener tu IP: hostname -I

Primeros pasos

1. Admin login

  1. Abre http://localhost:9000
  2. Click "Administration" → login con admin credentials
  3. Dashboard admin abre

2. Crear usuarios

  1. Admin → Users → Create user
  2. Ingresa username, email, password
  3. Asigna groups si necesario
  4. Save → usuario puede loguear

3. Setup app SAML/OAuth2

  1. Admin → Applications → Create application
  2. Nombre app, selecciona provider (SAML, OAuth2, OIDC)
  3. Configure redirect URIs (app callback URL)
  4. Client ID/Secret generado automático
  5. App lista para SSO

4. Setup reverse proxy outpost

  1. Admin → Infrastructure → Outposts → Create
  2. Type: Proxy outpost
  3. Configure forwarding (app interno, auth realm)
  4. Outpost auto-configura reverse proxy
  5. Acceso app protegido Authentik

5. Setup LDAP directory sync (opcional)

  1. Admin → Directory Sync → LDAP
  2. Configure LDAP server connection
  3. Map usuario + groups
  4. Enable sync → auto-sync usuarios

6. Setup social login (opcional)

  1. Admin → Sources → Create
  2. Type: GitHub, Google, etc
  3. Configure OAuth app credentials
  4. Users pueden loguear via social

7. Crear flow personalizado (avanzado)

  1. Admin → Flows & Stages → Create Flow
  2. Drag-drop stages (login form, MFA, policy check)
  3. Lógica autenticación customizable
  4. Asigna a applications/providers

Casos de uso

  • Reemplazo Okta/Auth0: SSO enterprise self-hosted. Multi-protocolo. No vendor lock-in.
  • Proteger apps legacy: Reverse proxy outpost. Agrega SSO sin cambios código.
  • Homelabs multi-usuario: Gestión usuarios + SSO. Apps protegidas.
  • LDAP/AD integration: Sync usuarios Active Directory. Access control integrado.
  • Multi-tenant SaaS: Blueprints. Organizations separadas. Branding custom.
  • Zero-trust security: Access policies condicionales. Risk-based auth. MFA.

Protocolos soportados

SAML 2.0

Enterprise standard. IdP-initiated, SP-initiated. Assertions encriptadas. Ideal legacy apps, Salesforce, Microsoft apps.

OAuth2 + OIDC

Modern standard. Authorization Code, Implicit, Client Credentials. ID token (OIDC). Bearer token. Web apps, SPA, mobile.

LDAP

Directory protocol. LDAP server functionality. Autenticación contra Authentik. No solo sync.

RADIUS

Network auth. VPN, wireless networks. RADIUS server Authentik.

Social/OIDC providers

GitHub, Google, Apple, Discord, generic OIDC. Social login integrado.

Gestión y mantenimiento

Ver estado

docker compose ps

Ver logs

docker compose logs -f authentik_server docker compose logs -f authentik_worker

Detener Authentik

docker compose down

Actualizar versión

docker compose pull docker compose up -d

Backup database

docker compose exec authentik_postgres pg_dump -U authentik authentik > backup.sql

Restore database

docker compose exec -T authentik_postgres psql -U authentik authentik < backup.sql

Monitorear consumo

docker stats authentik_server authentik_worker authentik_postgres authentik_redis # Típicamente: # server: 400-800MB RAM # worker: 300-600MB RAM # postgres: 300-500MB RAM

Stack técnico

  • Backend: Python 3.11 (Django + DRF)
  • Frontend: TypeScript + Lit Web Components
  • Outpost proxy: Go (high performance)
  • Database: PostgreSQL 14+
  • Cache/Sessions: Redis
  • Protocols: SAML 2.0, OAuth2, OIDC, LDAP, RADIUS
  • API: REST + GraphQL (enterprise)
  • Deployment: Docker Compose, Kubernetes (Helm), AWS CloudFormation
  • Licencia: MIT (core) + Enterprise edition

Comparativa con alternativas

vs Okta (cloud)

Authentik gana: Self-hosted, open source, mucho más barato, full control. Okta gana: Managed service, UI pulida, features premium, support 24/7.

vs Keycloak

Authentik gana: Mejor UX, reverse proxy integrado (outpost), flows visuales más intuitivos. Keycloak gana: Más maduro, comunidad más grande, más configuración.

vs Supabase Auth

Authentik gana: Multi-protocolo, LDAP/AD, más features enterprise. Supabase gana: Más simple para pequeños proyectos.

Mejor para: Empresas. Multi-protocolo SSO. LDAP/AD existente. Proteger apps legacy. Self-hosted. Zero vendor lock-in.

Comentarios

Entradas populares de este blog

Cómo Instalar y configurar SERVIDOR VPN WIREGUARD en MIKROTIK 🔐 #VPN #Wireguard #Mikrotik #RouterOS

Cómo instalar y configurar DSM SYNOLOGY 7.2.2 en PC | Guía completa, instalación, RAID 1, SMB

Cómo INSTALAR y CONFIGURAR OpenVPN en MIKROTIK. Guía completa paso a paso.