git: Sign in to Gitea with Pocket ID #13

Merged
dev merged 1 commits from gitea-pocket-id into master 2026-11-27 00:39:15 +00:00

This lets you sign in to Gitea with Pocket ID: git.nul.ie gets a login source named id.nul.ie.

  • Pocket ID side: middleman declares the client gitea in my.pocket-id, with callback https://git.nul.ie/user/oauth2/id.nul.ie/callback. Its secret, gitea/oidc-secret.txt, is encrypted for both middleman and the git VM.
  • Gitea side: Gitea keeps login sources in its database, so a gitea preStart step runs gitea admin auth add-oauth the first time and update-oauth after that. I tested both against a throwaway SQLite Gitea 28.3; it ends up with exactly one source.
  • Failures don't stop Gitea: the server only reads login sources at startup, so this has to run before it. If the step fails, it logs a warning and Gitea starts without the source. Every command it runs is a full store path. (The first deploy called a bare awk, which isn't on the unit's PATH; Gitea went into a restart loop and was rolled back.)
  • Accounts: DISABLE_REGISTRATION stays on, so a Pocket ID sign-in can't create an account. The first sign-in links to an existing account (Gitea's default ACCOUNT_LINKING = login), which takes that account's password once.
  • No group restriction: Gitea's own accounts are the gate, so I didn't restrict the client to a group. I also didn't map Pocket ID groups to Gitea admin, because Gitea would then take admin away from any admin who isn't in the group.
  • Secret on the command line: the Gitea CLI only takes the secret as an argument, so it's briefly visible in the git VM's process list while preStart runs.

Deploying

Deploy middleman first, so the client exists before Gitea starts using it, then git.

Later

Once accounts are linked, the password form could be turned off (ENABLE_PASSWORD_SIGNIN_FORM = false). Tokens and SSH keys would keep working.

🤖 Generated with Claude Code

This lets you sign in to Gitea with Pocket ID: `git.nul.ie` gets a login source named `id.nul.ie`. - **Pocket ID side:** `middleman` declares the client `gitea` in `my.pocket-id`, with callback `https://git.nul.ie/user/oauth2/id.nul.ie/callback`. Its secret, `gitea/oidc-secret.txt`, is encrypted for both `middleman` and the `git` VM. - **Gitea side:** Gitea keeps login sources in its database, so a `gitea` `preStart` step runs `gitea admin auth add-oauth` the first time and `update-oauth` after that. I tested both against a throwaway SQLite Gitea 28.3; it ends up with exactly one source. - **Failures don't stop Gitea:** the server only reads login sources at startup, so this has to run before it. If the step fails, it logs a warning and Gitea starts without the source. Every command it runs is a full store path. (The first deploy called a bare `awk`, which isn't on the unit's `PATH`; Gitea went into a restart loop and was rolled back.) - **Accounts:** `DISABLE_REGISTRATION` stays on, so a Pocket ID sign-in can't create an account. The first sign-in links to an existing account (Gitea's default `ACCOUNT_LINKING = login`), which takes that account's password once. - **No group restriction:** Gitea's own accounts are the gate, so I didn't restrict the client to a group. I also didn't map Pocket ID groups to Gitea admin, because Gitea would then take admin away from any admin who isn't in the group. - **Secret on the command line:** the Gitea CLI only takes the secret as an argument, so it's briefly visible in the `git` VM's process list while `preStart` runs. ## Deploying Deploy `middleman` first, so the client exists before Gitea starts using it, then `git`. ## Later Once accounts are linked, the password form could be turned off (`ENABLE_PASSWORD_SIGNIN_FORM = false`). Tokens and SSH keys would keep working. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
slop-cannon Bot added 1 commit 2026-11-27 00:35:03 +00:00
git: Sign in to Gitea with Pocket ID
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Failing after 1m10s
CI / Check, build and cache nixfiles (push) Successful in 29m1s
712fabcb62
Add an `id.nul.ie` OpenID Connect login source to Gitea, kept up to
date from `preStart` since Gitea stores login sources in its database.
Its client is declared on `middleman` with the secret shared by both.
Registration stays disabled, so a Pocket ID sign-in links to an
existing account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slop-cannon Bot force-pushed gitea-pocket-id from 540366abac to 712fabcb62 2026-11-27 00:35:03 +00:00 Compare
dev merged commit 712fabcb62 into master 2026-11-27 00:39:15 +00:00
dev deleted branch gitea-pocket-id 2026-11-27 00:39:15 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dev/nixfiles#13