Skip to content

feat: pullgate bootstrap with pairing, so nobody types or pastes the owner ID #31

Closed

Description

@groupsky

Why

Setting up a new host today is a long list of commands (users, directories, units, the listener config with the owner's IDs, the bot token, a deploy key, the instance config). Each step can go wrong, and pasted blocks that read the keyboard eat the lines after them. Worse, if the person pastes a script that someone else wrote, that script decides the owner ID: a planted owner_id would give the bot to someone else.

Proposal

pullgate bootstrap (as root, after install.sh), in this order:

  1. Makes the users, directories and units as the README says (same code as pullgate doctor, feat: pullgate doctor, read-back of modes, and no silent "asked" when a question was not delivered #28, checks).
  2. Asks for the bot token with systemd-ask-password (no echo, not in shell history, not an argument), checks it with getMe, and stores it as /etc/pullgate/bot-token (0600).
  3. Pairing: prints a one-time code (for example 6 words or 8 digits, valid 10 minutes) on the console and waits. The owner sends that code to the bot. pullgate takes owner_id and chat_id from that message (private chat only) and writes listener.toml. Nobody types or pastes the IDs, so a script cannot plant them. A wrong code, a group chat or a timeout writes nothing.
  4. For each instance given (--instance NAME --repo URL): makes the deploy key on the host (ssh-keygen, the private key never leaves), prints the public key to add to the repo as read-only, pins the git host key (for GitHub: from GitHub's published keys, shown with fingerprint for the owner to compare), writes a minimal instance config, and waits until git ls-remote works.
  5. Runs pullgate doctor and enables the units.

The README "Install" becomes: install.sh, then pullgate bootstrap. A one-paste form serves the script from a public tag with its SHA-256 printed in the release notes, so a person checks it against GitHub, not against what the person who sent the command wrote.

pullgate's own files (listener.toml, the token, the instance mode, the units) are pullgate's: a later config tool (for example Ansible run by an instance) must not write them; DESIGN.md says so and doctor warns when they changed outside pullgate.

Done when

  • pullgate bootstrap does steps 1–5 with tests (fake Telegram for the pairing: right code, wrong code, group chat, timeout; fake git host for the key step).
  • The pairing writes the IDs only from the message that carries the code; a test proves a config file or argument cannot set them in bootstrap.
  • The token is read without echo and never appears in logs, arguments or the environment of child processes (a test).
  • The install CI job (test: CI installs pullgate as the README says and runs a full loop under the real units #27) uses pullgate bootstrap on a fake Telegram.
  • README and DESIGN.md describe it; THREAT-MODEL.md covers planted IDs, the token entry and the pairing code.

Activity

  1. groupsky commented on Nov 19, 2026

    @groupsky
    ContributorAuthor

    Done in #48 (squash commit 4ab136a), except steps 1 and 5.

    Not done, and not in "Done when": the one-paste form with a SHA-256 in the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions