Access control
Every connection - Edge, package, dashboard, REST call, or a person in the Console - goes through the same short chain of checks. This page shows the chain first, then each link in detail.
The layers at a glance
A request has to get past five checks, in this order. Each can refuse it; the first refusal ends it.
| # | Layer | Question | Enforced by | Tune with |
|---|---|---|---|---|
| 1 | Network & lockout | May this address even try? | Your TLS / reverse proxy, LoginAttemptLimiter, the CORS policy | listenUrls, TrustedProxies, allowedOrigins |
| 2 | Authentication | Who is it? | AccessKey check, or the session cookie | Credentials page, Auth options |
| 3 | Door | Is this the right entry point for this identity? | Access class by path / hub; the credential assigned to an Edge or package | An Edge's and a package's credential |
| 4 | Scope | May it do this kind of action? | RequiresScope on each Management endpoint, a check in each ControlHub method, edge:connect / package:connect / messages:execute on the other hubs | A credential's scopes, or roleMappings |
| 5 | Authorization rules | On this particular target? | Authorizations on the credential | Credentials → Authorizations |
Layers 4 and 5 are the same two-level model as AWS IAM: a scope authorizes an action class, a rule restricts the target.
Who can use which door
| Door | Used by | Machine key | API token | Password session | SSO session |
|---|---|---|---|---|---|
Management API (/rest/management) | The Console, scripts | Yes - any credential holding at least one scope, then the endpoint's own scope | Same | Yes | Yes |
ControlHub | The Console's live view | Yes (same rule) | Same | Yes | Yes |
ConsumerHub, /rest/consumer | Dashboards, the Console | Yes - any enabled credential, then scopes and rules | Same | Yes | Yes |
EdgeHub | An Edge process | Only the credential assigned to that Edge, with edge:connect | No | No | No |
OrbitMeshHub, /rest/orbitmesh | Packages | Only the credential assigned to that package (or its Edge), with package:connect | No | No | No |
The Developer edge | Local development | A key holding developer | REST only | No | No |
/packages/{file} (package zips) | An Edge fetching its packages | The Edge's own credential (EdgeName = that Edge, PackageName = Edge, with edge:connect), or any key holding packages:read | With packages:read | With packages:read | With packages:read |
Each hub is authorized when its connection is negotiated, by the same door rules: a caller that is refused gets an HTTP 403 (429 while its address is locked out) and never a connection.
A few doors are open on purpose, each bounded: /rest/enroll (an Edge asking to be approved), /rest/management/setup/* (first run only), /rest/auth/* (sign-in), static sites under a FileServers path, and /metrics (Prometheus). Anything you don't want public - /metrics, or a site that stores a key in its own config file - belongs behind localhostOnly, your reverse proxy or a firewall.
Four kinds of identity
| Machine credential | API token | Human credential | Single sign-on user | |
|---|---|---|---|---|
| For | Edges and packages (the Server hands their key out when it launches them) | Scripts, dashboards, kiosks calling the Console's APIs | A person with a local account | A person signed in through Authelia |
| Proves itself with | Its AccessKey, on every request or connection | Its token omk_<id>_<secret>, as the AccessKey | A password, once - then a session | The identity provider, once - then a session |
| Stored as | AES-256-GCM in appsettings.json; the key is in keys/ | Only a SHA-256 hash - the token itself can't be recovered | A salted Argon2id hash | Nothing - its groups arrive with the sign-in |
| Lasts | Until reset, disabled or removed | Until its expiry (optional), or disabled, rotated or removed | Session: 30 min idle, 24 h at most | Same |
| Rights come from | scopes + authorizations of the credential | Same | Same, read live | roleMappings of its groups; no per-target rules |
| Appears in the audit log as | The credential name | The credential name | The credential name | oidc:<login> |
A Machine key is shown once, when created or reset. It can authenticate an Edge, a package or a script, but it can never be used to sign in to the Console.
API tokens
Prefer an API token to a Machine key for anything that is not an Edge or a package. Create one on the Credentials page (kind API token): the Server generates it, shows it once, and keeps only its hash. Compared with a Machine key:
- It is recognisable: the fixed
omk_prefix lets a secret scanner flag a token that leaks into a repository or a log. On GitHub, add the patternomk_[0-9a-f]{16}_[A-Za-z0-9_-]{43}as a custom secret-scanning pattern. - It is found by its public id (
omk_<id>_…), so you can tell which token an alert is about, and checking it costs one hash instead of a decryption per credential. - It can expire, can be rotated (new secret, old one dead at once, same name, scopes and rules) and revoked on its own like any credential.
- It can never hold
edge:connectorpackage:connect, and it is refused at an Edge's or a package's own door.
Send it the standard way, as a bearer token, and nothing else:
curl -H "Authorization: Bearer omk_…" https://orbitmesh.example.com/rest/management/edgesA caller that presents a key and names neither EdgeName nor PackageName is judged at the door of the endpoint it calls (/rest/management, /rest/controller or /rest/consumer) - it could have named that door itself, so nothing is widened. Edges and packages still name themselves (which Edge's door is it?), and a browser session keeps sending its identity headers. The older forms keep working: the AccessKey header or query string, with EdgeName and PackageName; when both an AccessKey and a bearer token are sent, the AccessKey is the one used. On a SignalR hub URL, the access_token query parameter that SignalR sends where a transport can't set headers is accepted too - but not on REST URLs, where a key would end up in logs.
Existing Machine keys keep working; nothing is migrated.
Access tokens (OAuth)
Beside the keys above, the Server is its own authorization server (OAuth 2.1 / OpenID Connect). A caller gets a short access token (a JWT, ten minutes by default) from /connect/token and sends it as Authorization: Bearer <token> wherever it would send a key. The token says who the caller is; what it may do is still the credential the configuration assigns to it.
| Who | How it gets a token | What the Server keeps |
|---|---|---|
| An Edge | Signs a short assertion with its own private key (private_key_jwt). It creates the key pair on first start and is approved from the Console like any new Edge. | Edges[].PublicKey - nothing that could be used to pose as the Edge |
| A package | Its Edge obtains the token for it (token exchange) and hands it over in the environment; the package renews it with a rotating refresh token | Nothing in the configuration; a refresh token used twice ends its chain |
| A script or a kiosk | A key pair (client_credentials), or the device flow: the screen shows a code and an administrator approves it in the Console (Credentials > Authorize a device) | An entry of Auth:OAuth:Clients |
| A person (the Console) | The Console sends the browser to the Server's own sign-in page (a local account, or single sign-on) and comes back with a short token - the standard authorization-code flow with PKCE. It never sees the password and keeps the token in memory only. | The person's session, which the token is bound to |
"Auth": {
"OAuth": {
"AccessTokenMinutes": 10,
"Clients": [
{ "ClientId": "kiosk", "AllowDeviceFlow": true, "Scopes": ["telemetry:read", "messages:execute"] }
]
}
}An Edge with an empty Edge:OrbitMeshAccessKey uses a key pair; with a key configured it works as it always did.
The configuration is the authority. Remove an Edge's public key, an Edge, a package or a client and its tokens stop working at once, its open connections are closed within half a second, and it cannot renew. A connection renews its token on the open connection (no disconnection); one whose token ends without being renewed is closed.
The keys and the token database are in data/: not backed up, not needed - lose it and every client asks for new tokens. A self-update carries it over.
Roles
A role is a ready-made set of scopes, so that nobody has to tick seventeen boxes to make a read-only account.
| Role | For | Holds |
|---|---|---|
Viewer | a person | looks, changes nothing: edges:read, packages:read, telemetry:read, schedules:read |
Operator | a person | Viewer, plus packages:control, messages:execute, telemetry:purge |
Administrator | a person | every scope a person can hold (all but edge:connect and package:connect) |
Integration | a script, a dashboard | edges:read, packages:read, telemetry:read, messages:execute |
Edge | an Edge's own credential | edge:connect |
A credential names its role, and may hold more scopes on top of it or lose some:
{ "name": "alice", "kind": "Human", "role": "Operator", "scopes": ["credentials:read"], "deniedScopes": ["telemetry:purge"] }A single-sign-on mapping names a role the same way: { "group": "orbitmesh-ops", "role": "Operator" }.
The role is not copied into the account: it is looked up when a request is checked, so an account follows a role that a newer Server changes. A credential with no role holds exactly its scopes, as every credential did before roles. deniedScopes wins over both. The Edge role is refused to a person and to an API token, and giving someone a role needs every scope the role comes to (see Guard rails).
Scopes
A credential holds a list of named scopes (PAT-style, like a GitHub token): edges:read, packages:manage, credentials:manage, updates:manage, and so on. See OrbitMeshScope for the full list. Each scope gates one slice of the Management API/ControlHub - or, for three scopes below, the base Edge/package/consumer protocol itself.
An Edge's own credential needs edge:connect just to open its connection to EdgeHub; a package's own credential needs package:connect to open its connection to OrbitMeshHub, and messages:execute to send a message from SendMessage (a Console/Consumer credential needs the same scope to invoke a message handler via ConsumerHub/the REST SendMessage endpoint). Without the matching scope, Authorizations below is never even consulted - a credential missing edge:connect/package:connect can't connect at all, regardless of what its Authorizations say. A package's own credential gets both scopes automatically (EnsurePackageCredential, re-applied on every deploy or Groups change); an Edge approved from the pending list gets edge:connect the same way. Every other scope is purely admin-facing.
Authorization rules
authorizations is a finer-grained layer underneath scopes: per-target Allow/Deny rules for messages, groups and telemetry items. Same two-level model as AWS IAM - a scope authorizes the action class, a rule restricts the target.
Each package gets its own auto-provisioned Machine credential instead of sharing its Edge's. It defaults to Deny on all three, with just enough Allow rules to reach its own edge/package's telemetry, its own configured groups, and messages addressed to itself:
{
"name": "salon.DayInfo",
"accessKey": "ENC$...",
"kind": "Machine",
"scopes": ["package:connect", "messages:execute"],
"authorizations": {
"messages": {
"defaultAuthorization": "Deny",
"rules": [
{ "authorization": "Allow", "scope": "Package", "args": "DayInfo" },
{ "authorization": "Allow", "scope": "Edge", "args": "salon" }
]
},
"groups": { "defaultAuthorization": "Deny", "rules": [] },
"telemetryItems": {
"defaultAuthorization": "Deny",
"rules": [{ "authorization": "Allow", "edgeName": "salon", "packageName": "DayInfo", "name": "*" }]
}
}
}Reaching another package's telemetry, or sending it a targeted message, needs an explicit Allow rule on that credential (Console → Credentials → Authorizations). Broadcasting to everyone (All/Others message scope) needs one too.
Signing in to the Console
Machine callers (Edges, packages, dashboards such as the kiosk) present their AccessKey as ever. People don't: the Console signs in with a username and password and gets a session - an opaque token in an HttpOnly, SameSite=Strict cookie that scripts can't read, kept server-side as a hash. It expires after 30 minutes without use (OrbitMesh:Auth:SessionIdleMinutes) and after 24 hours at the most (SessionMaxHours), ends when you sign out, and is cut if the account is disabled, removed or has its password reset. The Console only works from the Server's own origin.
An account created by an earlier version keeps working; its stored hash is upgraded the first time it signs in.
Single sign-on with Authelia (OpenID Connect)
Instead of (or besides) local accounts, the Console can sign people in through an OpenID Connect provider. This is written for Authelia; any provider that supports the authorization-code flow with PKCE and returns a groups claim works.
How the exchange runs:
1. Register OrbitMesh in Authelia (configuration.yml; check the option names against the documentation of your Authelia version):
identity_providers:
oidc:
clients:
- client_id: orbitmesh
client_name: OrbitMesh
client_secret: '$pbkdf2-sha512$...' # the hash of the secret you put in OrbitMesh below
public: false
authorization_policy: two_factor
redirect_uris:
- https://orbitmesh.example.com/rest/auth/oidc/callback
scopes: [openid, profile, email, groups]
response_types: [code]
grant_types: [authorization_code]
require_pkce: true
pkce_challenge_method: S256
token_endpoint_auth_method: client_secret_post2. Configure the Server. In the Console, open Administration → Single sign-on: it has every setting below, shows the redirect URI to register at the provider, and keeps the client secret masked. Or edit appsettings.json (section OrbitMesh) by hand:
"auth": {
"oidc": {
"enable": true,
"displayName": "Authelia",
"authority": "https://auth.example.com",
"clientId": "orbitmesh",
"clientSecret": "the-plain-secret",
"roleMappings": [
{ "group": "orbitmesh-admins", "scopes": [ "*" ] },
{ "group": "orbitmesh-viewers", "scopes": [ "edges:read", "packages:read", "telemetry:read" ] }
]
}
}displayName is the name in the sign-in button ("Sign in with Authelia"; "SSO" if left out). clientSecret can also come from the OrbitMesh__Auth__Oidc__ClientSecret environment variable. Restart the Server after changing the provider settings; role mappings apply immediately.
Who gets what. A user is given the union of the scopes of every mapping whose group they belong to ("*" means every scope a person can hold - all but edge:connect and package:connect, which belong to Machine credentials); a user in none of them is refused. Mappings are read live, so editing one applies to sessions already open. These users appear as oidc:<login> in the audit log, have no credential entry, and are not subject to per-credential authorizations rules (scopes are the gate).
Things to know.
- Behind a reverse proxy, keep the original
Hostheader and list the proxy inOrbitMesh:TrustedProxies: the redirect URI sent to Authelia is built from them, and must matchredirect_urisexactly. - Keep a local admin account as a way in if Authelia is down;
auth.localLoginEnabled: falseremoves the password form. - With single sign-on enabled there is no first-run "create the admin" step - the groups decide.
- Don't put the Console behind Authelia's forward-auth at the proxy as well: Edges, packages and dashboards must reach
/signalrand/restwith their AccessKey.
Guard rails on administration
- Scope delegation.
credentials:manageandconfiguration:writeare not root: you can only create or change a credential (or a role mapping) whose scopes you hold yourself, and you can't edit or remove a credential carrying scopes you don't hold. - The last credential can't be removed, so the Server can't be put back in first-run state through the API.
- No self-lockout through the configuration editor: a change that would remove your own
configuration:writeis refused (for single sign-on users too, judged on their groups). - Secrets are masked on read (
********): credential keys and hashes, the update token, NuGet feed keys, secret variables, Password settings, the single sign-on client secret. Saving the placeholder back keeps the stored value. - Plaintext keys and reserved paths are refused by the configuration editor (
/rest,/signalr,/metricsand/packagescan't be hijacked by a file server). - Everything is audited: each state-changing Management call, every sign-in, refusal and sign-out, goes to the
Auditlog category with the caller's resolved name and address.
Deployment checklist
- Serve over HTTPS (a TLS reverse proxy or Kestrel itself). Without it AccessKeys and passwords cross the network in clear and the session cookie can't be marked
Secure. - Behind a proxy, list it in
TrustedProxiesand keep the originalHostheader: the lockout,localhostOnly, and the single sign-on redirect address all depend on it. - Create the first admin right away (or configure single sign-on, which closes that step).
- Back up
appsettings.jsonand thekeys/folder together. Withoutkeys/credential-encryption.keythe Machine keys can't be read back;keys/also holds the sessions and the single sign-on state, so keep its permissions tight. - Use API tokens, with an expiry, for scripts, dashboards and kiosks - keep Machine keys for Edges and packages.
- Give each Machine credential or token only the scopes it needs, and tighten its
authorizations(a dashboard that only displays telemetry needstelemetry:read, not more). - Restrict
/metricsand keep secrets out of static sites. - Set
UpdateOptions:PublicKeysso self-updates are verified.
The full list of what is and isn't protected, with the known limitations, is in SECURITY.md; the HTTPS and proxy setup is in Running Server & Edge.