Skip to content

Rename the local CA to "Ingot Local CA" and build its image here - #9

Merged
michaelaguiar merged 4 commits into
mainfrom
ingot-local-ca
Oct 19, 2026
Merged

michaelaguiar merged 4 commits into
mainfrom
ingot-local-ca

Conversation

@michaelaguiar

@michaelaguiar michaelaguiar commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Why

Ingot is going public, and the root CA it asks users to trust was named "Alias Project CA Self Signed CN". That name comes from the 2021 ghcr.io/aliasproject/openssl image, whose source no longer exists. A root CA named after the tool makes it clear what installed it and that it's for local use.

What changed

  • New image, built here: Dockerfile.openssl and openssl/entrypoint.sh. scripts/release.sh pushes it as ghcr.io/aliasproject/ingot-openssl:<version> for amd64 and arm64, and the CLI pins that tag through config.OpensslImage, the same way ingot-idle works.
    • It builds without QEMU. A fetch stage runs on the build platform, downloads the target architecture's openssl packages, and unpacks them onto the stock Alpine image.
    • openssl:latest is left alone, because the 2.0.0 CLI looks for the old file names.
  • New CA: CN "Ingot Local CA", O "Alias Project", saved as IngotLocalCA.pem/.key. It's valid for ten years and declares its CA extensions explicitly. It has no path-length limit, because Caddy's on-demand issuer signs through an intermediate it creates.
  • Project certificates: they gain the serverAuth extended key usage that Apple platforms require, stay at 825 days, and lose the @aliasproject.ssl email addresses.
  • Setup: generating the CA alone no longer leaves init.test files behind.
  • Names in the code: every use of the CA's names now comes from ssl.CACertFile, ssl.CAKeyFile and ssl.CAName.
    • This fixes the macOS lookups. They searched for AliasProjectCASelfSigned, which isn't part of the old certificate's name, so they never matched.
    • The Windows trust check exits 1 when nothing matches. Before, it always exited 0, so the CA always showed as installed.
    • On Debian/Ubuntu (no p11-kit), the CA is now installed as ingot-local-ca.crt. The trust check there only checks that the file exists, and the old CA was installed as ingot-ca.crt.
  • Stale certificates: generating a new project key now also drops that project's old CSR and certificate, so they can't end up mismatched. A certificate that no longer verifies against the CA (because the CA was regenerated) or that expires within 30 days is reissued. ingot start runs the image every time, so certificates are now renewed before their 825 days run out.
  • Caddy reloads use --force. Caddy skips a reload when the config text is unchanged, and a reissued certificate keeps the same paths, so without it Caddy kept serving the old certificate.
  • Error hint: "CA certificate not found" now points at ingot global start, which creates the CA, instead of ingot cert install, which can't.

Testing

  • go build ./..., GOOS=windows go build ./cmd, go vet ./... and go test ./... all pass.
  • I built the image for both architectures. On a throwaway volume, the CA came out with the expected subject and extensions, a leaf certificate passed openssl verify against it, and running the image again changed nothing. The arm64 image's openssl binary is aarch64.
  • I tested the PowerShell exit-code logic in mcr.microsoft.com/powershell, using strings in place of the Cert: drive.
  • Not tested yet: a full ingot run against the real stack, because it needs the release image, and anything on macOS or Windows.

Rollout

  1. Release. release.sh pushes ingot-openssl:<version>. Until a release exists, a build of this branch has no image to pull: the pin works the same way as ingot-idle's. The new GHCR package starts out private, so make it public right after the first push.
  2. Existing installs need a manual migration. There's deliberately none in code, because the maintainer is the only user, the same call as the Ingot rename. To migrate:
    • Run ingot global restart. It generates the new CA beside the old one, and rewrites the base Caddyfile so Caddy's pki root points at it.
    • Clear Caddy's stored pki/authorities/ingot intermediate so it re-signs under the new root.
    • Run ingot cert install to trust the new CA.
    • Run ingot start in each project. The old project certificates don't verify against the new CA, so they're reissued and Caddy reloads them. cert repair alone won't reissue them, because it only fills in missing files.
    • Remove the old CA ("Alias Project CA Self Signed CN") from the system trust store and from NSS, and delete AliasProjectCASelfSigned.* from ingot_certs.
    • Check the catch-all certificate's issuer chain with openssl s_client -connect nothing.test:443 -showcerts.

The CA users trust was "Alias Project CA Self Signed CN", from the 2021
ghcr.io/aliasproject/openssl image, whose source is lost. Rebuild it in
this repo as Dockerfile.openssl + openssl/entrypoint.sh, published by
release.sh as ghcr.io/aliasproject/ingot-openssl:<version> and pinned by
config.OpensslImage, like ingot-idle. Overwriting openssl:latest would
break the 2.0.0 CLI, which looks for the old file names.

The new CA is CN "Ingot Local CA", O "Alias Project", valid for ten
years with explicit CA extensions. Leaf certs gain the serverAuth EKU
Apple platforms require and drop the aliasproject.ssl email addresses.
Generating the CA alone no longer leaves init.test files behind.

