Skip to content

Agent hardening: TLS by default, pairing, per-device tokens - #3

Merged
retransmit merged 32 commits into
mainfrom
phase-4b1-agent-hardening
Oct 7, 2026
Merged

retransmit merged 32 commits into
mainfrom
phase-4b1-agent-hardening

Conversation

@retransmit

Copy link
Copy Markdown
Owner

Summary

Makes the agent safe to expose. Until now it was a plain-HTTP proxy behind one shared token.

  • TLS by default. The agent serves TLS 1.3 with a certificate of its own, kept in a state folder. Phones will pin its fingerprint. --insecure-http keeps plain HTTP for use behind a proxy, and for the app as it is today.
  • Pairing. pair shows a QR code, a link and a 12-character code that works once and for five minutes. The phone proves it holds the code, bound to the certificate it sees, and gets its own token. Someone relaying the connection gets nothing.
  • A token per phone, with two levels. Tokens are stored only as hashes. A full device may do everything; a read-only device may only read, by a deny-by-default list. devices lists them, revoke removes one and ends its open streams and terminals at once.
  • Limits. Failed attempts are throttled per address (IPv6 per /64). A caller without credentials gets ten seconds to send its request. Request bodies are capped except for builds and uploads. Requests from web pages are refused.
  • Operations. An access log without secrets, a graceful stop, one agent per state folder, and fingerprint, healthcheck and version commands.
  • CI. The agent job uses the current stable Go and adds a formatting check, the race detector and a vulnerability check.

For people running the earlier agent

The README has a section on what changed. In short: port 8443 with TLS by default (--insecure-http for the old behaviour on 8080), AGENT_TOKEN is optional and must be at least 16 characters, and the agent needs a state folder of its own. The Go module is now github.com/retransmit/docker-mobile/agent.

The app in this repository does not use the certificate or pairing yet. It keeps working against the agent started with --insecure-http and a shared token.

Checks

  • go vet, gofmt and go test -race ./... on Linux with the stable Go, 16 packages
  • govulncheck: no vulnerabilities found
  • go test ./... on Windows
  • flutter test: 639 passing (the app is unchanged)
  • The Linux binary run by hand: start, pair, devices, revoke, fingerprint, healthcheck, a second agent on the same folder, stop
  • Against a real Docker daemon
  • Pairing from a phone (needs the app side)

@retransmit
retransmit merged commit d9fe202 into main Oct 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant