Signed commands
Migrated page, not yet verified against the current code. Treat values, paths and examples as indicative until this notice is removed.
A tag write sent on the NATS subject uns.command.write is an external write. External writes also include API callers that are not a person’s login session, such as the AI co-pilot, and AI agents.
An external writer must sign a write when either of these is true:
- the tag’s
esign_externalattribute is set (on its driver tag mapping or its local-tag definition); - a screen button that writes the tag asks for an e-signature.
A tag whose button asks only for a confirmation also needs a signed command, because a command cannot show a dialog. Operators in the HMI follow the screen’s buttons only.
A button with confirmation Variable asks for a confirmation while its interlock tag is active. The interlock counts as inactive only when its tag exists, its quality is Good and its value is exactly 0. A missing interlock tag (renamed, deleted or mistyped) counts as active. So does one with Bad or Uncertain quality, including when the runtime is stopped. The refusal (confirmation_required, audited as WRITE_DENIED_CONFIRMATION_REQUIRED) names the first interlock that requires the confirmation, and the reason:
| Reason in the refusal | Meaning |
|---|---|
interlock <path> missing |
No tag has this path. Fix the button’s interlock tag. |
interlock <path> quality <quality> |
The tag’s quality is not Good, so its value cannot be trusted. |
interlock <path> active |
The tag is Good and its value is not 0. |
A signed write (a person’s signature or a signed command) counts as a confirmation. GET /api/security/write-policy lists both the screen requirements and the esign_external tags.
Command
Section titled “Command”{ "path": "Plant/Processing/AreaA/Tank1/Setpoint", "value": 42.5 }An unsigned command writes only tags that need no signature. If you send the command as a NATS request (with a reply subject), the reply is {"ok": true} or {"ok": false, "error": "..."}. A plain publish (no reply subject) gets no answer, so its outcome is not guaranteed to reach you: use a request.
In an HA pair only the primary with quorum is in the command queue group, so the brokers route every command to it. A starting HA node takes no command until it is the primary. A command that reaches a node that may not dispatch (at a switch-over) is refused and answered, never dropped: send it again. When no node dispatches, a request gets the broker’s “no responders” error. See Hardware command subject.
A command that contains a password field is always refused, whatever the tag. The refusal is audited as NATS_COMMAND_PASSWORD_REJECTED. The value is never read, logged or checked, so it never counts toward an account lockout.
Signed by a person: one-time ticket
Section titled “Signed by a person: one-time ticket”- Product
- Data store
- Device or controller
- Person or role
- Data or telemetry
- Command to equipment
- Authentication
- Refusal
Read as text
The person asks eaxScada for a ticket over HTTPS, in their own session, with their password and the tag and value to write. eaxScada checks the person, records the signature and answers with a ticket that is good for 60 seconds, once, for that tag and value. The command sent on NATS carries the ticket. eaxScada runs the write checks, redeems the ticket, records it, writes the value and then records the write under the person's name. A node that may not write (in an HA pair, any node but the primary with quorum, or a node whose writes are off) drops the command without a reply.
Participants
- Person (person or role): own session
- eaxScada (product): server
- Audit records (data store)
- Controller (device or controller): PLC or device
Steps, in order
- Person → eaxScada (authentication): POST /api/auth/signature-ticket. password, meaning, path, value
- eaxScada: Checks, in order: a signed-in person: not the AI co-pilot, not an API token; the person may write this tag; the account is not locked or disabled; the password is correct
- A check fails:
- eaxScada → Person (refusal): Refused: signature_refused. no ticket
- Every check passes:
- eaxScada → Audit records (data or telemetry): ESIG_VERIFIED, ESIG_TICKET_ISSUED. Access audit, first: no record, no ticket
- eaxScada → Person (reply): Ticket est_.... 60 s, one use: this person, path, value, meaning
- Person → eaxScada (command to equipment): uns.command.write. on NATS: path, value, ticket
- eaxScada: Checks, in order: the runtime is running; this node may write: else dropped, no reply; no password field in the command; the tag exists; limits, engineering range, interlocks; signed one way only: no signer or sig beside the ticket; the ticket: known, unused, in time, same path and value; the signer: still active, still allowed to write the tag
- A check fails:
- eaxScada → Person (refusal): Refused: {"ok": false, "error": ...}. nothing written; a ticket that fails its check is used up
- Every check passes:
- eaxScada → Audit records (data or telemetry): ESIG_TICKET_REDEEMED. Access audit, first: no record, no write
- eaxScada → Controller (command to equipment): Writes the value. through the driver
- eaxScada → Audit records (data or telemetry): NATS_COMMAND_SIGNED. ledger, after the write; _FAILED if it failed
- eaxScada → Person (reply): {"ok": true}. when the command was sent as a request
-
The person requests a ticket over HTTPS, with their own login session:
POST /api/auth/signature-ticket{ "password": "...", "meaning": "Start feed from MES", "path": "Plant/Processing/AreaA/Tank1/Setpoint", "value": 42.5 }- The server checks the password the same way as any e-signature: lockout applies, and the check writes
ESIG_VERIFIEDandESIG_TICKET_ISSUED. - The person must be allowed to write the tag.
- The AI co-pilot account never gets a ticket.
- The reply is
{"ticket": "est_...", "expires_at": "...", "path": "...", "value": "42.5", "meaning": "..."}. - A refusal carries
"status": "signature_refused":403for a wrong password, an unknown or disabled signer, the AI co-pilot, an API token or a tag the person may not write;429while the account is locked (the fifth wrong password locks it for 15 minutes);400for a missing password or field;503when no ticket can be handed out.401("code": "no_session") only means the request has no session: sign in again.
- The server checks the password the same way as any e-signature: lockout applies, and the check writes
-
The command carries the ticket:
{ "path": "Plant/Processing/AreaA/Tank1/Setpoint", "value": 42.5, "ticket": "est_..." }
How a ticket behaves:
| Property | Value |
|---|---|
| Entropy | 256 bits, random |
| Lifetime | 60 s |
| Uses | one |
| Bound to | person, path, value, meaning |
| Stored | SHA-256 of the ticket only |
| Mismatch (path, value), expired, unknown | refused, ESIG_TICKET_REJECTED; the ticket is burnt |
| Ledger row of the write | NATS_COMMAND_SIGNED by the person, with the signature manifest of the ticket |
Values are compared in their canonical form: the shortest decimal that reads back as the same 64-bit float, without an exponent (42.5, 1000000, -3.25).
Signed by an integration: NKey signature
Section titled “Signed by an integration: NKey signature”An administrator registers the integration identity in Studio, in Security > Integrations, or with POST /api/auth/integrations. Add ?mode=create to refuse a name that already exists with 409 rather than replace it:
{ "name": "mes", "nkey_pub": "U...", "role": "Shift_Operator", "tag_patterns": ["Plant/Processing/AreaA/>"], "enabled": true }The role must be Shift_Operator or above, and never the AI co-pilot’s. In tag patterns, * matches one level and > matches the rest of the path. On a single server, the registry is stored in integrations.json in the security data directory. In an HA cluster it is replicated: see Integration registry.
Only security administrators see the Integrations tab and its New identity button. The server refuses the endpoint to everyone else.
Generate the key pair on the integration’s machine, for example with nk -gen user -pubout. Register only the public key, which starts with U. The private seed, which starts with SU, stays on that machine. Studio checks the key’s format and checksum before it sends it, and clears a pasted seed from the form without sending it.
Each creation, change and deletion is audited as INTEGRATION_SAVED or INTEGRATION_DELETED by the administrator. A change records the values before and after it.
A refused change is audited as INTEGRATION_CHANGE_REJECTED by the administrator who sent it, with the identity name, the operation, the HTTP status and the reason:
| Status | Reason |
|---|---|
400 |
Invalid JSON, name, public key, role or tag patterns |
404 |
Deleting an identity that does not exist |
409 |
?mode=create with a name that already exists |
503 |
In an HA cluster, the cluster did not confirm the change |
- Product
- Data store
- Device or controller
- External system
- Data or telemetry
- Command to equipment
- Refusal
Read as text
An integration signs each command with its private NKey seed and sends it on NATS. eaxScada runs the write checks, then verifies the signature against the public key an administrator registered, with the time stamp, the nonce, the role and the tag patterns. It records the verification, writes the value and then records the write as an authenticated system command. A node that may not write (in an HA pair, any node but the primary with quorum, or a node whose writes are off) drops the command without a reply.
Participants
- Integration (external system): own NKey seed
- eaxScada (product): server
- Audit records (data store)
- Controller (device or controller): PLC or device
Steps, in order
- Integration: Signs the command: over the path, the value, ts and the nonce; with its own NKey seed
- Integration → eaxScada (command to equipment): uns.command.write. on NATS: path, value, ts, nonce, signer, sig
- eaxScada: Checks, in order: the runtime is running; this node may write: else dropped, no reply; no password field in the command; the tag exists; limits, engineering range, interlocks; signed one way only: no ticket beside the signature; the signer is registered and enabled; ts is within 30 s of the server clock; the signature matches the registered public key; the nonce was not used before; the role may write; a tag pattern covers the path
- A check fails:
- eaxScada → Audit records (data or telemetry): INTEGRATION_COMMAND_REJECTED. Access audit, when the signature checks refuse
- eaxScada → Integration (refusal): Refused: {"ok": false, "error": ...}. nothing written, even for a tag that needs no signature
- Every check passes:
- eaxScada → Audit records (data or telemetry): INTEGRATION_COMMAND_VERIFIED. Access audit, first: no record, no write
- eaxScada → Controller (command to equipment): Writes the value. through the driver
- eaxScada → Audit records (data or telemetry): SYSTEM_COMMAND_AUTHENTICATED. ledger, after the write; _FAILED if it failed
- eaxScada → Integration (reply): {"ok": true}. when the command was sent as a request
The command:
{ "path": "...", "value": 42.5, "ts": 1790882364560, "nonce": "c0ffee-0001", "signer": "mes", "sig": "<base64 Ed25519>" }sig is the integration’s Ed25519 NKey signature over these five lines, joined by \n with no trailing newline:
eaxscada/uns.command.write/v1<path><value, canonical form><ts, Unix milliseconds, decimal><nonce>| Check | Rule |
|---|---|
ts |
within ±30 s of the server clock |
nonce |
8-128 of A-Z a-z 0-9 _ -; never accepted twice (remembered for 60 s, at most 100 000 at a time; refused when full) |
sig |
base64 (standard or URL, padded or not), verified against the registered public key |
role, tag_patterns |
the role may write; one pattern matches path |
Every outcome is audited as INTEGRATION_COMMAND_VERIFIED or INTEGRATION_COMMAND_REJECTED.
An accepted write is recorded in the ledger as SYSTEM_COMMAND_AUTHENTICATED by integration:<name>, with an empty signature column. Under 21 CFR Part 11 a machine is not a person, so this is an authenticated system command, not an electronic signature.
A command signed both ways, or with a bad signature, is refused, even for a tag that needs no signature.
High availability
Section titled “High availability”On a single server, tickets and nonces are kept in its memory. In an HA cluster (NATS clustering enabled), every SCADA node keeps them in two JetStream key-value buckets that the cluster replicates. The buckets use file storage and three replicas once a node has routes to its two peers.
| Bucket | Holds | Kept for | Single use |
|---|---|---|---|
ha_esign_nonces |
one key per integration nonce: a SHA-256 of the signer name and the nonce | 60 s | The nonce is claimed with an atomic create, so only one node’s claim succeeds. |
ha_esign_tickets |
one record per open ticket, keyed by the ticket’s SHA-256: person, path, value, meaning, manifest, expiry | 90 s (each ticket expires after 60 s) | The ticket is consumed with a compare-and-delete on the revision that was read, so one node gets it and the other is refused. |
The ticket itself is never stored, only its hash.
As a result:
- A nonce accepted on one node is refused on every other node, before and after a failover. A command that the old primary accepted is refused on the new primary as
replayed command. - A ticket can be issued on either node’s web server and redeemed once by the node that dispatches the command. A ticket issued before a failover can be redeemed once on the new primary.
- Each node still checks a nonce in its own memory first, and records it atomically before it claims the nonce in the cluster.
Failing closed
Section titled “Failing closed”Each store operation must complete within 2 s. Otherwise the server refuses rather than falling back to its own memory:
| Store does not answer | Result |
|---|---|
| Claiming a nonce | The command is refused: replay protection not confirmed by the HA cluster. |
| Storing a new ticket | No ticket is issued. The refusal is audited as ESIG_TICKET_REJECTED, and the person signs again. |
| Redeeming a ticket | The command is refused. The ticket is not burnt and can be redeemed once the store answers, until it expires. |
When a node becomes primary, it checks that both buckets answer. The result is audited as HA_REPLAY_PROTECTION.
If the buckets do not answer, the node fences integration commands. It refuses any command whose ts is at or before the lease acquisition time plus 35 s (the 30 s window plus 5 s of tolerated clock skew between nodes).
- The old primary accepted a
tsup to 30 s ahead of its own clock, so the fence covers every command that the old primary could have accepted. - An integration that sends a current
tsis refused for about 35 s after the takeover. After that it signs again with a newtsandnonce. - The fence applies only to integration commands. Tickets are protected by the store itself.
Integration registry
Section titled “Integration registry”In an HA cluster the integration registry is replicated in a third bucket, ha_integrations, with file storage and three replicas. An identity registered, changed or deleted on any SCADA node applies on every node, and after a failover.
- A change is written to the cluster first. If the cluster does not confirm it within 2 s, the change is refused with
503and audited asINTEGRATION_CHANGE_REJECTED. Nothing changes on the node. ?mode=createis atomic across the cluster: if the name exists on any node, the request gets409.- The node where the administrator made the change audits it as
INTEGRATION_SAVEDorINTEGRATION_DELETED. Every other node audits it asINTEGRATION_REPLICATED, with the node it came from. - Each node keeps a copy in its own
integrations.json, rewritten at each change. - The first node that finds the bucket empty copies its
integrations.jsoninto it, so an existing cluster keeps its identities. From then on the bucket is authoritative. A node that starts with an older file takes the cluster’s registry, and an identity deleted while that node was down does not come back. The differences are audited asINTEGRATION_REPLICATED. - Until a node has read the cluster’s registry, it refuses signed integration commands (
integration registry not yet synchronized with the HA cluster) and registry changes. A node that becomes primary reads the registry again.
The Last command column in Security > Integrations shows only the commands that the node you are connected to accepted since it started.
Access to the HA state
Section titled “Access to the HA state”The HA cluster’s state is kept in a separate broker account, EAX_HA, that no client can join. It holds:
- the primary lease (
ha_lease); - the replicated alarm and batch state (
ha_active_alarms,ha_batch_state); - the three buckets above;
- the alarm and audit replication subjects (
ha.sync.alarms,ha.sync.audit).
Only each SCADA server’s own HA connection is in that account. Every client, including the SCADA core’s own connection and a role whose topic rights allow > such as Administrator, is in the default account. Accounts share no subjects, so a client cannot:
- take the primary lease or write any HA bucket;
- forge a ticket record, delete a nonce or register an integration identity;
- inject alarm states or audit records into a standby.
This also covers writes that the broker makes for a client, which topic rights do not control: a reply subject, a stream that republishes, or a push consumer’s deliver subject.
As a second line of defence, broker users are also denied the $KV subjects and JetStream API subjects of every HA bucket, and the ha.> subjects.
The lease, alarm and batch buckets are created by the first node that starts, often before its peers are connected. Each node scales them to three replicas once it has routes to both peers. A bucket is never scaled down, even by a node that restarts before its routes are up. /api/ha/status reports lease_replicas: the number of servers that hold the lease and are in sync. In a healthy three-server cluster it is 3. A failover while it is 1 loses the lease with that server.