- HCL 100%
| .kiro/steering | ||
| .vscode | ||
| .gitattributes | ||
| .gitignore | ||
| .terraform.lock.hcl | ||
| backend.tf | ||
| backup-roles-groups.tf | ||
| client-argocd-roles-groups.tf | ||
| client-argocd.tf | ||
| client-aurral-groups.tf | ||
| client-aurral.tf | ||
| client-bacularis.tf | ||
| client-forgejo-roles-groups.tf | ||
| client-forgejo.tf | ||
| client-immich-roles-groups.tf | ||
| client-immich.tf | ||
| client-mealie-roles-groups.tf | ||
| client-mealie.tf | ||
| client-ocis-roles-groups.tf | ||
| client-ocis.tf | ||
| client-paperless-roles-groups.tf | ||
| client-paperless.tf | ||
| client-proxmox-users-groups.tf | ||
| client-proxmox.tf | ||
| client-proxmoxbs-roles.tf | ||
| client-proxmoxbs.tf | ||
| client-searxng-roles.tf | ||
| client-searxng.tf | ||
| client-trilium-access.tf | ||
| client-trilium.tf | ||
| client-vault-roles.tf | ||
| client-vault.tf | ||
| client-welcome-roles.tf | ||
| client-welcome.tf | ||
| members.tf | ||
| prod.tfvars | ||
| providers.tf | ||
| README.md | ||
| realm_cosmos.tf | ||
| realm_master.tf | ||
| users.tf | ||
| variables.tf | ||
| versions.tf | ||
Keycloak setup guide
Create a client in the Master realm of Keycloak
- Open the Master Realm and create a new client called
terraform-super - Enable
Client Authentication - Disable
Standard FlowandDirect access grants - Enable
Service Account Roles - In the
Service Account Rolesfor the client add theadminrole to the client
Configure Aurral SSO
Before planning or applying, create the Vault KV v2 secret at
secret/kubernetes/transfer/aurral/creds with OIDC_CLIENT_ID and
OIDC_CLIENT_SECRET keys matching Aurral's OIDC configuration. The same secret
also holds LASTFM_API_KEY and LASTFM_API_SECRET for Aurral; these can reuse
Navidrome's Last.fm keys. This repository reads only the OIDC keys to configure
Keycloak; the Last.fm keys are consumed by the Aurral deployment.
The Aurral client is created in the Cosmos realm and uses the exact redirect URI
https://aurral.livewire.cc/sso/callback. It requires PKCE with S256, following
the repository's client convention.
The default aurral-groups scope adds a groups claim containing full group
paths to ID and access tokens. The groups /Aurral/Aurral-Admins and
/Aurral/Aurral-Users both include Alex and Ami. Manage their memberships in
members.tf and configure Aurral to recognize these group paths.
Configure backup administration and Bacularis SSO
The Cosmos group /Backup Admins includes Alex (alexv) and Jane (ami).
It grants the existing proxmoxbs-admin client role for PBS. PBS must map that
role to its own backup permissions; Keycloak membership alone does not configure
PBS ACLs. The existing Mox-Admins role assignments are preserved.
The Bacularis client reads its client-id and client-secret from the Vault
KV v2 secret at common/keycloak/bacularis. Create this secret before planning
or applying; use bacularis as the client ID and a generated client secret.
Keep the secret in Vault and copy it into the manually deployed Bacularis
identity provider configuration.
In Bacularis, open Security > Authentication > Identity providers and create
an OpenID Connect provider with identifier keycloak:
| Setting | Value |
|---|---|
| Discovery endpoint | https://auth.livewire.cc/realms/cosmos/.well-known/openid-configuration |
| Client ID / secret | client-id / client-secret from common/keycloak/bacularis |
| Redirect URI | https://concordia.cosmi.co.in:9097/web/oidc/keycloak/redirect |
| Post logout redirect URI | https://concordia.cosmi.co.in:9097/web/login/ |
| Scope | openid profile email |
| PKCE | Enabled, S256 |
| User attribute source | ID token |
| Username / long name / email attributes | preferred_username / name / email |
| Role attribute | groups |
Use discovery and token signature validation. The client has a default
bacularis-groups scope that includes full group paths in ID tokens, access
tokens, and UserInfo responses. Its backchannel logout URL is
https://concordia.cosmi.co.in:9097/web/oidc/keycloak/logout.
Assign the identity provider to a Bacularis organization and provision or create
both users in that organization. In Security > Roles > Role mapping, map the
IAM group /Backup Admins to Bacularis's administrator role, then select
Identity Provider as the role source and attach that mapping to the provider.
Configure the organization's API hosts and Bacula resource permissions as needed.
Log out and back in to pick up changed mappings. Role mapping requires Bacularis
6.0.0 or later; older versions need local Bacularis role assignments.
See the official OpenID Connect guide and role mapping guide.
Configure Trilium SSO
The confidential Cosmos client trilium uses authorization code flow with PKCE
S256, callback https://notes.livewire.cc/callback, and post-logout redirect
https://notes.livewire.cc/ (with /login also allowed). Direct grants, implicit flow, and service
accounts are disabled. Its default scopes provide profile and email claims.
Before planning a new installation, create the Vault KV v2 entry at mount
secret, path kubernetes/productivity/trilium-oauth2, with keys
TRILIUM_OAUTH_CLIENT_ID (trilium) and TRILIUM_OAUTH_CLIENT_SECRET (a generated
secret of at least 32 characters). The same entry supplies the Trilium deployment
through Vault Secrets Operator; do not copy the secret into Git or command-line
arguments. The initial credentials have been provisioned for this installation.
Trilium has a dedicated trilium-browser authentication flow. A required login
subflow accepts an existing SSO cookie or a username/password login, including
OTP for users who have it configured. A subsequent conditional subflow denies
users without the realm role trilium-access. This placement ensures the access
check also runs after an SSO cookie login. Only this client overrides the browser
flow; the realm's default flow remains in use by other clients.
The role is granted by Trilium-Users, whose exhaustive membership in
members.tf includes only keycloak_user.user_alexv. Do not add this role to
realm default roles or shared groups: Trilium is a single-user application.
After reviewing and applying the Terraform plan, commit/push the Trilium values
and VaultStaticSecret in magi-deployments, then sync its Argo CD Application.
The operator refreshes credentials every 300 seconds and restarts Trilium on
changes. When rotating the shared secret in Vault, also apply Terraform to update
Keycloak before relying on the new credential.
The owner must finish enrollment in Trilium: sign in with the local password,
open Options > Password & Auth, choose OpenID Connect provider, and select
Connect account, authenticating as alexv. Trilium binds the provider subject
identifier to the instance; supplying environment variables alone does not
complete enrollment. Test login and logout through https://notes.livewire.cc.