mrwick/notebook

drag or arrow keys to move · scroll to zoom · esc to exit

explain

Single sign-on in plain words

Updated

Single sign-on means you log in once and every app trusts that login. The apps do not hold your password. A separate login server holds it.

The idea in four steps

  1. You open status.example.com. Your browser has no session.
  2. Caddy, the reverse proxy, asks the login server: “Is this request from a logged-in user?” This call is forward_auth.
  3. The login server says no. Caddy sends your browser to the login page.
  4. You log in. The login server sets a cookie. From now on the answer is yes, and Caddy forwards your request to the app.

The app never sees a login. It only sees requests that already passed.

The cookie belongs to the parent domain, example.com. A browser sends it to every subdomain, so status.example.com and rss.example.com both receive it. One login, one cookie, many apps.

This also sets a limit. Every app under that domain shares the cookie. An app that you do not trust should not live on a subdomain of it.

What the app can learn

When the login server says yes, Caddy copies a few headers into the request: Remote-User, Remote-Email, Remote-Groups, and Remote-Name. Some apps accept these headers as proof of identity. They create the account on first visit and skip their own login.

That trust is dangerous. A header is only text. If anyone can reach the app without going through the proxy, they can write Remote-User: admin themselves. Two rules follow:

When headers are the wrong tool

Some apps cannot use headers. They support OpenID Connect (OIDC) instead. In OIDC, the app sends you to the login server, gets a signed token back, and checks the signature. No header is trusted. Authelia can act as the OIDC provider, so the same login covers these apps too.

What cannot sit behind a login page

A phone app cannot click through a web login page. DNS clients cannot either. So some paths stay outside single sign-on and keep their own authentication: the DNS-over-HTTPS endpoint, the password manager API, and the music server.

I treat this as a list that I write down, not as an accident. Every open path has a reason and its own lock.

Where to go next