Trusted proxy login
If a login proxy like Authelia, Authentik or Cloudflare Access already sits in front of Termix, it can sign people in for you. The proxy checks who someone is and sends their username and groups in headers. Termix trusts those headers only from addresses you list.
Anyone who can reach Termix without going through the proxy can send those headers and become any user. Only turn this on when the proxy is the only way in.
How it works
- Someone opens Termix. The proxy makes them sign in.
- The proxy adds a username header and a roles header.
- Termix checks the request came from a trusted address.
- Termix maps the proxy's roles to Termix roles and signs them in.
If any role in the header is not in your role map, the login is refused. That way a new group in your identity provider can't grant access by accident.
Set it up
environment:
TRUSTED_PROXY_AUTH_ENABLED: "true"
TRUSTED_PROXY_AUTH_TRUSTED_PROXIES: "172.18.0.5"
TRUSTED_PROXY_AUTH_ROLE_MAP: '{"admins":["admin"],"staff":["user"]}'
Termix won't start with it on unless both the trusted list and the role map are set.
| Variable | Default | What it does |
|---|---|---|
TERMIX_ADMIN_HOLD_MINUTES | Minutes a dangerous admin change (a new admin, password login off, a plugin with dangerous access) waits when the server has two or more admins, so the others can cancel it. 0 turns it off. Overrides the admin setting, which admins then can't change. | |
ALLOW_PASSWORD_LOGIN | true or false. Overrides the admin setting for signing in with a username and password. | |
ALLOW_REGISTRATION | true or false. Overrides the admin setting for creating new accounts. | |
ALLOW_PASSWORD_RESET | true or false. Overrides the admin setting for resetting a password from the sign in page. | |
EXTERNAL_ALLOW_REGISTRATION | true or false. Overrides the admin setting for creating accounts the first time someone signs in with SSO or LDAP. | |
EXTERNAL_FORCE_HTTPS | false | Build sign in callback URLs with https even when the request came in over http. Use it behind a proxy that does not send X-Forwarded-Proto. |
OIDC_ALLOW_REGISTRATION | Old name for EXTERNAL_ALLOW_REGISTRATION. Still read in 26.10. | |
OIDC_FORCE_HTTPS | Old name for EXTERNAL_FORCE_HTTPS. Still read in 26.10. | |
TRUSTED_PROXY_AUTH_ENABLED | false | Let a proxy like Authelia or Authentik sign people in by sending their username in a header. |
TRUSTED_PROXY_AUTH_TRUSTED_PROXIES | Comma separated IPs or CIDRs of the proxies allowed to send the headers. Required when trusted proxy login is on. | |
TRUSTED_PROXY_AUTH_USERNAME_HEADER | x-forwarded-username | Header that holds the username. |
TRUSTED_PROXY_AUTH_ROLE_HEADER | x-forwarded-role | Header that holds the user's groups or roles. |
TRUSTED_PROXY_AUTH_ROLE_MAP | JSON map from proxy roles to Termix roles, like {"admins":["admin"],"staff":["user"]}. Required when trusted proxy login is on. |
Getting the address right
The address Termix sees is the one that connects to it. That is your proxy, not the person in the browser. In Docker it is the proxy container's address on the shared network. List that one address if you can, not a whole subnet.
If logins get refused, the trusted list is almost always why. Set LOG_LEVEL=debug to see which address the request came from.
With other logins
It works next to passwords and other sign in plugins. Keep password login on for one admin so you can still get in if the proxy breaks.
You can't add a new second factor while this is on. The proxy decides who signs in.