Onboarding agents
Add hosts with join tokens and the install scripts your Structam server serves: options, golden images, configuration management, matching, revoking.
On this page
Status. Tested: rendering of both install scripts with every option, bash -n and the signature, pin and checksum checks of install.sh, join tokens, enrolment, the download and status routes, and bundled release import and rollout, in the product's package tests on PostgreSQL; a live run of a real agent against a local server on macOS. Not yet run: install.ps1 on a real Windows host, and an install with a release signed by the KazLabs release key, which has not been generated yet (below).
An agent is installed on each host. It connects outbound to the server's public URL over one WebSocket (TLS), proves a per-host Ed25519 identity, pins the server's identity key, and reports what is installed, running and configured. Its files, commands and policy are on the agent page.
Join tokens
Agents → Add hosts (permission agents.enrol) creates a join token and shows the install commands. A token is shown once and looks like stj1.<id>.<secret>.<pin>.
| Field | Default | |
|---|---|---|
| Expiry | 24 h | at most 365 days |
| Uses | 1 | multi-use for golden images and configuration management |
| Policy | the matching assignment, else default | the agent policy new agents start with |
| Scope | none | auto-matching ignores NetBox hosts outside these sites, tenants and tags |
| Bound host | none | set by Onboard this host on a host page: single use, binds to that NetBox host |
| Labels | none |
- The secret half never reaches the server: the agent proves it holds it by signing with a key derived from it, so a copy of the database does not let anyone enrol.
- The pin is the SHA-256 of the server identity key, so the agent trusts that key from its first connection. There is no trust on first use. TLS is still used, but it is not the trust anchor.
- A user with a scoped
agents.enrolgrant can only create single-use tokens carrying their scope, valid for at most 7 days. - Tokens are revoked on Agents → Join tokens.
Installing
The install scripts are served by your own Structam server under /onboard/; the Add hosts page shows the commands with your public URL. The token never goes on a command line or into an environment variable, where it would show in ps, shell history or PowerShell's history: the scripts read it from the terminal without echo.
Linux and macOS (root):
curl -fsSL https://structam.example.com/onboard/install.sh | sudo sh
# Join token: (pasted, not echoed)Windows (elevated PowerShell):
iwr -useb https://structam.example.com/onboard/install.ps1 | iexConfiguration management (Ansible, Puppet and similar): write a multi-use token to a mode-0600 file and pass it. The script deletes the file after enrolment, and a re-run on a host whose agent is connected exits 0 without a token.
sh install.sh --join-file /root/structam-join.\install.ps1 -JoinFile C:\Windows\Temp\structam-joinOption (install.sh) | PowerShell | Meaning |
|---|---|---|
--join-file PATH | -JoinFile | read the token from a file, which is deleted after enrolment |
--image | -Image | install for a golden image: no start, no key (golden images) |
--upgrade | -Upgrade | replace the agent; no token; waits until the new version is connected |
--uninstall | -Uninstall | remove the agent |
--proxy URL | -Proxy | HTTP(S) proxy for the script and for the agent |
--dry-run | -DryRun | say what it would do; with --uninstall it ends with "dry run: nothing was removed" |
--allow-unsigned | -AllowUnsigned | install a build whose release manifest is not signed; printed and audited |
What install.sh does
- Checks that the pin in the token equals the server pin rendered into the script, and writes it to
server.pins. - Fetches the agent release manifest (
GET /agent/v1/manifestand.sig) and verifies its Ed25519 signature itself with OpenSSL 3, against the KazLabs release keys rendered into the script. A missing signature, an unknown key id or a missing OpenSSL 3 stops it, unless--allow-unsignedis given. - Downloads the build for the host's OS and CPU (
GET /agent/v1/download/<os>/<arch>) and checks its SHA-256 and size against the verified manifest. - Installs the binary, the env file (mode 0600) and the service through the agent's own
installcommand, and starts it. - Reports success only when the server shows the agent connected through the public URL, waiting up to 60 s.
It never uses curl -k and never adds a CA to the system trust store. When the public URL's certificate is from a private CA, save that CA under Add hosts → Private CA for agents (or STRUCTAM_AGENT_CA_FILE): the script then retries once with it, still verifying, and writes it to the agent's ca.pem only. Linux hosts without systemd are refused.
install.ps1 never adds a CA: Windows must already trust the server's certificate. Windows PowerShell cannot verify Ed25519 on its own: without OpenSSL 3 on the host the script says so, and trust in the binary then rests on TLS to the server.
Every script download is audited as onboard.script, aggregated per source address per 10 minutes. The routes are public, hold no secrets, and are rate limited per address: scripts 60 a minute, status 120, downloads 30.
The release key
Caution. The KazLabs release key has not been generated yet. Until its public half is compiled into the agent and rendered into the scripts, the server carries no signed agent release, the install scripts refuse unsigned manifests unless --allow-unsigned is given (printed and audited as onboard.unsigned_download), and release agents refuse every self-update. Hosts are upgraded with install.sh --upgrade.
Golden images
Install without enrolling, and clear the identity before capture, so clones never share a key:
sh install.sh --image # installs, writes the env file, does not start, makes no key
structam-agent reset-identity # in the image's sysprep or cloud-init step, before captureA cloned key seen on a second machine is refused and raises a high-severity agent.clone_suspected change event on the host.
Where agent builds come from
The server serves the agent builds it carries, so hosts never need internet access. Release images embed the agent release of their version, and every serve node stores it in the database at start, so every node serves every build. Other releases are imported:
structam agent-release import ./structam-agent-0.1.1/ # a directory with manifest.json, manifest.sig, binaries
structam agent-release list
structam agent-release publish -version 0.1.1 # offer it to auto-updating agents on its channel
structam agent-release pause -channel stable # stop automatic updatesAgents verify every update against the release keys compiled into them, so the server can withhold an update but cannot hand an agent a binary KazLabs did not sign. Automatic updates go out at most STRUCTAM_AGENT_UPDATE_RATE (60) per minute across the cluster, to agents whose policy has auto_update.
Matching and unmatched hosts
An enrolled agent is matched to its NetBox host by the rules on the NetBox page. An agent nothing matches appears under Agents → Unmatched, with a host of its own (source agent) visible only to unscoped users, until NetBox has the host (the next sync merges them) or an operator matches it by hand.
Revoking
Revoke on an agent (agents.manage) closes its connection on every node within 15 s and refuses its key forever. Queued inventory from it is dropped. To bring the host back, run structam-agent reset-identity on it and enrol again with a new token.
Questions the docs do not answer?
Ask the people who build Structam. Installation media and licences come from KazLabs.