: nply/foundationpkgs

commit 3a60776ec82a8ca49dab139c922f6cd9136a2238
parent 0fea439e434b278805ab3aaaa8fd4c39fc5a3ff3
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Thu, 29 Oct 2026 20:42:18 +0530

Document native Firefox Accounts deployment and verification
1 file changed, 117 insertions(+), 0 deletions(-)
A
docs/firefox-sync.md
|
117
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/docs/firefox-sync.md b/docs/firefox-sync.md
@@ -0,0 +1,117 @@
+# Firefox Sync on cdg-1
+
+## Deployment
+
+`Unix/minimal-fxa-server/APKBUILD` packages unchanged upstream commit
+`8ec5f0d160269f5079431d2b75574337f0552940` as `0_git20260225-r0`.
+It builds both `minimal-fxa-server` and `fxa-user` with CGO disabled.
+Use the repository's CI artifacts for deployment, not ad hoc server builds.
+
+The deployed Linux artifact was published by CI for repository revision
+`0fea439e434b278805ab3aaaa8fd4c39fc5a3ff3`, build key
+`48709aa96c4dee2eb5483d471d0b1866ebc7b2584741f69e7fc42f905228be44`:
+
+<https://nply.org/dl/foundationpkgs/x86_64-unknown-linux-gnu/minimal-fxa-server/0_git20260225-r0/48709aa96c4dee2eb5483d471d0b1866ebc7b2584741f69e7fc42f905228be44/manifest>
+
+Verify the accompanying SHA-256 digest. Extract packages into a staging directory,
+then use `install -o root -g root -m 755` for the two binaries under `/usr/bin`.
+**Do not extract the archive directly over `/`:** tar restores CI ownership and
+parent directory modes, which must not replace system directory metadata.
+
+## Services and configuration
+
+- `syncserver.service`: existing native syncstorage-rs 0.21.1; `127.0.0.1:8001`.
+- `minimal-fxa-server.service`: CI-built Accounts service; port 8002.
+- `/etc/minimal-fxa-server/environment`: root-only environment file containing
+  PostgreSQL credentials and a persistent PEM RSA signing key. Local accounts;
+  database `minimal_fxa`, role `minimal_fxa`.
+- `/run/fxa/usermgmt.sock`: private account-management socket.
+- `/etc/syncserver/config.toml`: storage/token configuration, with
+  `fxa_email_domain = "sync.nply.org"` and
+  `fxa_oauth_server_url = "http://127.0.0.1:8003/oauth/"`.
+- `/etc/lighttpd/vhosts.d/sync.nply.org.conf`: existing HTTPS certificate;
+  Accounts at the origin, `/1.0/`, `/1.5/`, and storage health/version endpoints
+  proxied to syncstorage-rs.
+- `/etc/lighttpd/vhosts.d/sync-local-verifier.conf`: internal-only port 8003.
+
+Upstream Accounts binds all interfaces. Its systemd unit uses
+`IPAddressDeny=any` plus `IPAddressAllow=localhost`; only local lighttpd and
+PostgreSQL traffic is allowed. Direct external access to port 8002 was tested
+and blocked. VAPID keys are deliberately unset, disabling outgoing Web Push.
+
+### Why the internal verifier listener exists
+
+syncstorage-rs's native JWT verifier splits the JWT scope string on commas.
+minimal-fxa-server emits space-separated scopes, so otherwise valid account
+tokens are rejected. Its remote `/oauth/v1/verify` endpoint returns the expected
+scope array.
+
+Port 8003 proxies only `/oauth/v1/verify` to Accounts. JWKS requests receive 404,
+selecting syncstorage-rs's **existing remote-verification fallback**. The Accounts
+server verifies token signatures and expiration. This is configuration, not a
+source patch, authentication bypass, or maintained fork. The trailing slash on
+`fxa_oauth_server_url` is significant for relative URL joining.
+
+## Create your account
+
+No permanent user or default password was created. Run interactively:
+
+```sh
+ssh -t cdg-1 'fxa-user create your-email@example.com'
+```
+
+The CLI prompts for a password and confirmation. The email is a local account
+identifier; it does not register a Mozilla account. Manage accounts with
+`fxa-user list`, `fxa-user passwd EMAIL`, and `fxa-user delete EMAIL` (interactive
+confirmation required for deletion).
+
+## Firefox Desktop
+
+Prefer a fresh profile for the first test; preserve existing profile data.
+In `about:config`, set:
+
+```text
+identity.fxaccounts.autoconfig.uri = https://sync.nply.org/
+identity.sync.tokenserver.uri = https://sync.nply.org/1.0/sync/1.5
+```
+
+Restart Firefox and use its normal sign-in flow with your **local account**.
+HTTPS is enabled; do not enable `identity.fxaccounts.allowHttp`.
+
+Upstream documents Android custom Accounts/Sync URLs through its Sync Debug
+settings, but its instructions use Mozilla Push. Do not claim the documented
+Android flow satisfies complete independence from Mozilla.
+
+## Verification and limitations
+
+Verified with a disposable synthetic account:
+
+- Native CLI account creation with interactive password entry.
+- Local password authentication over trusted HTTPS.
+- OAuth code exchange, scoped-key JWE response, and local Sync token issuance.
+- Hawk-authenticated storage write, read, and delete through HTTPS.
+- Accounts autoconfiguration pointing only at this origin.
+- Service restart, health/authentication smoke checks, and existing site health.
+- Synthetic Accounts sessions/tokens/users and storage/tokenserver fixtures removed.
+
+`/usr/local/bin/check-syncserver` checks trusted HTTPS/database heartbeat and
+unauthenticated/invalid-token rejection. Inspect logs with:
+
+```sh
+ssh cdg-1 'journalctl -u minimal-fxa-server -u syncserver -n 80'
+```
+
+This does **not** verify full Firefox multi-device engine compatibility, key
+unwrapping by real Firefox, recovery, mobile behavior, or send-tab/push delivery.
+Push is disabled; real-time notifications cannot be promised. Firefox clients
+may still have their own Mozilla Push connections until configured otherwise.
+The server-side authentication/storage path is local; total client-side Mozilla
+network independence remains unverified.
+
+The user explicitly accepted upstream's deterministic key derivation from user
+ID and timestamp. No security fork or source hardening was introduced.
+
+Back up all three databases (`minimal_fxa`, `syncstorage_rs`, `tokenserver_rs`)
+and both secret configuration files before upgrades. Preserve signing/master
+keys. Pre-switch configs are under
+`/root/sync-before-local-accounts-20261029-150515/`.