From 67f02347a996e219a843315c31827a81f41ad594 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sat, 14 Nov 2026 22:19:17 -0700 Subject: [PATCH 1/2] Certificates guide: reuse the installer's HTTP-01 account, and ask port 80 or 443 (2026) The 2026 series' side of #209. The guide only knew DNS-01 and TLS-ALPN-01, so on an installer setup it never reused the installer's HTTP-01 Let's Encrypt account and always added a TLS-ALPN-01 one, which can't validate while the installer's web server holds port 443. The Account step now asks how Let's Encrypt reaches the server for names checked without DNS: port 80 (HTTP-01) or port 443 (TLS-ALPN-01), starting on port 80 when an HTTP-01 account exists. The texts that said port 443 say the chosen port. Fixes #206 --- .../certificates/CertificateSetupPage.tsx | 21 +++++--- src/features/certificates/DirectChoice.tsx | 48 +++++++++++++++++++ src/features/certificates/direct.test.ts | 25 ++++++++++ src/features/certificates/direct.ts | 29 +++++++++++ src/i18n/en.json | 13 +++-- 5 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 src/features/certificates/DirectChoice.tsx create mode 100644 src/features/certificates/direct.test.ts create mode 100644 src/features/certificates/direct.ts diff --git a/src/features/certificates/CertificateSetupPage.tsx b/src/features/certificates/CertificateSetupPage.tsx index c212b52..f15d110 100644 --- a/src/features/certificates/CertificateSetupPage.tsx +++ b/src/features/certificates/CertificateSetupPage.tsx @@ -8,7 +8,8 @@ * inbuxa: guided setup, "Certificates, automatically" (settings-reorg, first * wave). Picks domains, checks every name the certificate will cover before * anything is ordered, chooses how Let's Encrypt checks them (through DNS - * when the domain's DNS is connected, otherwise on port 443), switches the + * when the domain's DNS is connected, otherwise on port 80 or 443: an + * existing HTTP-01 account, as the installer makes, picks port 80), switches the * domains to automatic, and watches the certificates arrive. */ @@ -30,10 +31,11 @@ import { dohQuery, RESOLVER_NAME } from '@/features/dns/liveCheck'; import { parseZone } from '@/features/dns/zone'; import { cn } from '@/lib/utils'; import { classify, orderNames, type Method, type NameState } from './names'; +import { challengeOf, defaultDirect, type Direct, PORT } from './direct'; +import { DirectChoice } from './DirectChoice'; const LE_PRODUCTION = 'https://acme-v02.api.letsencrypt.org/directory'; const LE_STAGING = 'https://acme-staging-v02.api.letsencrypt.org/directory'; -const CHALLENGE: Record = { dns: 'Dns01', tls: 'TlsAlpn01' }; const WATCH_MS = 5 * 60_000; interface DomainRow { @@ -174,6 +176,7 @@ export function CertificateSetupPage() { const [anyway, setAnyway] = useState>(new Set()); const [staging, setStaging] = useState(false); const [contact, setContact] = useState(''); + const [direct, setDirect] = useState('TlsAlpn01'); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const [startedAt, setStartedAt] = useState(null); @@ -189,6 +192,7 @@ export function CertificateSetupPage() { setData(d); setPicked(new Set(d.domains.filter((x) => !x.automatic).map((x) => x.id))); setContact(d.providers.find((p) => p.contact.length > 0)?.contact[0] ?? ''); + setDirect(defaultDirect(d.providers)); }) .catch((e: unknown) => live && setLoadError(e instanceof Error ? e.message : String(e))); return () => { @@ -260,8 +264,9 @@ export function CertificateSetupPage() { const directory = staging ? LE_STAGING : LE_PRODUCTION; const methodsNeeded = [...new Set(going.map(methodOf))]; const providerFor = (m: Method) => - data?.providers.find((p) => p.directory === directory && p.challengeType === CHALLENGE[m]); + data?.providers.find((p) => p.directory === directory && p.challengeType === challengeOf(m, direct)); const needsNewProvider = methodsNeeded.some((m) => !providerFor(m)); + const port = PORT[direct]; const poll = useCallback(async () => { const [certRes] = await jmapRequest([ @@ -328,7 +333,7 @@ export function CertificateSetupPage() { create: { acme: { directory, - challengeType: CHALLENGE[m], + challengeType: challengeOf(m, direct), contact: { [contact.trim()]: true }, // No description: the server writes it, and refuses one from a client. }, @@ -417,7 +422,8 @@ export function CertificateSetupPage() {

