Skip to content
Endpoint ManagementMarkdown

Device enrollment

A device joins your realm once, with a one-time token, and gets a certificate from the realm's own authority for a key that never leaves it.

AvailableAPIRFC 8446, RFC 2986

Enrollment is how a laptop or server becomes one of your realm’s devices. You make a one-time token; the device spends it. The device comes away with its own key, a certificate naming it within your realm, and its security sensor registered with the realm’s security log. It needs nothing else to connect from then on.

You enroll each device once, and again before its certificate’s year is up. A lost or replaced device is revoked or removed, and a new one enrolled with a new token; see Device revocation and Device removal.

  • Privilege: making a token needs MODIFY on the realm’s endpoint settings, which RealmOwner holds, in the realm or a realm above it (Who can call).
  • Where: tokens are made through the API; the device is enrolled on the device itself, by someone with administrator rights on it.
  • What you need: the package for the device’s platform and the device address (a host and port), both from whoever runs your deployment; your realm’s sign-in address, https://foobar.cvyuh.com/oauth2; and outbound access from the device to the device address (Network).
  1. You make a token. A realm administrator asks for an enrollment token. The token is signed by your realm, lasts as long as you asked, and lets the device check it is talking to your realm on its first call.
  2. The device makes its key. The device client makes a key pair, keeps the private key on the device, and saves it before it calls, so an interrupted enrollment retries over the same key instead of making a second one.
  3. The device spends the token. It sends the token and a certificate request (RFC 2986) for its key. The realm checks the token, checks the realm still has room under its device limits, registers the device’s security sensor, records the device, and has the realm’s certificate authority sign the request.
  4. The device gets its grant. It receives its certificate and the authority’s chain, and its sensor’s registration. From then on it opens one connection to the realm, authenticated by that certificate on both ends (mutual TLS, RFC 8446).

Each realm has its own certificate authority; its signing key never leaves the realm’s key store. A device’s certificate names the device and your realm and lasts 365 days.

  1. Make a token, as a realm administrator (Call the API shows how to get $CVYUH_SESSION):

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/endpoint/ppm/v1/enrolment-tokens \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{"ttlHours": 4}'

    The realm answers 201 with token and expiresAt. Leave out ttlHours for the realm’s default lifetime. The address ends in enrolment-tokens, spelled that way.

  2. On the device, install the package, then run the device client’s enroll command with the token, the device address and the sign-in address:

    Terminal window
    sudo /var/cvyuh/bin/cvyuh-uem enroll \
    --server <device address> --token <enrollment token> \
    --issuer https://foobar.cvyuh.com/oauth2

    The command is named for your deployment: cvyuh-uem in these examples. It’s in the bin folder of the install folder, /var/cvyuh on Linux and /Library/Cvyuh on macOS.

  3. Start the device client if it isn’t running (Device client).

Get started with Endpoint Management walks through it end to end, and Enroll a device at install has the installer do it.

On success, enroll prints the name the device was enrolled as and the date to enroll it again before:

enrolled maya-laptop as <certificate name> against <device address>; enrol again before <RFC 3339 time>

On a refusal it prints enrol failed: enrol refused, then the status and the realm’s reason, and exits with an error:

enrol failed: enrol refused, 409 Conflict: {"code":"DISABLED","message":"the realm enrols its most devices, 100","detail":null}

A refused enrollment doesn’t spend the token. Fix the cause and run enroll again with the same token while it lasts; a refusal at the device cap or a failure on the realm’s side hands the token back too.

StatusThe reason saysWhat it meansWhat to do
401the token is already spentAnother device, or this one with a new key, already enrolled with itMake a new token
401the token has expiredIts lifetime ran out before it was spentMake a new token, with a lifetime long enough to install
401the token is malformedIt was cut short or changed on the wayCopy it again, whole
401the token names another realm, is unknown, pins another authority, or names no realm served hereThe token isn’t one this realm made, or the device address is another deployment’sCheck the device address, then make a new token in the right realm
400`<name>` is not an endpoint nameThe name breaks the naming rulePass --name with a name that keeps to it
409the realm enrols its most devices, <cap>The realm is at its device capRemove a device you no longer need, or ask a root realm administrator to raise the cap
409That the name is already heldAnother device enrolled under the same name, often this device’s own earlier enrollmentEnroll under another name, or remove the old record first
503this enrolment is in flight; ask againThe same device’s first try is still being madeRun enroll again in a moment
WhatDefaultRangeSet by
Token lifetime24 hours1 hour to the realm’s setting, at most 168Device limits
Devices a token enrollsOneFixed
Devices in the realm1001 and upA root realm administrator (Device limits)
Certificate lifetime365 daysFixed
Device nameThe host name1 to 64 letters, digits, -, _ and .--name
SymptomCauseFix
enroll prints its usage and stopsThe device address, token or sign-in address is missingPass --server, --token and --issuer, or set their variables
enrol failed: with a connection error, before any statusThe device can’t reach the device address, or a proxy or a TLS-inspecting firewall stands in the wayCheck the address and port, and open a direct outbound path (Network)
the issuer ... is not an https URLThe sign-in address is mistypedUse https://foobar.cvyuh.com/oauth2
already spent on a token no one here has usedSomeone else enrolled a machine with itTreat it as leaked: list the realm’s devices, revoke or remove the one you don’t expect, and make a new token
The device enrolled but never shows connectedThe device client isn’t running, or can’t reach the device addressSee the device client’s Troubleshooting

Making a token writes nothing to the realm’s audit trail: keep your own note of whom you gave each token to. The device’s record being made is recorded on the trail as a change (CREATED); see What is recorded.

  • One use. A token enrolls one device. A token that has been spent, or has expired, enrolls nothing. A retry by the same device, over the same key, gets the same grant back.
  • One realm. A token enrolls a device only into the realm it was made for.
  • A token can’t be withdrawn. Once made, it lasts until it’s spent or expires. If one leaks, lower the realm’s token lifetime, watch the realm’s devices for one you don’t expect, and remove it.
  • Made on your session. A token is made on the administrator’s own session, never on a service’s credentials.
  • The private key never leaves the device. The realm sees only the certificate request.
  • The sensor needs no secret of its own. The realm registers the sensor and keeps the key its messages are sealed under; see Sensor registration.
  • Linux and macOS. Packages exist for Linux (deb and rpm, on amd64 and arm64) and macOS; Windows is planned.
  • A year, then enroll again. Renewal is planned. Until then, enroll the device again before the date enroll printed. Enrolling again makes a new record; the old one stays, and counts toward the device cap, until you remove it. The date is printed by enroll; the realm doesn’t show it yet. See Enroll a device again.
OptionEnvironment variableWhat it is
--serverCVYUH_SERVERThe device address, a host and port
--tokenCVYUH_TOKENThe enrollment token
--issuerCVYUH_ISSUERYour realm’s sign-in address, https://foobar.cvyuh.com/oauth2
--issuer-caCVYUH_ISSUER_CAA file holding the certificate authority the sign-in address’s certificate chains to, when it isn’t a public one
--nameCVYUH_NAME, at install onlyThe device’s name; the host name by default

The variables are named for your deployment too: its name in capitals, then _SERVER and the rest.