Skip to content

Let machines join with a trusted issuer

A trusted issuer lets a machine join a Guard network with a short-lived token that its own platform signed. No person signs in and no secret is stored on the machine. Any platform that issues OpenID Connect tokens to its workloads can be a trusted issuer: a Kubernetes cluster, a cloud’s workload identity, or a CI system.

Use an enrollment key when the machine has no such token.

  • Guard control plane 0.33.1 or later.
  • Guard client 0.24.0 or later on the machines that join, on Linux.
  • awctl 0.45.1 or later, the console, or Terraform provider resources authwise_guard_trusted_issuer and authwise_guard_trusted_issuer_rule.
  • A tenantAdmin or networkAdmin role on the Guard network, and a second factor on your account.
  1. The machine presents a token to Guard and names the network it joins.
  2. Guard finds the network’s trusted issuers whose address equals the token’s iss claim. If two issuers share an address, the token’s key id (kid) picks the one whose keys hold it.
  3. The token’s signature must verify with that issuer’s keys. Guard accepts tokens signed with RS256 or ES256.
  4. The token must be current, allowing 60 seconds of clock skew, and must live no longer than one hour from issue to expiry.
  5. The token’s aud claim must contain the network’s audience, guard:tenants/TENANT/networks/NETWORK. Guard shows the exact value on the trusted issuer.
  6. A rule of that issuer must name the token’s sub claim exactly. The rule decides the node’s name, its node group and whether it’s ephemeral, and it stops admitting at its maximum nodes.

A token that fails any step is refused. The machine is told only that the join was refused. The network’s activity says which check failed.

A machine whose key is already a node of the network rejoins as that node. Nothing new is created.

Terminal window
awctl guard context set --tenant TENANT --network NETWORK
awctl guard trusted-issuers create --display-name build-system \
--issuer https://issuer.example.com --discover
awctl guard trusted-issuers describe build-system

The issuer’s keys come from one of three places:

SourceUse it whenFlag
DiscoverThe issuer is at a public https address that the Guard control plane can reach. Guard reads the issuer’s OpenID Connect discovery document and follows key rotations by itself: a new key is picked up at the first join that uses it, or within five minutes.--discover
UploadThe control plane can’t reach the issuer. Upload the issuer’s JWKS document, and upload it again when the keys rotate. At most 16 keys and 64 KiB. Each key needs a key id and must be RSA of 2048 bits or more, or EC P-256.--keys-file jwks.json
A key-source nodeThe control plane can’t reach the issuer, and a node of the network runs where the issuer is. The node reports the keys when they change.--key-source-node NODE

An issuer’s address never changes. A trusted issuer is revoked, never deleted:

Terminal window
awctl guard trusted-issuers revoke build-system

Revoking stops new joins. Nodes that have joined stay until you remove them. A revoked issuer can’t be changed or restored, and it keeps its name. Create a new one under a different name.

Nothing joins until a rule admits its subject.

Terminal window
awctl guard trusted-issuers rules create build-system \
--subject ci-runner \
--node-name-prefix ci \
--node-group ci \
--ephemeral
awctl guard trusted-issuers rules list build-system
SettingMeaning
SubjectThe token’s sub claim, matched exactly. There are no patterns, so a rule admits one identity.
Node name prefixA DNS label of up to 32 characters. Nodes are named PREFIX-NAME, where the machine supplies NAME. Without a prefix, the trusted issuer’s display name is used. If the name is taken, Guard adds a number.
Node groupEvery node the rule admits joins this group. The group’s grants decide what the node can reach, and the resources the group serves are served by the node.
EphemeralThe node is removed when the client leaves at a clean stop, or after about an hour offline. Use it for machines that come and go. The same machine can join again afterwards. A node keeps the setting its rule had when it joined.
Maximum nodesHow many nodes the rule may hold at once, from 1 to 1000. The default is 100. A join past it is refused until a node is removed or you raise the maximum.

A rule’s subject never changes. Its other settings apply to joins from then on: changing a rule’s node group doesn’t move nodes that have already joined. Deleting a rule stops new joins and leaves the nodes that joined.

Token joins use awguard run, the foreground form of the client, on Linux as root. The platform writes the machine’s token to a file:

Terminal window
sudo awguard run --address guard.example.com \
--network tenants/TENANT/networks/NETWORK \
--identity-token-file /var/run/secrets/tokens/guard

--network is required with a token, because a token names no network. Run the command under systemd or another supervisor. Unlike awguard up, it doesn’t install a service.

The client reads the token once, to join, when it starts with no node state. After that the node keeps itself joined with its own credential, so the token only has to be valid when the machine first joins. Keep the state directory, /var/lib/awguard: a machine that loses it joins again with whatever token is in the file then.

Add --leave-on-stop for a machine that comes and goes, so that its ephemeral node is removed at a clean stop.

On Kubernetes, the Guard operator does all of this for a labelled pod.

Name a node of the same network that runs beside the issuer. The node must be persistent, and it must not have joined through this issuer. A node that joined with an enrollment key that isn’t ephemeral qualifies. An issuer that uses discover can’t have a key source.

Terminal window
awctl guard trusted-issuers update build-system --key-source-node NODE

NODE is the node’s name or its id.

Only that node’s reports are accepted, and only for the issuers that name it as their key source. A report from any other node is refused and recorded in the network’s activity. So is a report of a key id that another issuer at the same address already holds.

Guard holds a report that would remove every key the issuer has. Joins continue with the stored keys, and describe shows the held keys. Accept them once you know the change is real:

Terminal window
awctl guard trusted-issuers update build-system --adopt-held-keys

Uploading keys, or changing the key source, discards a held report. To stop using a key source, set it to nothing: --key-source-node "".

On every production install, these changes ask you to sign in again with a second factor first:

  • creating, changing or revoking a trusted issuer, including its key source;
  • creating, changing or deleting a rule;
  • creating or revoking an enrollment key;
  • issuing a join code for a node, or registering a server node without its public key.

The console asks at the moment you make the change and returns you to it. awctl stops with STEP_UP_REQUIRED and prints the sign-in to run:

Terminal window
awctl auth login --acr-values "urn:authwise:acr:2 phr phrh"

If you normally sign in with --issuer and --client-id, add the same two flags here.

Reading never needs it. A service account, such as the one Terraform uses, is exempt. Approving a person’s own device isn’t in this list.

An enrollment key is a secret that admits machines with no token of their own: a fleet image, an autoscaling group, or the Guard operator’s connectors.

Terminal window
awctl guard enrollment-keys create --description "web tier" \
--max-uses 20 --ttl 30d --node-group web --out web.key
Trusted issuerEnrollment key
What the machine holdsA token its platform renewsA secret you distribute
Who may joinOne identity per ruleAnyone holding the key, up to its uses
LifetimeUntil you revoke the issuer or delete the rule1 to 90 days
To rotateNothingCreate a new key and replace it everywhere

The key’s secret is shown once. Give it to machines in a file or the environment, never on a command line. A key is never changed. revoke stops further joins and leaves the nodes that joined.