Skip to content

Firmware Contract ​

This page describes the interface between the firmware and the main repository: device identity commands, NVRAM settings, TOFU behavior, challenge-response formats, control-plane reporting, and boot variables. Field-level authority lives in the firmware repository's docs/device-trust-usage.md, docs/capability-reference.md, and patches/README; control-plane endpoint details are authoritative in api/control-plane-api.en.md.

Device identity commands ​

The firmware provides three commands; all business logic (registration, challenge, admission) lives in the main repository's boot scripts and control plane.

CommandPreconditionOutputPersistence
keygennoneGenerates a 32-byte ECDSA P-256 private key and writes device-key; refuses to overwrite an existing key and exits non-zeroNVRAM
pubkeydevice-key existsPrints 130 hex characters (65-byte uncompressed point 04‖X‖Y) and writes the temporary setting pubkeyCurrent boot only
sign <data...>device-key existsConcatenates arguments in order without separators, SHA-256 → ECDSA P-256 → DER → base64, and writes the temporary setting sigCurrent boot only

Notes:

  • keygen is the idempotent entry point: boot scripts call it unconditionally once; it generates on first boot and fails harmlessly afterwards.
  • The private key is used only inside the firmware; it is never written to disk or transmitted over the network.
  • pubkey and sig are command output buffers that disappear on reboot; they cannot be read across boots.

NVRAM settings ​

SettingTypeDHCP tagPersistenceWriter
device-keyhexraw0x5eNVRAMkeygen
server-fingerprinthexraw0x5fNVRAMTOFU
trusthexraw0x5aNVRAM (root certificate override)TOFU
pubkeyhexraw0x60Memorypubkey
sigstring0x61Memorysign

Clearing persistent settings requires the nvo/ block prefix:

text
clear nvo/device-key          # delete the device key; regenerated on next boot
clear nvo/server-fingerprint  # remove the TOFU pin; repinned on next HTTPS connection

A bare clear device-key or an empty set device-key has no effect on the NVS backend.

Deleting device-key is equivalent to changing the device identity and requires re-registration and rebinding; deleting server-fingerprint makes the next HTTPS connection enter first-trust state again. Both are sensitive operations and should run through a management flow or controlled provisioning.

TOFU ​

TOFU applies automatically in the TLS handshake path; there is no command or configuration item.

StateConditionBehavior
First contactNo server-fingerprint, certificate validation failsAccept the handshake, store the leaf certificate SHA-256 fingerprint in server-fingerprint, and mirror it into trust
Pinned and matchingFingerprint exists and matchesValidation passes; downloads proceed
Pinned and mismatchingFingerprint exists but differsReject the handshake; no HTTP request is sent and the existing pin is not overwritten

Constraints:

  • The fingerprint is the SHA-256 of the leaf certificate DER; verify independently with openssl x509 -outform DER | sha256sum.
  • The pin is a single global anchor: the firmware trusts only the certificate pinned on the first HTTPS connection. Every HTTPS target must share that certificate or chain to it; other traffic can use TFTP/HTTP.
  • HTTPS uses the native iPXE TLS implementation, limited to TLS 1.2.
  • After control-plane certificate rotation, devices must clear server-fingerprint and pin again, or boot will be refused.

Challenge-response ​

The control plane issues a one-time nonce:

text
GET /devices/challenge?mac=<MAC>
→ #!ipxe
  set nonce <64 hex characters>

The device signs:

text
sign ${nonce}${mac}

The signed data is nonce‖mac with no separator. Control-plane verification:

ItemValue
DigestSHA-256
AlgorithmECDSA P-256
Signature encodingASN.1 DER
Transport encodingbase64 (standard alphabet, no line breaks)
Public keyUncompressed point 04‖X‖Y, 130 hex

The nonce is single-use, short-lived, and bound to the MAC. The challenge endpoint returns 404 for unknown, unclaimed, or revoked devices. The signature does not include the hostname: identity is constrained by the device ledger entry for the MAC and the one-time nonce.

Online rotation uses a nonce from the same challenge endpoint and signs:

text
rotate‖mac‖new_pubkey‖nonce

with the old private key. On success the device public key is replaced immediately, and the old key stops working on the boot verification path.

Device reporting ​

text
GET /devices/report?mac=<MAC>&pubkey=<130 hex>&uuid=...&manufacturer=...
FieldMeaning
macRequired; the device NIC MAC
pubkeyECDSA P-256 public key, required for registration and key claiming
uuidSMBIOS UUID; an existing value is never overwritten by a self-reported one
manufacturer / product / serialVendor, model, serial number
cpumodelCPU model
mem-total / mem-type / mem-speedMemory size, type, speed
chip / busidNIC chip and PCI address

Behavior:

  • Existing device: merge the fingerprint and update last_seen; within the registration window a valid public key can claim the key, and a mismatching key is rejected and audited.
  • Unknown MAC: admitted only when the registration window is open, admission quota remains, and a valid public key is present; otherwise ignored.
  • Revoked device: reports are ignored; the device is neither updated nor revived.
  • The response is an empty #!ipxe script with no script side effects.

