fix(sites): let the ask endpoint approve the news host

news.bbs.profullstack.com has its own Caddy site block so Caddy can get
it a Let's Encrypt cert for NNTPS on :563. But it also falls under the
*.bbs.profullstack.com on-demand-TLS block, so Caddy asks agentbbs before
issuing, and the ask handler only approved members and mapped custom
domains. "news" is neither, so it got a 404 and never got a cert. The
news-certs timer then failed forever, and :563 kept serving the
self-signed bootstrap cert, which expired on 2026-09-12.

The handler now also approves the BBS's own service hosts. For now that
is only AGENTBBS_NEWS_HOST. Arbitrary names still 404, so this is still
not an open cert relay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
riotcoder 2026-10-06 05:21:42 +00:00
parent 7d86e0ad1e
commit 59074ffbfe
2 changed files with 20 additions and 4 deletions

View file

@ -205,6 +205,7 @@ func TestSyncRemovesStaleDomainEntries(t *testing.T) {
func TestAskUserSubdomain(t *testing.T) {
t.Setenv("AGENTBBS_HOST", "bbs.profullstack.com")
t.Setenv("AGENTBBS_NEWS_HOST", "news.bbs.profullstack.com")
dir := t.TempDir()
st, err := store.Open(filepath.Join(dir, "test.db"))
if err != nil {
@ -229,6 +230,7 @@ func TestAskUserSubdomain(t *testing.T) {
{"nobody.bbs.profullstack.com", http.StatusNotFound}, // no such user
{"a.b.bbs.profullstack.com", http.StatusNotFound}, // multi-label, not a user subdomain
{"bbs.profullstack.com", http.StatusNotFound}, // apex is not a user subdomain
{"news.bbs.profullstack.com", http.StatusOK}, // the BBS's own news host, not a member
} {
rec := httptest.NewRecorder()
req := httptest.NewRequest("GET", "/check?domain="+c.domain, nil)