auth

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package auth resolves SSH connections into AgentBBS identities (PRD §4.4).

Index

Constants

This section is empty.

Variables

View Source
var AdminNames = map[string]bool{"admin": true, "sysop": true, "root": true}

AdminNames are usernames that route to the privileged admin console (PRD §6). The route only opens for accounts whose name is in the operator allowlist (see IsAdmin); the name itself confers nothing — so "root" is just a familiar alias here, not a backdoor.

View Source
var DomainNames = map[string]bool{"domain": true, "domains": true}

DomainNames are usernames that route to the custom-domain self-service flow: list/add/remove the domains pointed at a member's homepage.

View Source
var FilesAdminNames = map[string]bool{"sftp": true, "sftpadmin": true, "filesadmin": 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.

View Source
var GameNames = map[string]bool{"game": true, "games": true}

GameNames are usernames that route to AgentGames: the line-delimited-JSON agent-vs-agent match protocol (PRD §5.2). `play@` stays a guest hub alias.

View Source
var GopherNames = map[string]bool{"gopher": 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).

View Source
var GuestNames = map[string]bool{"bbs": true, "play": true, "guest": true}

GuestNames are usernames that always map to an anonymous guest hub session.

View Source
var IRCNames = map[string]bool{"irc": true}

IRCNames is kept only to reserve "irc" as an account/subdomain name: the BBS hosts its own IRC network at irc.<domain> but there is no in-BBS irc@ route — members connect with an external client. (Distinct from tor-irc@.)

View Source
var JoinNames = map[string]bool{"join": true, "signup": true, "register": true}

JoinNames are usernames that trigger the onboarding flow: register the visitor's public key, print instructions, and disconnect.

View Source
var MailNames = map[string]bool{"mail": true}

MailNames route a Founding Lifetime (paid) member into the AgentMail client — an interactive TUI with a PTY, or a JSON bot mode with a command/no PTY.

View Source
var MsgNames = map[string]bool{"msg": true, "message": true}

MsgNames route a member-to-member message: `ssh msg@host <user>` leaves a note in the recipient's BBS inbox (store-and-forward, see the Members plugin).

View Source
var NewsNames = map[string]bool{"news": true}

NewsNames route a member into the BBS's own (members-only) Usenet/NNTP server via an in-process newsreader. Free for any registered member, like irc@.

View Source
var PasswdNames = map[string]bool{"passwd": true, "password": true}

PasswdNames route a member into the self-service password reset: a key-gated flow that sets ONE new password across every downstream service that has its own credential — git (Forgejo), mail (Mailu webmail), and chat (IRC/The Lounge). Because the member is authenticated by their registered SSH key, this doubles as the "forgot password" path: no old password is required.

View Source
var PodNames = map[string]bool{"pod": true}

PodNames are usernames that route to a personal pod instead of the hub. Pod access requires an active paid membership (PRD pods addendum).

View Source
var TorIRCNames = map[string]bool{"tor-irc": true}

TorIRCNames route to an interactive IRC-over-Tor client in the member's pod.

View Source
var TorNames = map[string]bool{"tor": true}

TorNames route to the generic "run a command over Tor" passthrough in the member's pod (premium). Checked after the more specific tor-* routes.

View Source
var TorURLNames = map[string]bool{"tor-url": true}

TorURLNames route to the one-shot "fetch a URL over Tor" command (premium).

Functions

func Admins

func Admins() map[string]bool

Admins returns the operator-configured admin allowlist: the lowercased, comma/space-separated account names in $AGENTBBS_ADMINS. Admin status can only be granted by the operator (via env), never self-assigned in-band.

func Fingerprint

func Fingerprint(key ssh.PublicKey) string

Fingerprint returns the SHA256 fingerprint for a session public key, or "".

func FingerprintAuthorizedKey added in v0.1.1

func FingerprintAuthorizedKey(authorizedKey string) (string, error)

FingerprintAuthorizedKey parses an OpenSSH authorized_keys line (e.g. "ssh-ed25519 AAAA… comment") and returns its SHA256 fingerprint — the same value Fingerprint produces for a live session key. Used to provision a member from a public key supplied out of band (e.g. the extension store). Any trailing options/comment are ignored.

func IsAdmin

func IsAdmin(name string) bool

IsAdmin reports whether the account name is in the operator allowlist.

func IsAdminName

func IsAdminName(u string) bool

IsAdminName reports whether the SSH username requests the admin console.

func IsDomainName

func IsDomainName(u string) bool

IsDomainName reports whether the SSH username requests the custom-domain flow.

func IsFilesAdminName added in v0.1.1

func IsFilesAdminName(u string) bool

IsFilesAdminName reports whether the SSH username requests the SFTP server management TUI (operator-gated).

func IsGameName

func IsGameName(u string) bool

IsGameName reports whether the SSH username requests the AgentGames protocol.

func IsGopherName added in v0.1.1

func IsGopherName(u string) bool

IsGopherName reports whether the SSH username requests the hedgehog gopher browser (the SSH-authenticated gopher surface).

func IsGuestName

func IsGuestName(u string) bool

IsGuestName reports whether the SSH username requests anonymous hub access.

func IsJoinName

func IsJoinName(u string) bool

IsJoinName reports whether the SSH username requests onboarding.

func IsMailName added in v0.1.1

func IsMailName(u string) bool

IsMailName reports whether the SSH username requests the AgentMail client.

func IsMsgName added in v0.1.1

func IsMsgName(u string) bool

IsMsgName reports whether the SSH username requests the messaging route.

func IsNewsName

func IsNewsName(u string) bool

IsNewsName reports whether the SSH username requests the in-BBS newsreader.

func IsPasswdName added in v0.1.1

func IsPasswdName(u string) bool

IsPasswdName reports whether the SSH username requests the password reset flow.

func IsPodName

func IsPodName(u string) bool

IsPodName reports whether the SSH username requests the pod route.

func IsReservedName

func IsReservedName(name string) bool

IsReservedName reports whether name is claimed by a route or infra label and therefore cannot be used as a member's account name.

func IsTorIRCName

func IsTorIRCName(u string) bool

IsTorIRCName reports whether the SSH username requests the tor-irc client.

func IsTorName

func IsTorName(u string) bool

IsTorName reports whether the SSH username requests the generic tor passthrough.

func IsTorURLName

func IsTorURLName(u string) bool

IsTorURLName reports whether the SSH username requests the tor-url fetch.

func SanitizeUsername

func SanitizeUsername(raw string) (string, bool)

SanitizeUsername normalizes a requested account name to the charset the hub and per-user subdomains allow: lowercased [a-z0-9-], 3–20 chars, with '_' and spaces folded to '-', no doubled, leading, or trailing dashes. It returns the cleaned name and whether it is usable (right length and not reserved).

Types

type Kind

type Kind string

Kind classifies an identity.

const (
	Guest  Kind = "guest"
	Member Kind = "member"
	Agent  Kind = "agent"
)

func KindFor

func KindFor(username string) Kind

KindFor infers the identity kind from a (non-guest) username. Usernames prefixed "agent-" are automated clients (PRD §3).

type User

type User struct {
	Name     string
	Kind     Kind
	PubKeyFP string // SHA256 fingerprint, empty for guests without a key
	StoreID  int64  // 0 for guests
}

User is the resolved identity for one session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL