This guide walks the two ways the goSignals CLI authenticates against a
server’s management plane:
login) — an interactive, docker login-style
browser flow (RFC 9728 Protected Resource Metadata → OAuth authorization
code + PKCE, RFC 7636) that produces a per-realm session. This is the path
for humans.I2SIG_BOOTSTRAP_TOKEN) — a shared secret that a
CI/automation context presents directly as a bearer to mint an issuer signing
key and an Initial Access Token (IAT). This is the path for scripts and the
demo compose stacks.[!IMPORTANT] The anonymous
/iatendpoint is closed. A request to/iat(or/key) with no usable bearer is rejected. Either log in (delegated OAuth) or present the bootstrap secret.
See security_model.md for the underlying auth model and
gosignals_tool.md for the full command reference.
This is the end-to-end path from a clean checkout.
make console-build # builds cmd/goSignals
# or:
go build -o goSignals ./cmd/goSignals
add server — connect onlyadd server is connect-only: it performs SSF discovery
(/.well-known/ssf-configuration), caches the advertised OAuth
authorization_servers from the server’s Protected Resource Metadata, and
records the server under a local alias. It mints no credential.
goSignals> add server gs1 https://goSignals1:8888
On success the CLI prints the discovered authorization server(s) and prompts you to log in:
Discovered authorization server(s): [https://keycloak:9080/realms/gosignals]
Run 'login gs1' to authenticate.
If the server advertises no authorization_servers, the CLI tells you to use
--bootstrap or --token instead (the non-interactive paths below).
login — browser PKCEgoSignals> login gs1
The CLI:
--issuer if several
are advertised) and the public client_id (advertised, or --client-id).Generates a PKCE code_verifier/code_challenge (S256) and a CSRF state,
starts an ephemeral 127.0.0.1 loopback listener, and opens your browser at
the authorization endpoint:
Opening browser to log in:
https://keycloak:9080/realms/gosignals/protocol/openid-connect/auth?...
On a headless host (no browser / no bindable loopback listener), or when you
pass --device, the CLI automatically falls back to the RFC 8628 device-code
flow, printing a verification URL and user code to complete on another device:
To complete login, on any device open:
https://keycloak:9080/realms/gosignals/device?user_code=ABCD-EFGH
Waiting for authorization...
Tokens are written to credentials.json (mode 0600) keyed by issuer, next
to config.json. The non-secret active issuer and advertised servers are cached
on the server record in config.json; tokens are never written to
config.json.
Logged in to gs1 as issuer=https://keycloak:9080/realms/gosignals subject=alice <alice@example.com> scopes=[...] expires=... clientId=gosignals-cli
whoami — show sessionsWith an alias, whoami shows the active realm session for that server:
goSignals> whoami gs1
With no alias, it lists every stored realm session (gcloud auth list-style),
including which configured server aliases trust each realm:
goSignals> whoami
2 active realm session(s):
issuer=https://keycloak:9080/realms/gosignals subject=alice <alice@example.com> scopes=[openid email profile] expires=... status=valid servers=[gs1]
Once logged in, management calls present the realm session’s access token as the bearer, silently refreshing it (RFC 6749 refresh-token grant) when expired:
goSignals> get stream config <streamAlias>
goSignals> create stream push receiver gs1 ...
If the session has expired and its refresh token is dead, the CLI surfaces a
clear “re-login required” message — run login gs1 again.
logoutA realm logout drops the session for that realm everywhere it is used:
goSignals> logout gs1 # the server's active issuer
goSignals> logout --issuer https://keycloak:9080/realms/gosignals
goSignals> logout --all # every stored realm session
Logout makes a best-effort RFC 7009 refresh-token revocation against the IdP,
deletes the local session, and clears the ActiveIssuer pointer on every server
that referenced that realm. An empty logout with no target is an error so you
never accidentally wipe every session.
credentials.json accumulates one session per issuer (realm). A single
server may trust several realms; login adds a session without disturbing
others. Which realm authorizes a call to a given server is resolved as:
ActiveIssuer pointer, when it has a live session; otherwiseSet the active realm explicitly with use server:
goSignals> use server gs1 --issuer https://keycloak:9080/realms/gosignals
A non-advertised issuer is accepted with a warning so manual overrides remain possible.
When there is no human and no browser — CI, the demo compose stacks, an
init container — use the shared bootstrap secret. Set
I2SIG_BOOTSTRAP_TOKEN on both the server (so it accepts the secret) and
the CLI’s environment (so it presents it).
On the server, a bearer that constant-time-equals I2SIG_BOOTSTRAP_TOKEN
resolves to the narrow key scope: enough to create a new issuer signing
key and obtain a reg-only IAT, but not to take over an existing key
(force=replace/rotate is denied) and not any stream/event capability.
When I2SIG_BOOTSTRAP_TOKEN is unset on the server, the bootstrap path is closed
and no bootstrap bearer is ever accepted (fail closed).
add server --bootstrap--bootstrap opts in to minting an IAT at add server time using the secret:
export I2SIG_BOOTSTRAP_TOKEN=dev-bootstrap-secret
goSignals> add server gs1 https://goSignals1:8888 --bootstrap
This presents Bearer $I2SIG_BOOTSTRAP_TOKEN to /iat, records the returned
reg-only IAT on the server entry, and skips client auto-registration.
--bootstrap errors out if I2SIG_BOOTSTRAP_TOKEN is unset.
create key and create iatcreate key and create iat present a bearer resolved as: a configured client
token if one exists, otherwise the I2SIG_BOOTSTRAP_TOKEN secret. With neither,
the (now non-anonymous) server rejects the request.
export I2SIG_BOOTSTRAP_TOKEN=dev-bootstrap-secret
goSignals> create key gs1 cluster.scim.example.com --file=issuer.pem
goSignals> create iat gs1
create key --alg picks the signature algorithm of the key: RS256, ES256
or ML-DSA-65; when omitted the server uses its I2SIG_KEY_ALG default
(ES256). It is sent as ?alg= and applies to --force=rotate and
--force=replace too, which act on that algorithm’s keys only — a plain
--force=replace replaces the default type’s keys and leaves the issuer’s
other keys in place. create key saves the new key’s kid (the server’s
Key-Id response header) to <file>.kid next to the PEM, and generate event
signs with the created key’s type and the kid the server reports for it. A stream with
signing_alg set never creates its key, so create it first:
goSignals> create key gs1 cluster.scim.example.com --alg=ES256 --file=issuer-es256.pem
The bootstrap key scope may create a key of any algorithm, but not rotate or
replace one.
This is exactly what the demo stacks do. The scimSsfSetup container exports
I2SIG_BOOTSTRAP_TOKEN and runs config/scim/scripts/auto-reg.gosignals:
add server gosignals1 https://goSignals1:8888
add server gosignals2 https://goSignals2:8889
create iat gosignals1 --output=/scim/iat-gosignals1.jwt
create bundle --output=/scim/spire-bundle.pem
create key gosignals1 cluster.scim.example.com --alg=RS256 --file=/scim/cluster-scim-issuer.pem
exit
| Scenario | Credential presented | Server-side scope |
|---|---|---|
login then management command |
Per-realm OAuth access token (from credentials.json) |
Whatever the IdP grants the user |
add server --bootstrap → IAT |
I2SIG_BOOTSTRAP_TOKEN secret |
key → mints reg-only IAT |
create key / create iat (no token) |
I2SIG_BOOTSTRAP_TOKEN secret |
key (create-only) |
create key / create iat (token) |
Stored ClientToken (--token/--client-secret) |
as the token’s scope |
add server --token / --iat |
Supplied admin token / IAT, stored on the server entry | as supplied |
There are six compose variants. All of them share the same auth model — the bootstrap secret is wired the same way; the SPIFFE variants add transport-layer mTLS that coexists with (and is independent of) the app-layer bootstrap secret.
| File | Adds over base | Login & bootstrap behavior |
|---|---|---|
docker-compose.yml |
Base demo: 2 goSignals nodes + goSsfServer, MongoDB replica set, Keycloak, Prometheus/Grafana, 2 i2scim nodes. |
goSignals nodes read I2SIG_BOOTSTRAP_TOKEN + I2SIG_CLI_CLIENT_ID from their config/*.env files; scimSsfSetup injects I2SIG_BOOTSTRAP_TOKEN and bootstraps via register.sh. Interactive login works against the gosignals Keycloak realm. |
docker-compose-dev.yml |
Dev image (i2gosignals-dev), source mounted, Delve on 2345/2346/2347, Loki/Alloy log stack. |
Same bootstrap secret; goSignals services additionally set I2SIG_BOOTSTRAP_TOKEN + I2SIG_CLI_CLIENT_ID inline in compose. Uses register-dev.sh. |
docker-compose-cluster.yml |
Nginx load balancer + redundant nodes (goSignals1, goSignals1b, goSignals2, goSsfServer) for HA; I2SIG_CLUSTER_NODE_ID per node. |
Same bootstrap model; scimSsfSetup injects I2SIG_BOOTSTRAP_TOKEN. Login flows route through the Nginx front door. |
docker-compose-cluster-dev.yml |
Cluster topology on the dev image; goSsfServer runs under Delve (dlv debug … :2345). |
Same as cluster, dev build. |
docker-compose-spiffe.yml |
SPIRE server/agent + workload registration; MongoDB and inter-node calls use SPIFFE X.509-SVID mTLS (SPIFFE_ENDPOINT_SOCKET, I2SIG_SPIFFE_TRUST_DOMAIN). |
SPIFFE secures the transport; the app-layer bootstrap secret is independent and still required to mint keys/IATs (I2SIG_BOOTSTRAP_TOKEN set in *-spiffe.env). The two coexist. |
docker-compose-spiffe-dev.yml |
SPIFFE topology on the dev image; Delve on 2345/2346/2347, goSsfServer under dlv debug, cluster-monitor via go run. |
Same as spiffe, dev build. |
[!NOTE]
I2SIG_BOOTSTRAP_TOKENdefaults todev-bootstrap-secretin the compose files (${I2SIG_BOOTSTRAP_TOKEN:-dev-bootstrap-secret}). This is a demo value — set a real secret in production and never commit it.
key scope, machine tiers.I2SIG_BOOTSTRAP_TOKEN, I2SIG_CLI_CLIENT_ID, I2SIG_IAT_LIFETIME.