Documentation
¶
Overview ¶
Command pushsink is the knock push spec's push service (e2e/tests/plugin-knock-push.spec.ts): a UnifiedPush-style endpoint a paired phone registers, served over TLS under a test host name with a certificate from a test CA it mints at start.
go build -o e2e/.bin/pushsink ./e2e/pushsink e2e/.bin/pushsink -host push.example.test -proxy 127.0.0.1:<port> -ca-out <ca.pem> -record <received.jsonl>
muster reaches it as it reaches any push host: an https endpoint on the default port (https://push.example.test/up/<topic>), on a host listed in MUSTER_PUSH_EXTRA_HOSTS, its certificate checked against the roots in SSL_CERT_FILE (which the spec points at -ca-out).
⚠ HOW :443 IS REACHED WITHOUT ROOT. Binding port 443 and naming a host in /etc/hosts both need root, which neither a developer's machine nor every CI runner gives a test. So the sink is ALSO an HTTP CONNECT proxy on -proxy, and the spec starts muster with HTTPS_PROXY pointing at it: Go's default transport, which muster's push client uses, then opens a tunnel to "push.example.test:443" through the proxy, and the TLS handshake (SNI, the chain against SSL_CERT_FILE) runs end to end inside it, exactly as it would to a listener on 443. The proxy accepts ONE target, exactly host + ":443", and refuses (and records) any other, so a send to another host or port is seen, not silently delivered. The tunnel is the only thing the proxy does: it never reads or answers inside it.
Every POST over the tunnel is answered 201 and recorded as one JSON line in -record: {"path", "content_encoding", "ttl", "authorization", "body" (base64), "connect" (the tunnel's target)}. A refused CONNECT is recorded as {"refused": "<target>"}. The spec decrypts the bodies itself: it holds the device's key pair, which the sink never sees.
It prints "pushsink: ready" on stdout once both listeners are up.