Skip to main content

Module keystore_proxy

Module keystore_proxy 

Source
Expand description

Node-side keystore proxy (was m4a_signer_proxy) (option A, specs/m4a-session-keys-2026-10-16.md).

The node holds NO m4a private keys. For each PTY session it keeps the session’s capability (issued by the hq-core signer) in its own memory and gives the PTY only a handle (M4A_SESSION_HANDLE) plus the nick. A handle is useless on its own: the proxy accepts a request on its UDS only if the kernel-reported peer (SO_PEERCRED) has the session’s uid and its pid is the session’s PTY root process or a descendant of it. A neighbour shell on the same node that steals the handle (env, /proc/<pid>/environ, a prompt injection) is refused, and nothing it could steal lets it sign: the capability never enters the PTY and the key never leaves hq-core.

Structs§

LinuxProc
ProxyRequest
SignedReply
SignerProxy
UplinkCoreSigner
Core signer over the node-call channel (Noise over the uplink, opaque to C2; core takes the node id from the stream). Called from blocking threads only.

Enums§

ProxyResponse
Refusal

Constants§

HANDLE_ENV
SOCKET_ENV

Traits§

CoreSigner
The hq-core signer as seen from the node (in production: a call over the C2 uplink).
ProcTree
Parent-pid lookup; /proc on Linux, injectable for tests.

Functions§

request
Blocking client (what the session-side m4a tool does).
serve
Serve the proxy on a Unix socket (0600 dir/socket owned by the node user). One JSON line request per connection; peer identity comes from SO_PEERCRED, never from the request.