mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-12-01 17:24:48 +00:00
feat(join): agent signup over ssh join@ + NNTPS token auth + llms.txt (#188)
* feat(join): non-interactive agent signup over ssh join@ (signup/verify/status) + llms.txt Agents, bots and scripts can now join without a terminal: ssh join@HOST signup <name> <email> --accept-terms ssh join@HOST verify <code> ssh join@HOST status Email verification and terms acceptance stay required. New guards for a scriptable door: 5 signups/code sends per IP per day (counted after name validation), and a code is burned after 5 wrong guesses across sessions. Welcome output now points at pfs.announce and earning on c0mpute (5% fee). setup.sh publishes /llms.txt describing the agent flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 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> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c6ffccdc87
commit
3bb2662bbe
9 changed files with 436 additions and 20 deletions
|
|
@ -36,6 +36,12 @@ func (f *fakeStore) UserByName(name string) (store.User, bool, error) {
|
|||
u, ok := f.users[name]
|
||||
return u, ok, nil
|
||||
}
|
||||
func (f *fakeStore) UserByToken(token string) (string, bool, error) {
|
||||
if token == "alice-token" {
|
||||
return "alice", true, nil
|
||||
}
|
||||
return "", false, nil
|
||||
}
|
||||
func (f *fakeStore) EnsureNewsGroup(name, desc string) error {
|
||||
if _, ok := f.groups[name]; !ok {
|
||||
f.groups[name] = store.NewsGroup{Name: name, Description: desc, Posting: true}
|
||||
|
|
@ -169,3 +175,21 @@ func TestPostStampsFromAndNumbers(t *testing.T) {
|
|||
t.Fatalf("reconstructed body wrong: %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthenticateRequiresTokenOnPublicListener(t *testing.T) {
|
||||
pub := &backend{st: newFakeStore(), host: "news.test", requireToken: true}
|
||||
if _, err := pub.Authenticate("alice", "anything"); err == nil {
|
||||
t.Fatal("public listener must reject a non-token password")
|
||||
}
|
||||
if _, err := pub.Authenticate("bob", "alice-token"); err == nil {
|
||||
t.Fatal("a token must only log in its own member")
|
||||
}
|
||||
b, err := pub.Authenticate("alice", "alice-token")
|
||||
if err != nil || !b.Authorized() {
|
||||
t.Fatalf("alice with her token must log in: %v", err)
|
||||
}
|
||||
loop := &backend{st: newFakeStore(), host: "news.test"}
|
||||
if _, err := loop.Authenticate("alice", "ignored"); err != nil {
|
||||
t.Fatalf("loopback keeps trusting the SSH-authenticated name: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue