Authentication and tokens¶
Tokens¶
Admins create tokens under Settings, API tokens (/app/settings?s=tokens). Auditors see the
list but cannot create or revoke; the helpdesk role does not see the page.
- Name: up to 100 characters, shown in the audit log, for example
ticket system. - Role:
admin,helpdesk,auditorormetrics. A token can do what its role can do in the console.auditorandmetricstokens are always read only.metricstokens only read/metrics; every other path answers403. - Read only: an admin or helpdesk token that may only read.
- Valid for days: 1 to 365; every token expires.
- Scope tags: optional device tags (comma separated) for a
helpdeskorauditortoken, as for scoped console users (Tenants). A scoped token lists, reads and commands only devices with one of the tags (other devices answer404), sees only their audit entries and tags, and gets403on/metrics. Empty means every device (of the token's tenant). Directory group scopes exist for console users only. Admin and metrics tokens cannot be scoped. The tags are stored asscope_tagswith the token. - Tenant: a token created while switched to a tenant (or by a tenant admin) belongs to
that tenant (Tenants). It lists, reads and changes only that tenant's
devices, commands, library items, blueprints, tags and audit entries; shared library
items and blueprints of Default are readable, never writable; objects of other tenants
answer
404. Tokens created in the global view are global and see every tenant. Metrics tokens are always global (creating one in a tenant view is refused), and tenant tokens get403on/metrics. Tokens of a disabled tenant answer401(tenant disabled).
The token (lma_...) is shown once. The server stores only its SHA-256 hash, the first 12
characters for recognition, the creator, the expiry and the last use (updated at most once a
minute). The list shows each token as active, expired or revoked. Revoke ends a token at
once. A token keeps working when the admin who created it leaves; revoke it then.
Send the token as a bearer token. The API sets no cookies and reads none, so there is nothing for cross site requests to abuse.
Scopes¶
A token can further be limited to scopes (console form or scopes when created through the
API); without scopes it can do everything its role allows. read: the GET endpoints of
devices, commands, library items, blueprints and tags; commands: send device commands;
library: change library items, blueprints and devices; audit: the audit log; admin:
approvals, exceptions, tokens and tenants. A request outside the scopes answers 403 and is
audited as api.denied. A token with scopes creates only tokens limited to some of its own
scopes. Tokens are rotated by creating the successor and deleting the old
one (POST and DELETE /api/v1/tokens); they are valid for at most 365 days.
Roles¶
| Level | Roles | Endpoints |
|---|---|---|
| read | admin, helpdesk, auditor (read only tokens included) |
every GET except the audit log |
| audit | admin, auditor |
GET /api/v1/audit |
| helpdesk | admin, helpdesk, not read only |
POST /api/v1/devices/{id}/commands; the command type decides further |
| admin | admin, not read only |
PATCH, POST, PUT, DELETE on devices, library items, blueprints, exceptions, tokens and tenants; deciding approvals |
| metrics | metrics, admin, auditor; global and unscoped only |
GET /metrics |
Audit¶
Entries made through the API name the token as actor: api:<name>#<id>. Commands queued
through the API carry the same name as creator. In addition:
| Action | When |
|---|---|
api_token.create, api_token.revoke |
A token was created (detail: role, read only, days, prefix, scope tags) or revoked in the console |
api.auth_failed |
An unknown, expired, revoked or disabled tenant token was sent (detail: reason and client address) |
api.denied |
A valid token tried something its role, read only flag or scope does not allow (target: method and path) |
api.read |
A read through the API (target: method and path, detail: query). By default only the sensitive reads, GET /api/v1/audit and GET /api/v1/devices/{id}; LIMDM_AUDIT_API_READS=all records every read, off none (Environment variables) |
Audit entries in GET /api/v1/audit carry tenant_id when they belong to a tenant; it is
hashed after detail as a fifth chain field (Audit, notifications, approvals).
Limits¶
- 600 requests per minute and token; then
429withRetry-After: 60. - Failed authentications: 20 per client address and token in five minutes, as for SCIM, and
200 per client address; then
429withRetry-After: 300before the token is even checked. A script retrying a wrong token so locks out only that token, not valid tokens behind the same NAT. A request without any token counts but is not audited, and at most 30 failures a minute go to the audit log (the server log gets every one). - Request bodies up to 1 MiB; a larger body answers
400. - The console's network allow and block lists apply.