Skip to main content

Module external_host

Module external_host 

Source
Expand description

A headless server accepts the attestation of a registered external host.

The CEF host proves the AgentMux windowโ€™s connection with its IPC token (operator_proof). A headless server reached through a separate host process has no CEF host, and a shared secret would prove nothing, because every agent on the machine can read what srv can. So the external host is a key pair: it keeps the private key, and srv holds only the public key, registered once at boot (--external-host-key-file) before any connection or agent exists. There is no route or call that registers or replaces it, so a later or second registration cannot happen.

What the host attests is one connection, by the challenge nonce the connection asked srv for (operator.challenge), for a short lease, naming the person. The host also gives each connection it proxies an id of its own, signed, in the x-amx-conn header; srv binds the challenge to that id, and the signed attestation carries it, so a connection that did not come through the host (one opened on loopback by anything else) can never be attested.

Signed text, fixed field order, version first (the signature is Ed25519; fields are checked to hold no |):

amx-conn/v1|<workspace>|<conn>                                  the connection header
amx-attest/v1|<workspace>|<conn>|<nonce>|<person>|<valid_until> an attestation
amx-revoke/v1|<workspace>|<conn>|<issued_at>                    ending a connection's proof
amx-host/v1|<workspace>|<op>|<issued_at>|<args>                 a call of the host's own (`host_control`)

Structsยง

AttestRequest ๐Ÿ”’
ConnGuard ๐Ÿ”’
Holds a connectionโ€™s id while it is open and gives it back when it closes.
Host ๐Ÿ”’
The registered host and the connections it proxied that are open now.
KeyFile ๐Ÿ”’
NonceRequest ๐Ÿ”’
RevokeRequest ๐Ÿ”’

Constantsยง

CONN_HEADER
The header the host puts on the websocket upgrade of a connection it proxies: <conn>.<signature>.
KEY_FILE_VERSION ๐Ÿ”’
The key fileโ€™s version.
MAX_LEASE_SECS ๐Ÿ”’
The longest lease srv grants, whatever the host signed: the host asks for five minutes.
REVOKE_WINDOW_SECS ๐Ÿ”’
How old a revocation, or a call of the hostโ€™s own, may be.

Staticsยง

HOST ๐Ÿ”’

Functionsยง

claim_connection ๐Ÿ”’
A websocket upgradeโ€™s host-proxied identity: the verified id and the guard that frees it. None when no host is registered, the header is missing or not the hostโ€™s signature, or the id is held.
conn_ok ๐Ÿ”’
handle_attest ๐Ÿ”’
POST /api/v1/host/external_attest: the registered host vouches for one connection.
handle_nonce ๐Ÿ”’
POST /api/v1/host/external_nonce: which host-proxied connection a challenge was issued to (its id), without spending the challenge. The host asks before it signs; a connection that did not come through the host answers null.
handle_revoke ๐Ÿ”’
POST /api/v1/host/external_revoke: the registered host ends one connectionโ€™s proof.
host ๐Ÿ”’
The registered external host, if srv was started with one.
log_registered ๐Ÿ”’
Say in the log, once logging is up, that an external host key was registered at boot. Only the public keyโ€™s fingerprint is written: a person comparing it with what the host reports can tell the two hold the same key.
nonce_ok ๐Ÿ”’
not_registered ๐Ÿ”’
person_ok ๐Ÿ”’
plain ๐Ÿ”’
refused ๐Ÿ”’
register_from_file ๐Ÿ”’
Register the external host from its key file, once, at boot. A second registration is refused.
set_once ๐Ÿ”’
workspace_ok ๐Ÿ”’

Type Aliasesยง

Refusal ๐Ÿ”’
Why a call was refused: the status and a line for the host.