Skip to content

Use https:// when the agent is given an http:// server address - #49

Merged
mastacontrola merged 1 commit into
mainfrom
feat/http-server-address-to-https
Nov 17, 2026
Merged

mastacontrola merged 1 commit into
mainfrom
feat/http-server-address-to-https

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Problem

The server identifies an agent only by its TLS client certificate. Over plain HTTP the certificate never reaches the server. An agent installed with an http:// address enrolled, then failed every poll with server refused this certificate (forum topic 18320). A FOG install serves HTTPS whether or not it redirects HTTP (installfog.sh --no-force-https: "serve both HTTP and HTTPS").

Change

  • internal/enroll/serverurl.go: HTTPSAddress moves http:// with no port or port 80 to https:// on the same host. Other ports are kept and still fail, with the reason logged (Name an http:// server and the server's 401 reason in the log #48).
  • Applied at --server (openState, forgetStaleTrust), at enroll.Load for an existing config.json, and in ProbeCA.
  • repairConfig logs the move once per process (userinfo redacted) and saves it. Enrollment, key and host id are kept.
  • Docs: protocol-v1.md, 0002-trust-model.md, install-windows.md.

Limit

A machine whose polls are already refused gets no self-update, because the update arrives in the poll (cmd/fog-agent/main.go, desired.Update). Those machines need the MSI run again by hand. After that, an http:// address works.

Verified

  • New tests: the address table (including IPv6 and :80), the service start on an http:// config.json (moved, host id kept, saved, not moved twice), setup with the flag, config and flag both http:// (one log line), and password redaction. Each fails with the move or the dedup turned off.
  • The CI command set passes locally.
  • Reviewed by spec-reviewer (opus) and standards-reviewer (opus), two rounds. Spec: CLEAN. Standards round 2: three doc and comment findings, fixed in this commit.

🤖 Generated with Claude Code

The server knows an agent only by its TLS client certificate, so no call
after enrollment works over plain HTTP. An agent installed with an
http:// address enrolled, got a certificate it could never present, and
failed every poll (forum topic 18320). A FOG install serves HTTPS
whether or not it redirects HTTP to it.

- enroll.HTTPSAddress moves http:// with no port or port 80 to https://
  on the same host. Another port is kept and still fails, with the
  reason in the log.
- Applied to --server (setup, enroll, run), to a config.json that holds
  http:// (enroll.Load), and to the `ca probe` wizard address.
- The move is logged once per process, with userinfo redacted, and
  saved to config.json. The enrollment, key and host id are kept.
- A machine whose polls are already refused cannot self-update to this
  release; it needs the MSI run again by hand.
- protocol-v1.md, 0002-trust-model.md and install-windows.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit 98a8f5c into main Nov 17, 2026
2 checks passed
@mastacontrola
mastacontrola deleted the feat/http-server-address-to-https branch November 17, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant