REFERENCE

Endpoints trusting your server’s certificate

Your endpoints reach your Community Edition server over HTTPS, and the agent or winget refuses its certificate, or you want them to trust it before you roll the agent out.

UPDATED

Every endpoint that installs an app talks to your server over HTTPS, the Docker host included, and Windows decides whether to trust the certificate it is shown. If that certificate chains to a root the endpoint already trusts, there is nothing to do. If it does not, because it is self-signed, issued by Caddy’s internal CA or by a private PKI, you put the root into each endpoint’s machine trust store yourself, before the agent is installed. This page is about Community Edition; a dedicated instance’s certificate is covered on its page.

Which connections need HTTPS

  • The agent. It refuses a plain-HTTP server address unless the host is the machine itself (localhost, 127.0.0.1 or ::1). The platform takes a plain-HTTP WEP_PUBLIC_BASE_URI only with WEP_ALLOW_PLAIN_HTTP set. That is enough for an agent on the Docker host to enroll and report its inventory. It installs nothing, because of winget.
  • winget. The agent points winget at your feed, and winget opens no plain-HTTP REST source, on localhost either. winget 1.29 refuses one with 0x8A150045. A server that installs apps therefore needs HTTPS on every endpoint.
  • Port 18080. Since 26.11.1500 the sample stack publishes the plain-HTTP port on 127.0.0.1 only, for a look around the console on the Docker host. WEP_PLATFORM_BIND changes the address, for a TLS proxy of your own on another machine.
  • One address, one root. The agent builds the feed’s address from the server address it enrolled with, so the agent’s own calls, enrollment included, and winget’s feed use the same name. One trusted root covers both, and both validate against the Windows trust store.

Which root to distribute

  • A certificate from a public CA, or from an AD CS enterprise root your domain-joined endpoints already trust: nothing to import. Run the check below and stop there. The sample ACME overlay gets a public certificate on its own. It needs a public DNS name that reaches the server on ports 80 and 443. winget accepted its Let’s Encrypt certificate with nothing imported. With the plain Caddy overlay you supply the certificate and key from your CA.
  • A self-signed certificate, for a lab: the certificate is its own root.
  • Caddy’s internal CA: its root, never its intermediate or the certificate it serves. Caddy renews those on its own, and an endpoint that trusts one of them breaks when it rotates.
  • Your own PKI: the self-signed root at the top of the chain, not a subordinate CA.

A root is self-issued, so its issuer and subject are the same name. If they differ, you have an intermediate or a server certificate: go up the chain.

Where it goes

The root goes into the endpoint’s machine store, Trusted Root Certification Authorities under the local computer, not into a user’s. The agent runs as LocalSystem, and so do the winget runs it drives for machine-wide installs; LocalSystem does not see a root imported into your own account. Import it before you install the agent: enrollment validates the certificate too, and fails until the root is trusted.

Use whatever already manages the endpoint:

  • Group Policy, for domain-joined endpoints: in a GPO linked to their OU, Computer Configuration › Policies › Windows Settings › Security Settings › Public Key Policies › Trusted Root Certification Authorities, then Import.
  • Intune: a Trusted certificate profile for Windows 10 and later, with the destination store set to the computer’s root store, assigned to the endpoints’ device group.
  • By hand, on a machine nothing else manages: certutil -addstore Root ca.cer in an elevated prompt writes the machine store.

To check an endpoint, run Invoke-RestMethod https://<your server>/e/probe/information in PowerShell on it. The feed answers that route without a credential, so probe stands in for a feed token, and it returns a Data object naming the feed. A trust error means the root is missing, sits in the wrong store, or is not the root of the chain your server serves. Once the agent has enrolled and fenced the endpoint, winget source list shows your feed; the address it lists carries the endpoint’s feed token, which is a credential, so keep it out of tickets.

The agent never adds a root

Nothing in the agent, its updater, the shim or the agent MSI adds a certificate to a trusted-root store. Trust in your certificate comes only from a channel you control.

That is deliberate. A root in the machine store is trusted for every TLS connection on the endpoint and for any hostname, not only for your feed. If the platform could push roots, anyone who took it over, or who could answer an enrollment in its name, could make every managed endpoint trust certificates they mint. Keeping roots in Group Policy, Intune or your own hands keeps that power out of the platform’s reach.

It follows that retiring an endpoint or uninstalling the agent removes no root. Remove it the way you added it: delete it from the GPO, unassign or delete the Intune profile, or run certutil -delstore Root <thumbprint>.

Rotating the root

An endpoint trusts every root in its store, so your server can change certificates freely as long as the new one chains to a trusted root. Changing the root itself takes an order:

  1. Make the new root and certificate, and do not serve them yet.
  2. Distribute the new root to every endpoint and check a few. Both roots are now trusted.
  3. Switch the server’s TLS terminator to the new certificate, and run the check above on an endpoint.
  4. Only then remove the old root.

Removing the old root first cuts off every endpoint that has not received the new one: winget can no longer reach the feed, the agent cannot check in, and the agent cannot repair that, because it never adds roots. With Caddy’s internal CA, the root changes only if Caddy’s data is lost; with the Caddy overlay, a Community backup carries that data, the internal CA included.

Endpoints off the office network

An endpoint that reaches your server through a front door off the office network uses that front door’s name, for the agent and for winget alike, so the front door needs a certificate your endpoints trust as well. One from a public CA needs no root import. The agent also checks something TLS cannot tell it there, because the front door ends TLS: before it switches to the public address, it makes the server prove the identity it pinned.

Where this stops

  • Attestree never distributes a root, so a private certificate needs a channel you already run.
  • A root cannot be revoked. Whoever holds its private key can mint a certificate for any name that every endpoint trusting it accepts, so keep the key out of version control and out of support requests.
  • An endpoint keeps the server address it enrolled with. A new name or port means enrolling every endpoint again.