6.0 KiB
6.0 KiB
Admin-Level SSO Setup Guide
Date: 2025-11-23 Objective: Create separate user-level and admin-level SSO providers for proper access control
Overview
This guide sets up a two-tier SSO architecture:
- User Services Proxy - For general authenticated access (Organizr)
- Admin Services Proxy - For administrative interfaces (Core API, future admin tools)
Prerequisites
- Authentik accessible at https://auth.schweitz.net
- Admin credentials: akadmin / yzXAhiBAggPB5cz
- Standalone outpost running on port 9445
Step 1: Create Admin Group
- Navigate to https://auth.schweitz.net
- Log in as
akadmin - Go to Directory → Groups
- Click Create
- Fill in:
- Name:
homelab-admins - Parent: (none)
- Click Create
- Name:
- Click on the new
homelab-adminsgroup - Go to Users tab
- Click Add existing user
- Select your user (jpmschweitzer@gmail.com)
- Click Add
Step 2: Create Admin Authorization Policy
- Go to Customization → Policies
- Click Create → Group Membership Policy
- Fill in:
- Name:
Admin Group Required - Groups: Select
homelab-admins - Click Create
- Name:
Step 3: Create Admin Proxy Provider
- Go to Applications → Providers
- Click Create → Proxy Provider
- Fill in:
- Name:
Admin Services Proxy - Authorization flow:
default-provider-authorization-implicit-consent - Mode:
Forward auth (single application) - External host:
https://api.schweitz.net - Cookie domain:
.schweitz.net - Token validity:
hours=8 - Click Next
- Name:
- On Policy Bindings page:
- Click Bind existing policy
- Select
Admin Group Required - Order: 0
- Click Create
Step 4: Create Core API Application
- Go to Applications → Applications
- Click Create
- Fill in:
- Name:
Core API - Slug:
core-api - Provider: Select
Admin Services Proxy - Launch URL:
https://api.schweitz.net - Policy engine mode:
all(require all policies to pass) - Click Create
- Name:
Step 5: Assign Provider to Standalone Outpost
- Go to Applications → Outposts
- Click on Outpost Standalone Proxy Outpost
- In the Applications field, you should see
Organizr - Add
Core APIto the applications list - Click Update
- Wait 10-20 seconds for the outpost to reconnect
- Check logs:
docker logs authentik-proxy --tail 50- Should see: "WebSocket connected" and no errors
Step 6: Verify NPM Configuration
The NPM config for api.schweitz.net should already be correct:
# Forward auth to standalone outpost
auth_request /outpost.goauthentik.io/auth/nginx;
# Outpost proxy location
location /outpost.goauthentik.io {
proxy_pass https://localhost:9445/outpost.goauthentik.io;
# ... rest of config
}
No changes needed to NPM - The outpost automatically handles routing to the correct provider based on the external host.
Step 7: Test Admin Access
-
Test in incognito window:
# Open incognito window https://api.schweitz.net/docs -
Expected flow:
- Redirects to https://auth.schweitz.net
- Shows Google OAuth login
- After authentication, checks group membership
- If in
homelab-adminsgroup → allows access - If NOT in group → shows "Access Denied" or "Insufficient Permissions"
-
Verify headers are passed:
# After logging in, check developer tools → Network → Headers # Should see X-authentik-groups containing "homelab-admins"
Step 8: Rename Organizr Provider (Optional)
For consistency, rename the existing provider:
- Go to Applications → Providers
- Click on
Organizr Proxy - Change Name to
User Services Proxy - Click Update
Architecture Diagram
User → https://api.schweitz.net
↓
NPM: Forward auth check
↓
Standalone Outpost (port 9445)
↓
Authentik: Check which provider matches external host
↓
Provider: "Admin Services Proxy" (for api.schweitz.net)
↓
Policy: "Admin Group Required"
↓
✅ User in homelab-admins → Allow
❌ User NOT in group → Deny (403)
Verification Checklist
- Admin group
homelab-adminscreated - Your user added to
homelab-adminsgroup - Policy
Admin Group Requiredcreated - Provider
Admin Services Proxycreated with policy binding - Application
Core APIcreated and linked to provider - Outpost has both
OrganizrandCore APIapplications assigned - Outpost logs show successful WebSocket connection
- Test access to https://api.schweitz.net/docs requires auth
- After auth, access is granted (user is in admin group)
- X-authentik-groups header contains
homelab-admins
Troubleshooting
Issue: "Access Denied" even though user is in admin group
Check:
# Verify policy is bound to provider
curl -s -H "Authorization: Bearer 9blMGz71CFMJszs7AedQefgydpTnwvybjmMn0AlYilIKBV5LIq7snqnCodwX" \
https://auth.schweitz.net/api/v3/providers/proxy/ | \
python3 -m json.tool | grep -A 20 "Admin Services"
Issue: Outpost not picking up new provider
Fix:
# Restart outpost
docker restart authentik-proxy
# Check logs
docker logs authentik-proxy --tail 100
Issue: Still using old provider
Check:
# Verify external host is EXACTLY "https://api.schweitz.net" (no trailing slash)
# Authentik matches providers by exact external host match
Next Steps
After admin SSO is working:
- Mark Milestone 4 as complete in STATUS.md
- Continue to Milestone 5: Protect remaining services
- git.schweitz.net (Gitea) → Admin provider
- amp.schweitz.net (AMP) → User provider
- tatlock.schweitz.net → User provider
- Update CHANGELOG.md with 0.8.3-admin-sso version
Reference
- Authentik Proxy Provider Docs: https://docs.goauthentik.io/docs/providers/proxy/
- Group Policies: https://docs.goauthentik.io/docs/policies/expression/
- Outpost Configuration: https://docs.goauthentik.io/docs/outposts/