Successfully deployed Authentik identity provider with LDAP and RADIUS outposts on NixOS LXC container using the authentik-nix flake module and SOPS for secret management.
- Authentik Core: Running on port 9000 with web UI
- PostgreSQL: Database backend for Authentik
- Redis: Caching and session backend (port 6379)
- Authentik LDAP Outpost: Ready for LDAP authentication
- Authentik RADIUS Outpost: Ready for RADIUS authentication
- Successfully integrated SOPS with AGE encryption
- All secrets properly encrypted and decrypted
- Environment files managed securely
- Admin user created:
admin/admin123 - Web UI accessible at
http://192.168.88.194:9000
nixmox/
├── flake.nix # Main flake configuration
├── secrets/
│ └── default.yaml # SOPS-encrypted secrets
└── modules/
└── authentik/
└── default.nix # Authentik NixOS module
sops = {
defaultSopsFile = ./secrets/default.yaml;
age.keyFile = "/etc/sops/age/keys.txt"; # Remote server AGE key
};- Uses
authentik-nixflake module - Configures SOPS secrets for all services
- Sets up PostgreSQL and Redis automatically
- Creates admin user via systemd service
authentik:
env: |
AUTHENTIK_SECRET_KEY=...
AUTHENTIK_POSTGRESQL__PASSWORD=authentik123
AUTHENTIK_BOOTSTRAP_PASSWORD=admin123
AUTHENTIK_EMAIL__PASSWORD=email123
authentik-ldap:
env: |
AUTHENTIK_HOST=http://127.0.0.1:9000
AUTHENTIK_TOKEN=your-ldap-outpost-token-here
AUTHENTIK_INSECURE=true
authentik-radius:
env: |
AUTHENTIK_HOST=http://127.0.0.1:9000
AUTHENTIK_TOKEN=your-radius-outpost-token-here
AUTHENTIK_INSECURE=true- Target: LXC container at
192.168.88.194 - Build Strategy: Local build, remote deployment
- Command:
nix run nixpkgs#nixos-rebuild -- switch --flake .#authentik --target-host root@192.168.88.194 --build-host localhost --verbose --max-jobs 1
- Local AGE Key:
~/.config/sops/age/keys.txt - Remote AGE Key:
/etc/sops/age/keys.txt(copied from local) - Permissions:
600on remote key file - Encryption: AES256_GCM with AGE recipients
authentik.service
├── postgresql.service
├── redis-authentik.service
├── authentik-ldap.service
└── authentik-radius.service
- Redis: Automatically configures Redis on port 6379
- Users: Only creates
redis-authentikuser, not separate users for outposts - Outposts: Run as same
authentikuser - Environment Files: Must include
AUTHENTIK_HOSTfor outposts
- Secret Structure: Must use top-level keys (
authentik-ldap,authentik-radius) - User Permissions: All secrets must use same user (
authentik) - AGE Key Management: Remote server needs local AGE private key
- Encryption Process: Remove sops metadata → encrypt → deploy
- Memory Management: Use
--max-jobs 1for LXC containers - Build Strategy: Local build, remote deployment for resource efficiency
- Service Dependencies: Ensure proper startup order
- Error Handling: Check service logs for configuration issues
Problem: Two Redis instances trying to bind to port 6379
Solution: Remove manual Redis configuration, let authentik-nix handle it
Problem: Error getting data key: 0 successful groups required, got 0
Solution: Ensure remote server has AGE private key at /etc/sops/age/keys.txt
Problem: 403 Forbidden errors from outposts
Solution: Include AUTHENTIK_HOST and proper tokens in environment files
Problem: failed to lookup user 'authentik-ldap'
Solution: Use authentik user for all SOPS secrets
- Authentik Core (port 9000)
- PostgreSQL Database
- Redis Cache (port 6379)
- LDAP Outpost (running with placeholder token)
- RADIUS Outpost (running with placeholder token)
- SOPS Secret Management
- Admin Web UI
-
Generate Real Outpost Tokens
- Access web UI at
http://192.168.88.194:9000 - Create LDAP and RADIUS outposts
- Copy generated tokens
- Access web UI at
-
Update Secrets
- Replace placeholder tokens with real ones
- Re-encrypt and redeploy
-
Configure Outposts
- LDAP: Configure bind DN, search base, etc.
- RADIUS: Configure shared secrets, etc.
# Deploy to remote container
nix run nixpkgs#nixos-rebuild -- switch --flake .#authentik --target-host root@192.168.88.194 --build-host localhost --verbose --max-jobs 1# Encrypt secrets file
sops -e -i secrets/default.yaml
# Decrypt secrets file
sops -d secrets/default.yaml
# Edit encrypted file
sops secrets/default.yaml# Check service status
ssh root@192.168.88.194 "systemctl status authentik authentik-ldap authentik-radius postgresql redis-authentik"
# View service logs
ssh root@192.168.88.194 "journalctl -u authentik-ldap -n 20"
# Test web UI
ssh root@192.168.88.194 "curl -s -o /dev/null -w '%{http_code}' http://localhost:9000/if/admin/"# Check decrypted environment files
ssh root@192.168.88.194 "cat /run/secrets/authentik/env"
ssh root@192.168.88.194 "cat /run/secrets/authentik-ldap/env"
ssh root@192.168.88.194 "cat /run/secrets/authentik-radius/env"- AGE keys stored securely on remote server
- Environment files have
0400permissions - Secrets encrypted with AES256_GCM
- Multiple AGE recipients for key rotation
- Services bound to localhost where possible
- Outposts use
AUTHENTIK_INSECURE=truefor local communication - Web UI accessible on container IP
- Admin user created with secure password
- Outpost tokens will be properly generated in production
- Database passwords managed via SOPS
- Check service logs:
journalctl -u <service-name> - Verify environment files exist and are readable
- Check SOPS decryption:
sops -d /path/to/secrets.yaml - Verify AGE key permissions on remote server
- Ensure remote server has AGE private key
- Check key file permissions (
600) - Verify AGE key path in
flake.nix - Re-encrypt secrets if needed
- Verify
AUTHENTIK_HOSTin environment - Check token validity
- Ensure Authentik core is running
- Review outpost logs for specific errors
- SSL/TLS: Configure proper certificates
- Reverse Proxy: Add nginx for external access
- Monitoring: Add Prometheus/Grafana integration
- Backup: Configure database backups
- High Availability: Multi-node setup
- Environment Variables: Move more config to SOPS
- Domain Configuration: Support custom domains
- Email Integration: Configure SMTP properly
- Branding: Customize Authentik appearance
Last Updated: 2025-08-05
Status: ✅ Production Ready (with token generation pending)
Deployment Target: LXC Container 192.168.88.194
Admin Access: http://192.168.88.194:9000 (admin/admin123)