The CA's names now come from constants in ssl, which also fixes the
macOS keychain lookups (they searched for "AliasProjectCASelfSigned",
which never matched the cert's name), and the Windows trust check no
longer reports the CA as installed when nothing matches.
Review findings on #9:
- Without p11-kit, IsCertificateInstalled only checks that
  /usr/local/share/ca-certificates/ingot-ca.crt exists, which is where
  the old Alias Project CA was installed, so an upgraded Debian/Ubuntu
  machine reported the new CA as trusted. Install it as
  ingot-local-ca.crt instead.
- The entrypoint generated each of key, csr and crt only when that file
  was missing, so a missing key with a leftover csr/crt gave a crt that
  didn't match the new key. A new key now drops both.
- The Caddyfile's pki name now comes from ssl.CAName.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1 (fresh-context reviewer, code-review at high effort)

Confirmed holding:

  • The CA-only run, and the CA and leaf certificate fields and extensions. The leaf passes openssl verify -x509_strict -purpose sslserver.
  • The arm64 build without QEMU.
  • Caddy's pki root reads the new file names.
  • No references to the old image, the old names or DOMAIN=init remain.
  • The macOS, Windows, p11-kit and NSS lookups are correct for a fresh install.
  • CLAUDE.md matches the code.
Finding Outcome
P2: ingot-openssl:2.0.0 doesn't exist, so a build before the next release can't pull it Declined (code). Version pinning is deliberate and works the same way as ingot-idle: release.sh pushes the image before publishing. Added to Rollout, along with making the new package public after its first push.
P2: the Debian fallback trust check only tests ingot-ca.crt, the old CA's path Fixed in c42226e. The CA is now installed as ingot-local-ca.crt.
P2: no migration leaves two CAs in use at once, and cert repair won't reissue old project certs Declined (code). Skipping migration is deliberate, since the maintainer is the only user. The manual steps are now in the PR description's Rollout section.
P3: a missing key with a leftover csr/crt produces a crt that doesn't match the key Fixed in c42226e. Reproduced before the fix (key and crt mismatch) and confirmed fixed after.
P3: raw exec.Command("docker", …) in GenerateCertificate Declined. It predates this PR, which only changed the image string.
P3: the Caddyfile hardcodes name "Ingot Local CA" Fixed in c42226e. It now uses ssl.CAName, and the entrypoint has a comment pointing to the Go constants.
Unconfirmed: Caddy may keep an intermediate signed by the old root Will be checked during the maintainer's migration (s_client), and Caddy's stored intermediate cleared there. Added to Rollout.

Review round 2 on #9:
- A regenerated CA left every existing <project>.test.crt in place,
  signed by the CA that no longer exists, and nothing reissued them. The
  entrypoint now reissues a crt that fails to verify against the CA or
  expires within 30 days; `ingot start` runs it every time, so this
  also renews certs before their 825 days run out.
- Caddy skips `caddy reload` when the config text is unchanged, which is
  the case after a reissue, so it kept serving the old cert. Reload with
  --force.
- "CA certificate not found" pointed at `ingot cert install`, which can't
  create the CA; `ingot global start` does.
- Drop RemoveProjectSSL's comment about stale csrs, which the previous
  commit made untrue, and update the entrypoint's header.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 2 (fresh-context reviewer, focus on c42226e)

Confirmed holding:

  • All ingot-ca.crt uses moved to linuxCAFile, and update-ca-certificates accepts the new name.
  • The entrypoint behaves correctly on fresh, rerun, missing-key and missing-crt runs.
  • The Caddyfile's name concatenation is valid.

No P1 or P2 findings.

Finding Outcome
P3: RemoveProjectSSL's comment and the entrypoint header no longer describe the image's behavior Fixed in f344fca.
P3: a regenerated CA leaves old project certs in place, unverifiable (a new argument, separate from decline #2) Fixed in f344fca. The entrypoint reissues a crt that fails openssl verify against the CA or expires within 30 days, and ingot start runs it every time. Tested on a throwaway volume for fresh, rerun (same serial), CA regenerated, cert expiring in 10 days, and key deleted: each reissued cert verifies and matches its key. I also found that caddy reload skips an unchanged config, so a reissued cert wouldn't be picked up. reloadCaddy now passes --force.
P3: the Rollout steps run cert install before anything generates the new CA Fixed in the description, which now starts with ingot global restart. Also fixed the "CA certificate not found. Run 'ingot cert install' first" hint, which now says ingot global start (f344fca).
P3: the trust checks match on the CA's name only, never its fingerprint Declined. The pattern predates this PR. The migration removes the old CA, and fingerprint matching would be a separate change.

Review round 3 on #9: a reissue re-signed the existing csr, so certs
migrated from the old image kept emailAddress=<domain>@aliasproject.ssl
in their subject. Drop the csr with the crt so both are rebuilt from the
kept key.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 3 (final; fresh-context reviewer, focus on f344fca)

Confirmed holding, tested in throwaway containers:

  • Reissue logic: a fresh run issues a cert, and a rerun leaves it unchanged. A regenerated CA, a cert expiring in 10 days, and a garbage crt are each reissued. set -e doesn't fire inside ! { …; }.
  • caddy reload --force: a plain reload kept serving the old serial, while --force served the reissued cert, with no errors. A forced reload uses the same graceful path every vhost write already triggers.
  • The new hint: ingot global start does generate the CA.
  • Comments and Rollout steps: they match the code.
Finding Outcome
P3: a reissue re-signed the old csr, so certs migrated from the 2021 image kept emailAddress=<domain>@aliasproject.ssl Fixed in the latest commit. The csr is now dropped along with the crt. Reproduced with a cert from openssl:latest: after the fix it's reissued as CN=bar.test under Ingot Local CA, it verifies, and it matches its key.

This closes the loop after three rounds. The latest fix is a one-line change to the reissue branch, and I tested it directly instead of running another review round.

@michaelaguiar
michaelaguiar marked this pull request as ready for review October 19, 2026 22:20
@michaelaguiar
michaelaguiar merged commit 641cb31 into main Oct 19, 2026
@michaelaguiar
michaelaguiar deleted the ingot-local-ca branch October 28, 2026 11:51
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