{t( 'certSetup.howTls', - 'Otherwise Let’s Encrypt connects to this server on port 443 for each name. Those names must point straight at this server, not through a proxy.', + 'Otherwise Let’s Encrypt connects to this server on port {{port}} for each name. Those names must point straight at this server, not through a proxy.', + { port }, )}

@@ -461,7 +467,7 @@ export function CertificateSetupPage() { : t('certSetup.noCert', 'No certificate yet.')}{' '} {methodOf(d) === 'dns' ? t('certSetup.viaDns', 'Checked through DNS.') - : t('certSetup.viaTls', 'Checked on port 443.')} + : t('certSetup.viaTls', 'Checked on port {{port}}.', { port })} @@ -612,6 +618,7 @@ export function CertificateSetupPage() { } > + {methodsNeeded.includes('tls') && } {needsNewProvider ? (
@@ -698,7 +705,7 @@ export function CertificateSetupPage() { how: methodOf(d) === 'dns' ? t('certSetup.howDnsWord', 'through DNS') - : t('certSetup.howTlsWord', 'on port 443'), + : t('certSetup.howTlsWord', 'on port {{port}}', { port }), names: namesOf(d).join(', '), }, )} diff --git a/src/features/certificates/DirectChoice.tsx b/src/features/certificates/DirectChoice.tsx new file mode 100644 index 0000000..2ecc180 --- /dev/null +++ b/src/features/certificates/DirectChoice.tsx @@ -0,0 +1,48 @@ +/* + * SPDX-FileCopyrightText: 2026 Coffey Labs LLC + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/** + * inbuxa: how Let’s Encrypt reaches this server for names checked without + * DNS, port 80 or port 443 (#206). The certificates guide asks it. + */ + +import { useTranslation } from 'react-i18next'; +import type { Direct } from './direct'; + +export function DirectChoice({ value, onChange }: { value: Direct; onChange: (v: Direct) => void }) { + const { t } = useTranslation(); + const choice = (v: Direct, title: string, body: string) => ( + + ); + return ( +
+ + {t('certSetup.directTitle', 'How Let’s Encrypt reaches this server')} + + {choice( + 'Http01', + t('certSetup.directHttp', 'Port 80 (HTTP-01)'), + t( + 'certSetup.directHttpHint', + 'A web server in front of this one holds port 443 and passes /.well-known/acme-challenge/ on port 80 to it. The installer sets it up this way.', + ), + )} + {choice( + 'TlsAlpn01', + t('certSetup.directTls', 'Port 443 (TLS-ALPN-01)'), + t('certSetup.directTlsHint', 'This server answers HTTPS on port 443 itself.'), + )} +
+ ); +} diff --git a/src/features/certificates/direct.test.ts b/src/features/certificates/direct.test.ts new file mode 100644 index 0000000..7ee2951 --- /dev/null +++ b/src/features/certificates/direct.test.ts @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2026 Coffey Labs LLC + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { describe, expect, it } from 'vitest'; +import { challengeOf, defaultDirect, PORT } from './direct'; + +describe('certificate accounts (#206)', () => { + it('prefers port 80 when the server has an HTTP-01 account, as an installer setup does', () => { + expect(defaultDirect([{ challengeType: 'Http01' }])).toBe('Http01'); + expect(defaultDirect([{ challengeType: 'TlsAlpn01' }, { challengeType: 'Http01' }])).toBe('Http01'); + expect(defaultDirect([{ challengeType: 'TlsAlpn01' }, { challengeType: 'Dns01' }])).toBe('TlsAlpn01'); + expect(defaultDirect([])).toBe('TlsAlpn01'); + expect(PORT.Http01).toBe(80); + expect(PORT.TlsAlpn01).toBe(443); + }); + + it('asks for the challenge that matches the way names are checked', () => { + expect(challengeOf('dns', 'Http01')).toBe('Dns01'); + expect(challengeOf('tls', 'Http01')).toBe('Http01'); + expect(challengeOf('tls', 'TlsAlpn01')).toBe('TlsAlpn01'); + }); +}); diff --git a/src/features/certificates/direct.ts b/src/features/certificates/direct.ts new file mode 100644 index 0000000..ca3e2a1 --- /dev/null +++ b/src/features/certificates/direct.ts @@ -0,0 +1,29 @@ +/* + * SPDX-FileCopyrightText: 2026 Coffey Labs LLC + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/** + * inbuxa: how Let’s Encrypt reaches this server for names checked without + * DNS: HTTP-01 on port 80, or TLS-ALPN-01 on port 443. The server answers + * either. Behind a web server that holds 443, only HTTP-01 works: the + * installer's Caddy forwards /.well-known/acme-challenge/ on port 80 to the + * server, and the installer makes an HTTP-01 account for it (#206). + */ + +import type { Method } from './names'; + +export type Direct = 'Http01' | 'TlsAlpn01'; + +export const PORT: Record = { Http01: 80, TlsAlpn01: 443 }; + +/** HTTP-01 when the server already has an account for it, as an installer setup does; otherwise TLS-ALPN-01. */ +export function defaultDirect(providers: { challengeType: string }[]): Direct { + return providers.some((p) => p.challengeType === 'Http01') ? 'Http01' : 'TlsAlpn01'; +} + +/** The challenge type an account needs for one way of checking names. */ +export function challengeOf(method: Method, direct: Direct): string { + return method === 'dns' ? 'Dns01' : direct; +} diff --git a/src/i18n/en.json b/src/i18n/en.json index 9d06be6..de3906a 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -657,7 +657,7 @@ "subtitle": "Free certificates from Let’s Encrypt for your domains, renewed by the server before they expire.", "howTitle": "How the server proves it’s yours", "howDns": "A domain whose DNS is connected is checked through DNS: the certificate covers the domain and everything under it (*.domain), and nothing needs to reach this server.", - "howTls": "Otherwise Let’s Encrypt connects to this server on port 443 for each name. Those names must point straight at this server, not through a proxy.", + "howTls": "Otherwise Let’s Encrypt connects to this server on port {{port}} for each name. Those names must point straight at this server, not through a proxy.", "noDomains": "There are no domains yet.", "addDomain": "Add one first", "alreadyAuto": "Already automatic.", @@ -665,7 +665,7 @@ "validUntil": "Current certificate valid until {{date}}.", "noCert": "No certificate yet.", "viaDns": "Checked through DNS.", - "viaTls": "Checked on port 443.", + "viaTls": "Checked on port {{port}}.", "checkedWith": "How this is checked", "checkedHow": "Each name is looked up in public DNS through {{resolver}}, and compared with where {{server}} points. Nothing is ordered yet.", "thisServer": "this server", @@ -699,7 +699,7 @@ "stagingWord": "staging ", "domainAuto": "{{domain}} gets its certificate automatically, checked {{how}}: {{names}}.", "howDnsWord": "through DNS", - "howTlsWord": "on port 443", + "howTlsWord": "on port {{port}}", "skipped": "Left as they are until their names are fixed: {{names}}.", "issued": "Issued. Valid until {{date}}.", "failed": "Failed.", @@ -710,7 +710,12 @@ "after": "The server renews each certificate well before it expires. Failed renewals show under Management › Tasks › Failed.", "keepWatching": "Keep watching", "watchingHint": "Checking every few seconds. Most certificates arrive within a minute.", - "tabTitle": "Certificates" + "tabTitle": "Certificates", + "directTitle": "How Let’s Encrypt reaches this server", + "directHttp": "Port 80 (HTTP-01)", + "directHttpHint": "A web server in front of this one holds port 443 and passes /.well-known/acme-challenge/ on port 80 to it. The installer sets it up this way.", + "directTls": "Port 443 (TLS-ALPN-01)", + "directTlsHint": "This server answers HTTPS on port 443 itself." }, "overview": { "first": "First record", -- 2.54.0 From 292b6f46347ff67b36c0b227ff0baac11908bd5f Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sat, 14 Nov 2026 22:20:04 -0700 Subject: [PATCH 2/2] Version 2026.10.26.7 --- CHANGELOG.md | 13 +++++++++++++ inbuxa-version.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8485aa..b6e1ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,19 @@ https://git.coffeylabs.org/inbuxa/inbuxa-admin/releases. Every version PR adds that version's entry here. CI refuses a version this file has no entry for (`tools/changelog-check.sh`). +## [2026.10.26.7] - 2026-11-15 + +A fix to the certificates guide for the 2026 series; 27.1 gets it in its +next release candidate. + +### Fixed +- Certificates guide: on a server set up by the installer, the guide now + reuses the installer's Let's Encrypt account (HTTP-01, on port 80) instead + of adding one that checks names on port 443, which can't work while the + installer's web server holds that port. The Account step asks how Let's + Encrypt reaches the server, port 80 or port 443, and starts on port 80 + when such an account exists. (#206) + ## [2026.10.26.6] - 2026-11-15 A fix to the certificates guide for the 2026 series, the same as in diff --git a/inbuxa-version.json b/inbuxa-version.json index 2d31a12..6fb7c9f 100644 --- a/inbuxa-version.json +++ b/inbuxa-version.json @@ -1,3 +1,3 @@ { - "version": "2026.10.26.6" + "version": "2026.10.26.7" } -- 2.54.0