Reporting is unauthenticated and rate-limited by source IP.

Boot variables ​

text
GET /boot-vars?mac=<MAC>&hostname=<name>&nonce=<nonce>&sig=<base64>

The response is a #!ipxe script by default; format=json returns the same fields as JSON (snake_case). The encoding does not change admission.

Admission order:

  1. Identify: MAC → device ledger → bound_worker_id; hostname is only a fallback for legacy records.
  2. Binding check: a request carrying a MAC must come from the device bound to that Worker, or an empty script is returned.
  3. Signature verification: verify nonce‖mac with the public key in the device ledger. Unverified requests may receive non-credential variables but never any key; once enforcement is on they are rejected outright.
  4. Data-plane readiness: the nvmet backend must have both an authentication key and a ready data-plane port, or nothing is projected.
  5. Projection: emit the variables below, all valid only for this boot.
VariableMeaningCondition
disk-nqnFull NQN of the system disk, passed through verbatimA default disk exists
storager-ipData-plane addressThe Worker is bound to a node
nbft-tls-portData-plane TLS portnvmet backend with a ready port
nbft-tls-pskTLS PSK derived from the authentication keySignature verified and a key exists
nbft-secretDHHC-1 authentication keySignature verified and a key exists
hostnqnThe Worker's Host NQNNode and disk NQN available
os / os-versionOS label for the menuDefault disk carries OS information
menu-default / menu-timeoutAuto-boot entry and timeout (milliseconds)Always emitted
base-iqn / iscsi-sepiSCSI installer root-path parametersstgt / lio backends only

Without a default disk, the control plane returns menu-default=reboot with a short timeout, so the device reboots while waiting for a disk or default selection. It never constructs a plaintext fallback.

Boot script variables ​

boot.ipxe.cfg is maintained by the platform; operators normally do not edit it. It defines:

VariableMeaning
controller_ipControl-plane address, defaulting to DHCP next-server
https-port / https-urlControl-plane HTTPS entry
chain-urlRoot for installer and tool assets
menu-urlAbsolute URL of the menu script
storager-ipDefault data-plane address (overridable by /boot-vars)
base-iqnBase iSCSI IQN
iscsi-sepiSCSI separator (overridden per backend type)
initiator-iqniSCSI initiator name

Data-plane URI ​

The menu assembles the NVMe/TCP root path as:

text
nvme://<storager-ip>:<nbft-tls-port>/<disk-nqn>?secret=<nbft-secret>&tls_psk=<nbft-tls-psk>&tls_trsvcid=<nbft-tls-port>
  • secret= is appended when nbft-secret exists; legacy deployments without authenticated targets may omit it.
  • tls_psk and tls_trsvcid are always appended for the firmware-side TLS 1.3 handshake.
  • If disk-nqn, nbft-tls-port, or nbft-tls-psk is missing, the menu refuses to boot and does not fall back to a plaintext port.
  • On success, keep-san 1 keeps the SAN connection for the kernel and initramfs.

NBCT and NBFT ​

NBCT (NVMe Boot Credentials Table) is an ACPI table the firmware installs at sanboot time, with one fixed-size record per authenticated session:

FieldContent
traddrData-plane address
trsvcidData-plane port
nqnSubsystem NQN
hostnqnHost NQN
secretDH-HMAC-CHAP key

NBCT exists only in memory, never in NVRAM. The initramfs nbft-connect module reads /sys/firmware/acpi/tables/NBCT* and reconnects each entry with --dhchap-secret and --hostnqn, with no second network fetch for credentials; without NBCT it falls back to nvme connect-all --nbft.

NBFT (NVMe Boot Firmware Table) is the discovery table describing transport addresses, subsystems, and NIC information. iPXE-side NBFT generation is not in mainline yet; current verification chains inject an NBFT table to simulate the firmware-generated stage. The mainline firmware provides the NBCT relay; NBFT consumption lives in the initramfs.

Version and compatibility ​

  • The full chain requires firmware with the NVMe/TCP, authentication, NVS, TOFU, device identity command, Host NQN, and NBCT patches; older firmware without the identity commands fails at keygen/sign and cannot obtain credentials.
  • The control plane never sends keys to unverified requests; with enforcement on, older firmware cannot complete boot.
  • Upgrading the control plane does not require a simultaneous firmware upgrade, but new variables (for example a new TLS port) must be consumable by the firmware; check firmware capabilities before upgrading.

Security boundary ​

  • Keys are injected only after signature verification; /boot-vars provides no registration channel.
  • The device private key lives in NVRAM and is readable by the booted system; current mainline has no Secure Boot/TPM measurement to isolate it.
  • TOFU first contact has no cryptographic protection and depends on PXE network isolation; after pinning, integrity is enforced.
  • Never copy NVRAM contents to another device; decommissioned devices should clear device-key and server-fingerprint.