Files
jcoffey-dev d647a78d8a Host server: setup credentials go only to the server's own listener
A host first boot restarts the server and then sends the bootstrap
credential, then the administrator's password, then the setup's API
key to 127.0.0.1:8080 and later :8081; a move to the host does the same
with the operator's API key. Those are unprivileged ports, and nothing
checked who answered there. A local user who bound one while the
server restarted was sent the password or the key.

Before each such request, the installer now checks that every socket
listening on that port belongs to the server unit's main process
(systemctl show -p MainPID), reading /proc as the port survey already
does; otherwise nothing is sent, and the step waits or fails naming
what holds the port. The jmap client gained a Guard hook for this. A
server in a container is not checked: the runtime publishes its port.

Test: TestSetupCredentialsGoOnlyToTheServersOwnListener failed before
(a listener that wasn't the server's received "Basic ..." and "Bearer
the-api-key") and now passes; TestSetupCredentialsGoToTheServer and
TestSetupCredentialsCheckTheClientsCurrentAddress are new.
2026-11-17 15:04:20 -07:00
..