mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 22:37:28 +00:00
feat(gopher): serve BBS content over Gopher + SSH-authenticated "hedgehog" (#83)
Add Gopher (RFC 1436) as a co-located protocol service, following the
internal/news pattern. Two surfaces share one read-only Resolve engine:
- Public Gopher on :70 (RFC 1436) for any gopher client (lynx, Lagrange).
Classic gopher is stateless with no auth verb, so this surface serves
only public content.
- `ssh gopher@` = "hedgehog": the same gopher wire semantics carried over
the authenticated SSH channel (the member's key is the credential), so it
additionally reaches members-only selectors. Gopher where gopher can,
our own gopher-like thing over SSH where it can't.
Menus surface the member directory + homepages (public_html), an About page
(brand + MOTD), public newsgroups (allowlisted on :70, all groups on
hedgehog), and members' public files. Selectors are confined to each member's
area (path-traversal guarded). New AGENTBBS_GOPHER* env vars; docs/gopher.md
and README updated (incl. the setcap note for binding privileged :70).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9d0c0a0193
commit
ad76e7fa16
9 changed files with 1346 additions and 3 deletions
|
|
@ -70,6 +70,12 @@ var NewsNames = map[string]bool{"news": true}
|
|||
// an interactive TUI with a PTY, or a JSON bot mode with a command/no PTY.
|
||||
var MailNames = map[string]bool{"mail": true}
|
||||
|
||||
// GopherNames route a member into "hedgehog": the SSH-authenticated gopher
|
||||
// browser (see internal/gopher). Free for any registered member, like news@.
|
||||
// The public, unauthenticated Gopher surface is the port-70 listener, not a
|
||||
// route here (RFC 1436 has no auth verb — see internal/gopher for the rationale).
|
||||
var GopherNames = map[string]bool{"gopher": true}
|
||||
|
||||
// FilesAdminNames route an operator into the SFTP server management TUI. Members
|
||||
// transfer files via the "sftp" subsystem (sftp files@<host>); this interactive
|
||||
// route is the operator console and is gated by the admin allowlist.
|
||||
|
|
@ -109,6 +115,10 @@ func IsNewsName(u string) bool { return NewsNames[strings.ToLower(u)] }
|
|||
// IsMailName reports whether the SSH username requests the AgentMail client.
|
||||
func IsMailName(u string) bool { return MailNames[strings.ToLower(u)] }
|
||||
|
||||
// IsGopherName reports whether the SSH username requests the hedgehog gopher
|
||||
// browser (the SSH-authenticated gopher surface).
|
||||
func IsGopherName(u string) bool { return GopherNames[strings.ToLower(u)] }
|
||||
|
||||
// IsFilesAdminName reports whether the SSH username requests the SFTP server
|
||||
// management TUI (operator-gated).
|
||||
func IsFilesAdminName(u string) bool { return FilesAdminNames[strings.ToLower(u)] }
|
||||
|
|
@ -147,7 +157,7 @@ func IsReservedName(name string) bool {
|
|||
n := strings.ToLower(name)
|
||||
if GuestNames[n] || PodNames[n] || JoinNames[n] || DomainNames[n] || AdminNames[n] ||
|
||||
TorURLNames[n] || TorIRCNames[n] || TorNames[n] || IRCNames[n] || NewsNames[n] ||
|
||||
MailNames[n] || FilesAdminNames[n] || MsgNames[n] || GameNames[n] ||
|
||||
MailNames[n] || GopherNames[n] || FilesAdminNames[n] || MsgNames[n] || GameNames[n] ||
|
||||
PasswdNames[n] || systemReserved[n] {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue