Licences¶
Offline-verifiable, hardware-bound licences for Brinkhaus software. Rust:
brinkhaustools::licence (feature licence). Python: brinkhaustools.common.licence
(extra licence). Both implement the same format; test-fixtures/licence-vectors.json
pins them byte for byte (same payload, same signature, same text block).
What the library decides — and what it leaves to the product¶
| Library | Product |
|---|---|
| Text block format, Ed25519 signing and verification | Meaning of feature and quota names |
| Hardware profile and binding check | Where licences are stored |
| Validity window, clock mark, trial record | Trial length, grace periods, clock guard (keep them out of user-editable settings, or a setting lifts the licence) |
| Evaluation: union of features, sum of quotas | What happens when the mode changes |
Text block¶
payload: canonical JSON (sorted keys, no whitespace, UTF-8).signature: Ed25519, 64 bytes, over the payload bytes as transmitted.check: first 4 bytes of SHA-256 overpayload ‖ signature. It tells a copy error (“incomplete”) apart from a forgery (“signature invalid”).- Emitted in lines of 64 characters. Readers ignore whitespace,
-and case and readOas0,I/Las1.
A typical licence is about 800 characters: meant to be pasted, mailed or uploaded as a file, not typed.
Payload¶
| Field | Type | Meaning |
|---|---|---|
v |
int | Format version, 1 |
id |
string | Licence id (UUID) |
kid |
string | Signing key id: first 8 hex digits of SHA-256 over the raw public key |
product |
string | Product name; each product accepts only its own |
variant |
string or null | Product variant (e.g. a branding stream); null = any |
licensee |
{slug, name} |
Customer |
bind |
[{type, label, sha256}] |
Hardware bindings; all must be present |
notBefore, notAfter |
RFC 3339 or null | Validity window; notAfter null = lifetime |
features |
[string] |
Product-defined, union across licences |
quotas |
{string: int} |
Product-defined, sum across licences |
issuedAt |
RFC 3339 | Issue time |
note |
string or null | Free text (order number) |
Unknown fields are refused. A new restriction needs format version 2, so an older
verifier refuses the licence loudly (unsupportedVersion, checked before the fields)
instead of ignoring the restriction.
Hardware identifiers¶
type |
Source | Normalised |
|---|---|---|
machineId |
Linux /etc/machine-id, Windows MachineGuid¹ |
lower-case, no braces/dashes |
mac |
physical interface (label = interface name) | aa:bb:cc:dd:ee:ff |
cpuSerial |
/proc/cpuinfo “Serial” (ARM) |
lower-case |
serialFile |
first line of a provisioned file (e.g. a Brinkhaus SN) | upper-case |
¹ Windows collection (registry MachineGuid, Get-NetAdapter -Physical) is implemented
and its output parsers are tested, but it has not yet run on a Windows machine.
sha256 = SHA-256("brinkhaus-licence-v1" 0x00 type 0x00 normalised), hex. A licence
carries hashes, never values.
Physical interfaces are those whose sysfs link does not resolve under
devices/virtual/ (bridges, veth, docker0, lo do); Ethernet type 1; kernel-randomised
MACs (addr_assign_type 1) are skipped.
Containers see neither the host's machine-id nor its network cards. Recommended:
name each source. Mount exactly the files a licence may bind to, one by one and
read-only, and name them (ExplicitSource, parse_source_spec,
HardwareProfile::collect_explicit); the container sees these values and nothing else
of the host:
volumes:
- /etc/machine-id:/hw/machine-id:ro
- /sys/class/net/eth0/address:/hw/mac-eth0:ro # interface name from `ip link`
Docker resolves the symlink of the single address file. A wrong interface name stops the
container from starting, so a template should only carry the machine-id by default.
/proc/cpuinfo is not namespaced and needs no mount. With no source named, the result
reports noSourceConfigured.
Alternative: a host root (HardwareSources, default /host): mount /etc/machine-id
and all of /sys under it — /sys/class/net alone dangles (danglingInterfaces).
It finds every physical network card but exposes the whole of /sys. Inside a
container without either, the collector refuses the container's own machine-id and veth
MAC (containerWithoutHostRoot): they identify the image, not the machine.
Protection limits. The binding stops a data directory from being carried to another machine. It does not stop root on the host from copying a machine-id or setting a MAC.
Licence request¶
Unsigned. Carries product, variant, version, installationId, the bindings the
operator selected, and createdAt. The product shows it for copying; the FleetManager
reads it to pre-fill the issuing form when the machine is offline.
Evaluation¶
Each licence id counts once; a repeat is duplicate (installing a licence twice must
not double its quotas). Order per licence: signature (unknownKey, signature), product, variant,
noBinding (if the product requires a binding), hardwareMismatch (lists the missing
bindings), notYetValid, clockRolledBack (time-limited licences only), expired.
Mode: licensed if any licence is valid; else trial if a trial is active; else
unlicensed. In trial mode features and quotas come from the product's trial policy.
Trial. A record with start time, installation id and hardware digest. Products keep two traces (e.g. a file and a database row) and merge them with “earliest start wins”, so deleting one does not restart the trial. A clock before the trial start ends it.
Clock mark. Highest system time seen, persisted. A system time more than the guard
behind it marks time-limited licences and the trial as clockRolledBack; lifetime
licences are unaffected. Recovery is correcting the clock. A clock that once jumped
into the future leaves the mark there until real time passes it; ClockMark::reset
is the service action for that case (never an operator setting).
Fleet¶
- Command
install-licence(FLEET_COMMAND_INSTALL_LICENCE), payload{"licence": "<text block>"}, registered withsystem: true: the catalog advertises it, but it is issued by FleetManager workflows, not offered as an operator button. - Heartbeat field
licence(schema intest-fixtures/schemas/heartbeat.schema.json):installation_id,state(licensed,trial,unlicensed,undetermined),licences[](id,state,reason,not_after),hardware[](type,label,sha256— never values),trial(started_at,expires_at). - The Rust
StatusMonitorgainedregister_command(CommandSpec)with the same contract as the Python one: catalog undersnapshot.commands, one ack per command row, unknown command ids rejected, handlers on their own thread.
Issuing¶
brinkhaus-licence (Rust binary, --features licence):
brinkhaus-licence keygen <seed-file> # new key; prints kid + public key
brinkhaus-licence sign <seed-file> payload.json # fills v, kid, id, issuedAt if absent
brinkhaus-licence verify <public-hex> licence.txt
brinkhaus-licence request-decode request.txt
brinkhaus-licence hardware [host-root] [serial-file]
brinkhaus-licence bind-hash mac E0:8F:4C:82:40:7E
The seed file (32-byte Ed25519 seed, hex) is the only secret of the scheme. It belongs on
the issuing server with mode 0600, never in a repository. The two seeds in
licence-vectors.json are the RFC 8032 §7.1 TEST 1 and TEST 2 keys: publicly known,
trusted by no product. Products assert that their trusted keys do not contain them.