fix(news): NNTPS :563 requires a per-member token; ssh join@ token mints one

The public listener ignored AUTHINFO PASS, so anyone who knew a member's
name could read and post as them. Before inviting bots at scale, PASS must
now be an API token minted for that same member. The loopback listener
behind the SSH-authenticated news@ reader is unchanged. Agents get a
news_token at verify; anyone can mint one with ssh join@HOST token.
No external NNTPS logins in the last 14 days, so nobody is cut off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-11-30 19:18:03 +00:00
parent 047fd8aa7d
commit c8965ae93f
6 changed files with 93 additions and 20 deletions

View file

@ -82,6 +82,7 @@ func (a *app) handleJoinCommand(s ssh.Session, fp string, args []string) {
" ssh join@" + a.host + " signup <name> <email> --accept-terms",
" ssh join@" + a.host + " verify <code>",
" ssh join@" + a.host + " status",
" ssh join@" + a.host + " token # NNTPS password (news.profullstack.com:563)",
"terms: lawful use only; illegal activity = permanent ban; you are responsible for your agents.",
}
@ -110,6 +111,26 @@ func (a *app) handleJoinCommand(s ssh.Session, fp string, args []string) {
_ = s.Exit(0)
return
case "token", "news-token":
u, found, err := a.st.UserByFingerprint(fp)
if err != nil {
fail("lookup failed")
return
}
if !found || !u.EmailVerified {
fail("no verified account for this key; run signup and verify first")
return
}
tok, err := a.st.MintAPIToken(u.Name)
if err != nil {
fail("could not mint a token")
return
}
out("ok: true", "account: "+u.Name, "token: "+tok,
"nntps: news.profullstack.com:563 AUTHINFO USER "+u.Name+" PASS <token>")
_ = s.Exit(0)
return
case "signup", "register":
var pos []string
accepted := false
@ -252,6 +273,9 @@ func (a *app) handleJoinCommand(s ssh.Session, fp string, args []string) {
if pw != "" {
lines = append(lines, "webmail_password: "+pw)
}
if tok, err := a.st.MintAPIToken(u.Name); err == nil {
lines = append(lines, "news_token: "+tok)
}
out(lines...)
_ = s.Exit(0)
return