inbuxa certs: read the mail server's certificate, and with an API key renew it #24

Merged
jcoffey-dev merged 1 commits from feat/certs into main 2026-10-12 22:15:46 +00:00
Owner

The last command of phase 3.

inbuxa certs reports the mail server's own certificate as its mail ports present it (issuer, expiry, names, whether it verifies) and where the mail host resolves. That needs nothing.

With an API key made in the console (--key - or INBUXA_API_KEY, never written down, same as join) it fixes it:

  • a domain on ACME gets a new order. The server doesn't start another by itself once one has failed, typically because DNS wasn't ready during install.
  • a domain not on ACME gets it turned on, when the managed Caddy or your own web server (--proxy snippets) passes the challenges. With no proxy it refuses with the reason.

It then waits until port 993 actually presents the new certificate. --dry-run reports and says what it would do. On a --local install, or a machine with only joined front ends, it says there's nothing for it to do.

A certificate counts as a problem when it's self-signed, expired, for other names, doesn't verify, or has less than a sixth of its lifetime left. That's a fraction rather than a number of days, because Let's Encrypt lifetimes are getting shorter. The lab CA issues 5-day certificates, which caught a fixed 14-day rule.

Install now records the mail host and --local in install.json; older installs fall back to the deployment and the server's environment.

Why a key and not the admin password: the server takes no password on its API once set up (C-23), and turning that back on, as install's setup does, isn't something to do to a live server.

Tested in the lab VM:

  • new e2e/cases/certs.sh: 21/21. Public install with the server on the host, Pebble as the CA, mail host pointed at the wrong address. The install reports no certificate; certs with no key reports self-signed and asks for a key; --dry-run works; a wrong key is refused; a key while DNS is still wrong gives up after 3 min with the log command; with DNS fixed, a new order succeeds and port 993 verifies; the key isn't kept; a re-run says nothing to do.
  • install-public.sh: 20/20
  • go vet and go test ./... are clean, with new unit tests for reading and judging certificates.
The last command of phase 3. `inbuxa certs` reports the mail server's own certificate as its mail ports present it (issuer, expiry, names, whether it verifies) and where the mail host resolves. That needs nothing. With an API key made in the console (`--key -` or `INBUXA_API_KEY`, never written down, same as `join`) it fixes it: - a domain on ACME gets a new order. The server doesn't start another by itself once one has failed, typically because DNS wasn't ready during install. - a domain not on ACME gets it turned on, when the managed Caddy or your own web server (`--proxy snippets`) passes the challenges. With no proxy it refuses with the reason. It then waits until port 993 actually presents the new certificate. `--dry-run` reports and says what it would do. On a `--local` install, or a machine with only joined front ends, it says there's nothing for it to do. A certificate counts as a problem when it's self-signed, expired, for other names, doesn't verify, or has less than a sixth of its lifetime left. That's a fraction rather than a number of days, because Let's Encrypt lifetimes are getting shorter. The lab CA issues 5-day certificates, which caught a fixed 14-day rule. Install now records the mail host and `--local` in install.json; older installs fall back to the deployment and the server's environment. Why a key and not the admin password: the server takes no password on its API once set up (C-23), and turning that back on, as install's setup does, isn't something to do to a live server. Tested in the lab VM: - new `e2e/cases/certs.sh`: 21/21. Public install with the server on the host, Pebble as the CA, mail host pointed at the wrong address. The install reports no certificate; `certs` with no key reports self-signed and asks for a key; `--dry-run` works; a wrong key is refused; a key while DNS is still wrong gives up after 3 min with the log command; with DNS fixed, a new order succeeds and port 993 verifies; the key isn't kept; a re-run says nothing to do. - `install-public.sh`: 20/20 - `go vet` and `go test ./...` are clean, with new unit tests for reading and judging certificates.
jcoffey-dev added 1 commit 2026-10-12 22:06:55 +00:00
Reports what the mail ports present (issuer, expiry, names, whether it
verifies) and where the mail host resolves, which needs nothing. With an API
key made in the console, as join takes one, it starts a new ACME order --
the server doesn't start another by itself once an order has failed --
or turns ACME on where the managed Caddy or the operator's web server passes
the challenges, and waits for the mail ports to present the result.

A certificate is a problem when it is self-signed, expired, for other
names, doesn't verify, or has less than a sixth of its lifetime left: a
fraction, since lifetimes differ (Let's Encrypt's are getting shorter).

Install now records the mail host and --local in install.json; older
installs fall back to the deployment and the server's environment.

e2e/cases/certs.sh: a failed order at install, reported, a wrong key
refused, a key while DNS is wrong, then fixed.
jcoffey-dev merged commit 7476c86ad2 into main 2026-10-12 22:15:46 +00:00
jcoffey-dev deleted branch feat/certs 2026-10-12 22:15:47 +00:00
Sign in to join this conversation.