Skip to main content

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.

danger

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​

  1. Someone opens Termix. The proxy makes them sign in.
  2. The proxy adds a username header and a roles header.
  3. Termix checks the request came from a trusted address.
  4. 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.

VariableDefaultWhat it does
TERMIX_ADMIN_HOLD_MINUTESMinutes 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_LOGINtrue or false. Overrides the admin setting for signing in with a username and password.
ALLOW_REGISTRATIONtrue or false. Overrides the admin setting for creating new accounts.
ALLOW_PASSWORD_RESETtrue or false. Overrides the admin setting for resetting a password from the sign in page.
EXTERNAL_ALLOW_REGISTRATIONtrue or false. Overrides the admin setting for creating accounts the first time someone signs in with SSO or LDAP.
EXTERNAL_FORCE_HTTPSfalseBuild 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_REGISTRATIONOld name for EXTERNAL_ALLOW_REGISTRATION. Still read in 26.10.
OIDC_FORCE_HTTPSOld name for EXTERNAL_FORCE_HTTPS. Still read in 26.10.
TRUSTED_PROXY_AUTH_ENABLEDfalseLet a proxy like Authelia or Authentik sign people in by sending their username in a header.
TRUSTED_PROXY_AUTH_TRUSTED_PROXIESComma separated IPs or CIDRs of the proxies allowed to send the headers. Required when trusted proxy login is on.
TRUSTED_PROXY_AUTH_USERNAME_HEADERx-forwarded-usernameHeader that holds the username.
TRUSTED_PROXY_AUTH_ROLE_HEADERx-forwarded-roleHeader that holds the user's groups or roles.
TRUSTED_PROXY_AUTH_ROLE_MAPJSON 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.