Skip to content

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.

1 · Network & lockoutTLS and reverse proxy (yours), TrustedProxies, CORS closedby default, per-IP lockout: 10 failures in 5 minutesbans that address for 15 minutes.429 locked-out addressCross-origin browser callblocked by CORSpasses2 · Authentication - who are you?An AccessKey (Machine credential), or the session cookie ofsomeone signed in with a password or single sign-on.A wrong key counts toward the lockout; no credential at all does not.403 Forbiddenor the hub connection isclosedpasses3 · Door - which entry point?Management API, Console hubs, Consumer, or Edge / Package.A session only opens the Console doors; an Edge or packagekey only opens the door it was issued for.403 wrong doora session cannot pose asan Edge or a packagepasses4 · Scope - what kind of action?The identity must hold the scope the action needs:credentials:manage, packages:control, edge:connect,messages:execute...403 "requires the<scope> scope"passes5 · Authorization rules - on which target?Allow / Deny rules on the credential for messages, messagegroups and telemetry items (single sign-on users have none:their scopes are the only gate).403 on RESTdenied or ignored on the hubspassesAllowedAdministrative actions add guard rails on topScope delegation (you can only hand out scopes you hold), the last credential cannot be removed,a configuration change cannot revoke your own access, secrets are masked on read, and everystate-changing Management call is written to the Audit log with the caller's name.
#LayerQuestionEnforced byTune with
1Network & lockoutMay this address even try?Your TLS / reverse proxy, LoginAttemptLimiter, the CORS policylistenUrls, TrustedProxies, allowedOrigins
2AuthenticationWho is it?AccessKey check, or the session cookieCredentials page, Auth options
3DoorIs this the right entry point for this identity?Access class by path / hub; the credential assigned to an Edge or packageAn Edge's and a package's credential
4ScopeMay 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 hubsA credential's scopes, or roleMappings
5Authorization rulesOn this particular target?Authorizations on the credentialCredentials → 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 ​

DoorUsed byMachine keyAPI tokenPassword sessionSSO session
Management API (/rest/management)The Console, scriptsYes - any credential holding at least one scope, then the endpoint's own scopeSameYesYes
ControlHubThe Console's live viewYes (same rule)SameYesYes
ConsumerHub, /rest/consumerDashboards, the ConsoleYes - any enabled credential, then scopes and rulesSameYesYes
EdgeHubAn Edge processOnly the credential assigned to that Edge, with edge:connectNoNoNo
OrbitMeshHub, /rest/orbitmeshPackagesOnly the credential assigned to that package (or its Edge), with package:connectNoNoNo
The Developer edgeLocal developmentA key holding developerREST onlyNoNo
/packages/{file} (package zips)An Edge fetching its packagesThe Edge's own credential (EdgeName = that Edge, PackageName = Edge, with edge:connect), or any key holding packages:readWith packages:readWith packages:readWith 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 credentialAPI tokenHuman credentialSingle sign-on user
ForEdges and packages (the Server hands their key out when it launches them)Scripts, dashboards, kiosks calling the Console's APIsA person with a local accountA person signed in through Authelia
Proves itself withIts AccessKey, on every request or connectionIts token omk_<id>_<secret>, as the AccessKeyA password, once - then a sessionThe identity provider, once - then a session
Stored asAES-256-GCM in appsettings.json; the key is in keys/Only a SHA-256 hash - the token itself can't be recoveredA salted Argon2id hashNothing - its groups arrive with the sign-in
LastsUntil reset, disabled or removedUntil its expiry (optional), or disabled, rotated or removedSession: 30 min idle, 24 h at mostSame
Rights come fromscopes + authorizations of the credentialSameSame, read liveroleMappings of its groups; no per-target rules
Appears in the audit log asThe credential nameThe credential nameThe credential nameoidc:<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 pattern omk_[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:connect or package: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:

bash
curl -H "Authorization: Bearer omk_…" https://orbitmesh.example.com/rest/management/edges

A 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.

WhoHow it gets a tokenWhat the Server keeps
An EdgeSigns 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 packageIts Edge obtains the token for it (token exchange) and hands it over in the environment; the package renews it with a rotating refresh tokenNothing in the configuration; a refresh token used twice ends its chain
A script or a kioskA 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
json
"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.

RoleForHolds
Viewera personlooks, changes nothing: edges:read, packages:read, telemetry:read, schedules:read
Operatora personViewer, plus packages:control, messages:execute, telemetry:purge
Administratora personevery scope a person can hold (all but edge:connect and package:connect)
Integrationa script, a dashboardedges:read, packages:read, telemetry:read, messages:execute
Edgean Edge's own credentialedge:connect

A credential names its role, and may hold more scopes on top of it or lose some:

json
{ "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:

json
{
  "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:

Browserthe ConsoleOrbitMesh Serverconfidential clientAutheliaOpenID Connect provider① GET /rest/auth/oidc/login② 302 to the provider (+ PKCE)③ the user signs in there (password, 2FA...)④ 302 back with ?code=...⑤ GET /rest/auth/oidc/callback?code=...⑥ code + client secret + PKCE verifier⑦ ID token, then userinfo (groups)⑧ groups → scopes (role mappings)no mapped group = refused, otherwise a session starts⑨ session cookie + 302 to the Console

1. Register OrbitMesh in Authelia (configuration.yml; check the option names against the documentation of your Authelia version):

yaml
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_post

2. 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:

json
"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 Host header and list the proxy in OrbitMesh:TrustedProxies: the redirect URI sent to Authelia is built from them, and must match redirect_uris exactly.
  • Keep a local admin account as a way in if Authelia is down; auth.localLoginEnabled: false removes 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 /signalr and /rest with their AccessKey.

Guard rails on administration ​

  • Scope delegation. credentials:manage and configuration:write are 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:write is 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, /metrics and /packages can'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 Audit log 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 TrustedProxies and keep the original Host header: 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.json and the keys/ folder together. Without keys/credential-encryption.key the 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 needs telemetry:read, not more).
  • Restrict /metrics and keep secrets out of static sites.
  • Set UpdateOptions:PublicKeys so 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.