Skip to content

feat: node enrollment with ./zebrunner.sh join and the token of the host - #460

Open
azarouski wants to merge 6 commits into
developfrom
feat/node-enrollment
Open

azarouski wants to merge 6 commits into
developfrom
feat/node-enrollment

Conversation

@azarouski

Copy link
Copy Markdown
Contributor

Part of the node enrollment (design: per-node credentials, self-enrollment with an admin-issued one-time invite, revocation per node). Builds on #459 (included in this branch, merge it first).

  • ./zebrunner.sh join: the join string of ./zebrunner.sh node-invite of mcloud is read from a hidden prompt or stdin (never argv); POST /api/v1/nodes/enroll over HTTPS trusting only the pinned TLS key (curl --pinnedpubkey, body on stdin), the answer is validated (no injection into the settings), the settings are written with mode 600 and a private backup; the shared NODE_REGISTRATION_TOKEN/STF_STORAGE_TOKEN are emptied.
  • MCLOUD_NODE_TOKEN replaces the shared tokens in the containers and goes to STF as STF_NODE_TOKEN (the HMAC proof binding the devices to the node); prechecks accept it.
  • zebrunner-farm deployed 750 root: (Linux) / 700 user (macOS): it contains secrets.
  • doctor: enrollment state, leftover shared tokens, world-readable settings / zebrunner-farm.

Related: zebrunner/stf (registry, API, ZAP, storage, device binding), zebrunner/mcloud-grid#216, zebrunner/mcloud#278.

Tests: make lint, make test (macOS, incl. bash 3.2), make docker (Linux).

azarouski and others added 6 commits November 9, 2026 14:05
…runner-farm

- ./zebrunner.sh doctor checks the host, the settings, the deployment, the network to the MCloud server (the NAT
  hairpin of STF_PROVIDER_HOST, AGENT_HOSTS of stf-proxy) and the devices, and tells what to fix
- the setup ends with the numbered next steps, curve-key prints the STF_ZMQ_CURVE_CLIENT_KEY_<HOST> line of mcloud
- ansible offers to remove the running containers of the devices before the deploy
- zebrunner-farm: several devices, groups and patterns, -x to exclude, the list and the question in a terminal
  (filter, exclude, run, cancel), -q; one line per container: running, started, created or the error

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s of the devices

- zebrunner-farm restart --batch (default: all the containers removed, then created) or --rolling (device by
  device), s of the question switches it
- REMOTE_CONNECT_HOST goes to the STF containers (adb connect through the adb relay of mcloud), doctor checks the relay
  on the ports of the devices and prints the ADB_RELAY_HOSTS entry of the host
- proxy_port and server_proxy_port of the devices are dropped: not in mcloud-devices.txt, not passed to appium; doctor
  reads the list of the earlier format too

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…db relay

The relay forwards min_port + 1 of every Android device only: min_port is the screen, it has no login of its own.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d device

- connect_port of a device (optional, Android): STF_PROVIDER_CONNECT_PORT of its STF container (zebrunner/stf fixed
  connect port), published when it is out of min_port-max_port, validated with the other host ports; appium gets it as
  ADB_PORT
- adb_port is no longer obligatory: unused on Linux, the host port of a USB Android device on macOS
- mcloud-devices.txt: connect_port is the 15th field
- doctor: the remote debug ports from connect_port (min_port + 1 without it), ADB_RELAY=true of mcloud as the fix

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- ./zebrunner.sh join reads the join string of ./zebrunner.sh node-invite of mcloud (hidden prompt or stdin, never
  argv), sends the public CURVE key over HTTPS to the pinned TLS key only (curl --pinnedpubkey, the secrets on stdin),
  validates the answer and writes the settings (mode 600, a private backup): MCLOUD_NODE_TOKEN, the CURVE key of the
  server, the endpoints, STF_PROVIDER_HOST; the shared tokens are emptied
- MCLOUD_NODE_TOKEN replaces NODE_REGISTRATION_TOKEN (appium) and STF_STORAGE_TOKEN (stf) and goes to STF as
  STF_NODE_TOKEN (the proof of the devices); the prechecks accept it instead of the shared tokens
- zebrunner-farm (the secrets of the settings) is deployed readable by root and the user only (750 / 700)
- doctor: the enrollment, the shared tokens left, the settings and zebrunner-farm readable by other users
- setup: the enrollment is the next step, the manual settings the alternative

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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