Commit Graph
120 Commits
Author SHA1 Message Date
Claude d630c4d8b8 Ask modemmenu's auth socket with menu's authd client
internal/menuauth was a copy of the client: D-Modem/menu has it now as
the public package authd, beside the server, so the protocol is in one
place.  cmd/bbs imports github.com/D-Modem/menu/authd; internal/menuauth
goes, its tests with the client in menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRbjf74j8oq9R3PXhA
2026-11-06 03:26:01 +00:00
Claude 1ea5fb8280 Site: docs/wiki as d-modem.github.io/bbs, with a configuration reference
docs/wiki/Configuration-Reference.md lists every section and key of
bbs.conf with its help, default, examples and whether it is live: the
configuration editor's catalog of bbs.conf.sample, written by
go generate ./internal/confedit (confedit.Reference). A test, and the
Pages build, fail when the committed page isn't the one the sample
makes. The sidebar and Configuration link it.

mkdocs.yml builds the wiki's pages into the site with brand's shared
theme (Zensical); page.html URLs keep the wiki's links (Configuration,
SSH#keys) working, as GitHub Pages serves page.html for /page. Home is
the home page. .github/workflows/pages.yml calls brand's site workflow:
a pull request builds it, main deploys it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSqjp9Pn2KBr9N9LAn
2026-11-06 01:22:32 +00:00
Claude 945a3fa6a5 Use github.com/D-Modem/go3270 directly, no replace line
go3270's module path is now github.com/D-Modem/go3270 (D-Modem/go3270#1),
so bbs requires it under that name and imports it there; the replace
of racingmars/go3270 goes. Build, vet and tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSqjp9Pn2KBr9N9LAn
2026-11-05 10:52:33 +00:00
Claude 7399e0fa36 Point repository references at the D-Modem organisation
The repositories moved from Neo-Desktop to the D-Modem GitHub
organisation: D-Modem-RE is now D-Modem/D-Modem, pico-serial is
D-Modem/hardware, modemmenu (PBX-Modem) is D-Modem/menu, bbs-sec is
D-Modem/bbs and go3270-sec is D-Modem/go3270.  Update links, module
paths, submodule URLs and source-location strings to match.  Copyright
notices still name Neo-Desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUwD2JJ5d6fgHmpVTw
2026-10-29 09:02:40 +00:00
Claude 6abf4cf347 Comment and test cleanups
- Comments that named something else now name their own function:
  ircd member, imageboard srcPath and linker, forum when, redirect and
  errNoArea, textui sheetDraw.first; a stray comment in rest.go gone.
- confui: changeLines uses diffLines instead of repeating it.
- nntp: accept_from names are looked up when the configuration loads
  (start and reload), now said in the code and the wiki.
- Tests: tnClient.read grows its buffer for a command split at its end
  (a full buffer read nothing for ever); freeAddr folded into freeTCP;
  zipOf is a helper.
- go3270-sec 6c7224e: its comment fixes and gfxtest tidying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:40:48 +00:00
Claude 2e19c50e9e Small fixes: capital letters, display file reads, script data limit, scans
- app: capital upper-cases the first letter, not its first byte, so an
  error beginning "é" is not mangled.
- screens: readFile reads the whole file (one Read may stop short) and
  still refuses one grown past MaxSize.
- script: data.set's limit check and write are done under one lock, so
  sessions setting new names at once cannot pass the limit.
- store: the scan helpers return nil, not a half-filled value, with an
  error (scanUser already did).
- The validate and edit-user "Lock" actions are capitalized like the
  others; door's unused yn helper removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:32:39 +00:00
Claude e70735b708 Text terminals: menu keys checked, VT52 erasing, sheet keys, long bodies
- Menu takes only an item's key (returned as the item has it), asking
  again for any other without redrawing, as a 3270 does; Enter is still
  "" (none chosen: Back would log off from the top menu).  view.UI's
  Menu doc says so.
- VT52: ED 1 (erase up to the cursor) was sent as ESC J, erasing below;
  it is dropped now, as EL 1 is.  EL 2 erases the whole line from its
  start; ED 3 clears like ED 2.
- A sheet's key line leaves out 3270 PF-only keys instead of writing a
  NUL for them.
- The full-screen editor cuts a body longer than its line limit.
- keyLabel's unreachable branch removed; setTranslator's comment notes
  that Flush settles the old translator (it already did).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:28:08 +00:00
Claude ca664c88ed 3270: every table note line, long questions wrapped, forms paged
- Table showed only its note's first line, losing e.g. offline mail's
  "By FTP" line; the rest (three at most) now go below it, the rows
  moved down for them.
- Confirm put its Y/N field past the screen's edge for a long question;
  the question now wraps and the field follows its last line.
- Form dropped the fields that did not fit, returning their presets as
  if typed; it now pages them with PF7/PF8, keeping what was typed on
  each page, and returns them all on Enter.

Tested end to end with s3270 through a script's table, confirm and form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:22:22 +00:00
Claude 5c945f681d Forum: after signing in, return to the page a form was posted from
needLogin took a POST's Referer only if it began with "/", but browsers
send the whole URL, so a guest always came back to the index.  A
Referer from this host now gives its path and query, checked by safeBack
as the login checks it; any other host's still goes to the index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:18:14 +00:00
Claude ffee2509a2 REST page agrees with the WebSocket; OpenAPI FileAreas has can_download
- POST /api/v1/page that reaches no sysop is now 503 "unavailable" (the
  page withdrawn), as the WebSocket's Page request answers, not 200 with
  waiting false.
- The OpenAPI FileAreas schema lists can_download, which GET
  /file-areas has sent all along.
- HTTP-API wiki notes the 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:15:41 +00:00
Claude f0c76b0765 IRC help banner formatting and messages to self; image-board JSON errors
- ircd: a service's HELP banner goes through ircfmt.Unescape like its
  other lines, so BBSServ's shows bold, not a literal $b.
- ircd: a PRIVMSG or NOTICE to your own nick with no other node of yours
  comes back, as IRC servers do, instead of vanishing.
- imageboard: the JSON API's error names its status ("forbidden",
  "internal server error"), not always "not found".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:12:55 +00:00
Claude cd16468c37 NNTP line limit counts CRLF; Fido toss log and stats tidy
- nntp: a command line may be 512 octets with its CRLF (RFC 3977), but
  the check left the CRLF out, letting 514 through.
- fido: echomail whose MSGID makes no valid Message-ID is logged when
  dropped, not only counted as bad.
- fido: TossStats.Forwarded removed: nothing is routed, so it was never
  set nor shown.
- fido: originPattern's comment describes it, not originAddr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:09:20 +00:00
Claude b691817f13 Forget the quietest failed-login sources first, not random ones
Past 10,000 sources the map was cut by deleting whatever map iteration
gave first, so flooding it from new addresses could clear an attacker's
count.  Now sources whose last failure is past the throttle time go first,
then those whose last failure is oldest; a source's own list is capped too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:06:45 +00:00
Claude a4ff918953 Stop spins and races in door telnet, SSH pump, Fido lock, tn3270
- door: telnetClient.Read returns at once for an empty buffer; a failed
  answer to an option is returned by the next Read or Write rather than
  reading on for ever.
- ssh: sshTerm.pump stops once closed when the channel reads nothing
  without error, instead of spinning.
- ssh: makeHostKey removes the key file when Close fails, not only Write.
- fido: flock retries EINTR; Lock retries a failed lock file briefly.
- tn3270: negotiation and its 30s watchdog decide by one flag, so a
  negotiation ending as time runs out keeps its connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 22:03:13 +00:00
Claude 37c5516b78 Telnet: early data handed to the 3270 side; contrary answers kept off
Handoff3270 promised the client's pending bytes to go3270 but gave only
what was still buffered: data decoded while negotiating (c.early) was
lost.  It now goes first, its IACs doubled again for go3270's telnet.

A request of ours was remembered only as unanswered, not as DO or DONT,
so a client answering our DONT TTYPE with WILL turned the option on (and
was asked for its terminal type again).  What each request wanted is now
kept, and an answer to the contrary leaves the option as asked (RFC
1143).  A stale duplicate comment on CR NUL is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:57:46 +00:00
Claude 72b9c5f087 FTP: a download counts when it reaches the file's end
A download was counted, against the user's day and ratio, as soon as any
of it was read, so a transfer cut short counted as a whole one.  It now
counts once the transfer reaches the end (a cut one is logged as partial
and not counted), and a resumption (REST) of the file counted today is
not counted again and needs no downloads left, as the API's Range
requests.  REP uploads must be BBSID.REP, as the refusal says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:51:18 +00:00
Claude 5fbddd13d2 Restore: a server's database with users refused before anything else
A restore copies the archive's database into a PostgreSQL or MySQL one,
which must be new; one with users was refused only after the whole
archive was unpacked, with Copy's bare message.  It is now checked first
(Store.Empty), and the refusal says what to do: make a new database,
point bbs.conf at it, restore again; nothing has been changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:49:42 +00:00
Claude 22ac2946b2 Image boards: a bad secret file is an error, not replaced
loadKey replaced a secret file of the wrong length with a new key, so one
with a newline added (an editor, a restore) silently changed every secure
tripcode and post password.  Whitespace around the key is now let be; a
file that is no key is an error naming it, left as it is; and a new key
is made only where there is none (O_EXCL), its random bytes checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:48:45 +00:00
Claude fc3977ae11 API: file names escaped in Content-Disposition
A download's and a QWK packet's names went into Content-Disposition in
quotes as they were, so a name with a quote, a backslash or a control
character broke the header.  attachment (mime.FormatMediaType) quotes and
escapes it, percent-encoding (RFC 2231) what quoting cannot carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:48:10 +00:00
Claude 9218f3e5d7 API PATCH: all or nothing
patchUser, patchArea and patchMe saved each change as they came to it,
so a request refused for a later field (a bad level, a bad echo tag, a
wrong old password) left the earlier ones made: a password or a lock
set by a request answered 400.  Every change is now checked first (an
area's newsgroup and echo tag against the other areas too), patchMe
changes the password before saving the rest, and the store's errors are
no longer ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:47:32 +00:00
Claude 01a73a9eb8 NNTP and FTP: throttle local clients' failed logins by account
A client on a loopback address had no source for throttling, so its
failed logins were never counted: endless password guessing from this
machine.  Its address is everyone's (a modem server, a menu, a local
proxy), so throttling or banning it would shut every such caller out:
LocalSource counts the failures against the account guessed at, by
service, instead.  Nothing is banned for them (bans are of addresses).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:46:08 +00:00
Claude 0d71e77e48 NNTP: OVER and HDR by Message-ID only for newsgroup articles
selectRange (OVER, HDR) looked up a Message-ID without checking that its
area is a newsgroup, as selectArticle does, so OVER <id> answered for a
message in an area out of news, confirming it.  Both now find articles by
Message-ID through byMessageID: a newsgroup's, visible to the session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:42:32 +00:00
Claude f069d2822d Gopher: no files from areas with a download requirement
Gopher has no login, but it listed and sent every file area's files,
those with a download requirement too.  It now offers only areas anyone
may download from (the requirement a caller not logged in meets).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:41:47 +00:00
Claude 93d9db5602 API downloads: a Range request no longer skips the limits
A request with a Range header was checked only for access, not for the
day's downloads or the ratio, and was not counted, so Range: bytes=0-
fetched a whole file past the limits uncounted.  A Range request is now
free only when it resumes the user's download of that file counted in
the last day (BBS.Resuming, remembered by Downloaded); any other is a
download like the rest, checked and counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:41:47 +00:00
Claude 8cac5066f6 Doc comments on every function
Every function and method, tests included, has a doc comment: what it
is or does, what it returns and anything a caller needs to know.  Only
comments are added; gofmt split a few aligned blocks of one-line
functions once each had its own comment.  The generated protobuf code
is left as protoc writes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:26:18 +00:00
Claude 4f4c550343 Pictures in triple-plane (color) programmed symbol sets
Where the terminal has triple-plane symbol sets and takes the extended
Load PS that loads one plane (PCOMM with programmed symbols alone: 3 of
them, and 3 single-plane), a picture's pels are each any of 8 colors:
the picture error-diffused to the planes' colors, a cell of several
colors a symbol in a triple-plane set, its blue, red and green planes
loaded one by one (cleared with the first) and the cell shown neutral
(X'F7', which shows its planes added); a cell of one color and black a
symbol in a single-plane set in that color while there is room, then in
a triple-plane set in its color's planes.  The picture is as large as
its cells fit both.

A terminal without the extended form loads its triple-plane sets whole
and uses them as single-plane ones, a color a cell, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 03:57:16 +00:00
Claude aaabb03ee2 Pictures in programmed symbols on 3270s without vector graphics
Between vector graphics and blocks: the picture cut into character
cells, each one of the 3270's 7 colors (the color that, with black,
comes nearest its pels) and a symbol of its pels, error-diffused over
the whole picture with each pel black or its cell's color.  The symbols
are loaded into the terminal's single-plane sets (LCIDs 0xC2 on) before
the screen, 190 a set, so the picture is as large as its cells fit in
the sets there are (PCOMM: 2 with vector graphics on, 380 cells); a
blank cell needs none, cells alike share one.  A row's runs of a set and
a color are each a Set Attribute of both (go3270's AttributeOnly
CharSet).

A picture's Set Attributes lasted the rest of the screen's write, so the
caption and body after a block picture took its last color: the
attributes are set back after a picture (the character set too after
symbols).  colorTerminal read the Color reply's pair count from the
wrong byte, so PCOMM (a 3278 by its type) was not taken for color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-16 02:46:06 +00:00
Claude 2fa6e2c83f Pictures on 3270s: vector graphics in the terminal's colors, or blocks
An image board's pictures (a post's thumbnail, the image whole) are now
drawn on a 3270 instead of only said in words:

- vector graphics (PCOMM): bitmaps a pel a pixel, error-diffused to the
  terminal's own palette (PCOMM's 16 colors, from the Graphic Color
  reply go3270 now asks for), overpainted (PCOMM's exclusive or does not
  combine blue), cropped and split over segments by go3270's
  ImagePictures; drawn after the screen over cells left empty, since a
  character over a picture clears it in its cell
- blocks (x3270, any color 3270 with graphic escape): ▀ ▄ ▌ ▐ █ in the
  7 colors, a cell two pixels by two, each cell the color and block
  nearest its pixels, a run of a color one Set Attribute

and in words on the rest, as before, under the picture where there is
one.  Pictures on/off (M, PF11) on the profile, kept as the text
terminals' preference is; the profile's terminal line says how they are
drawn.  tn3270_vector is on by default now that PCOMM draws them.

go3270-sec: GraphicColors, DitherBitmaps, ImagePictures, the Query List.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-16 02:22:10 +00:00
Claude a93df6ec7b Sign-in codes: the web without typing a password
Signed in on the BBS, Your profile's Sign-in code (C, PF10) gives a code
(ABCD-EFGH, 40 bits, no 0/O/1/I), good once for five minutes; a new one
ends the last.  The forum's Sign In page takes the code alone; anywhere a
password is asked (web terminal, image boards, API, FTP), it serves once
for the password with the user's name.

Codes are kept in memory as their SHA-256, never logged; a wrong one is
a failed login (throttled, the hack log), a locked account's opens
nothing (BBS.authenticate: the same path as passwords).  SSH keys are now
on the profile of accounts modemmenu made too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-15 01:51:17 +00:00
Claude 710119c4ac One password: logins asked of modemmenu's auth socket
[modemmenu] auth_socket: the accounts modemmenu logs in (external, no
password here) log in any other way (telnet, SSH, TN3270, the web forum
and terminal, the API, FTP, NNTP, IRC) with their modemmenu password:
BBS.Authenticate asks modemmenu's [authd] socket, and modemmenu its
backends (users file, LDAP, SQL, PAM) as at its own prompt.  Nothing of
the password is kept here.

An account with a password of its own here is never asked of modemmenu.
create_users (yes): a user modemmenu knows and the BBS does not gets an
external account at their first login, a name the BBS takes and the
name_deny_file allows.  A wrong password counts as any failed login;
modemmenu not answering is trouble, not counted against the caller.
Connections and modems has the keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 22:22:42 +00:00
Claude 8646d1e149 Configuration: no LDAP logins (modemmenu's)
System passwords, by PAM or LDAP, are modemmenu's to check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 22:06:59 +00:00
Claude 450ce2e72b Configuration: no PAM logins (modemmenu's)
System passwords are modemmenu's to check: the BBS takes its callers
as modemmenu logged them in (header, trust_user).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 22:02:54 +00:00
Claude e9fc5ed156 Run as a user of its own: ports bound as root, then root given up
[general] user (and group): started as root, bbs serve reads the
configuration, binds every socket it listens on (the listeners, TCP and
unix; the HTTP API and metrics, FTP, NNTP, IRC, finger, gopher, binkp),
gives up root (setgroups to the user's groups, setgid, setuid) and
executes itself again, the same process (its PID, for systemd and
reload), the sockets handed down; each server's listen takes the one for
its address (internal/sockets).  Nothing is written as root: database,
logs, host keys, backups and a unix socket without socket_group are the
user's.

Other commands as root give root up first, so the database stays the
user's (but check and config; backup restore puts things back as root
and gives them, but the configuration, to the user).  System
configuration has Run as user and group.

TestRunAs (as root) serves a port under 1024 and a unix socket as
nobody, the same process through a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 21:28:57 +00:00
Claude 856e31f86f Backups: the SSH host keys too
The SSH listeners' host keys go into every backup (key.NAME), whatever
[backup] files says, and come back with a restore like the rest (what is
there renamed aside): a BBS put back on another machine answers with the
keys its callers' clients know.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 21:17:20 +00:00
Claude 0944798461 Backups: the configuration, database and files, daily or now
bbs backup makes one archive (bbs-YYYYMMDD-HHMMSS.tar.gz) of bbs.conf,
the database and the files' directories, while callers are on: the
database as a SQLite file whatever its engine, taken whole at one moment
(SQLite's by VACUUM INTO, a server's in one read-only repeatable-read
transaction: store.Snapshot).  It is written beside its final name and
renamed when whole; past [backup] keep the oldest go.

[backup] says where (beside an SQLite database by default), when (at =
HH:MM, daily, in serve), how many, and whether the files go too; it is
live at a reload.  bbs backup list, and bbs backup restore ARCHIVE -yes
with the BBS stopped: each thing put where this system's configuration
says, what is there renamed aside (.before-restore-STAMP), a server's
database copied into a new empty one; an archive whose names climb out
is refused before anything changes.

The configuration screens' Maintenance has Back up now, the backups
made, and [backup]'s keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 20:10:27 +00:00
Claude d0cb9fdaae Configuration: full-screen menus, changes held until F10
The configuration screens are menus by what a sysop looks for: Board
(names, location, postal address, dial-in numbers, internet addresses,
what callers see, menus and prompts), System (database, log, file
locations, security, scheduled events, every section), Connections and
modems (modem lines, listeners, login limits, caller ID, GeoIP), Services
(telnet, TN3270, SSH, RLogin, finger, gopher, FTP, IRC, news, the web,
MRC, FidoNet, QWK networks, doors), Users and groups (accounts and
access levels) and Maintenance (disk space, what areas keep, old
messages taken out, the image boards' archive, backups).  Running as
another user, PAM, LDAP and database and file backups are shown as not
available yet.

Nothing changes until F10 (or Save and exit): changed lines are marked
and counted; then the file is checked and written, the accounts' and
areas' changes made, and on a running BBS the live ones put in force.
F9 (or Quit without saving) leaves it all, after a yes.

view.Sheet is the full-screen page: drawn with the cursor keys on ANSI
terminals (the terminal now reads F1-F12), with fields and PF keys on a
3270, as numbered lines elsewhere.  [general] gains postal_address,
phone and addresses, in the system info and as @POSTAL@, @PHONE@ and
@ADDRESSES@.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 19:53:03 +00:00
Claude 6fa851dfdb Configuration screens, offline and online; reload by SIGHUP
bbs -config FILE config is screens on the local terminal for bbs.conf:
its sections and keys, each with the sample's comment on it, its default
and examples, and whether it takes effect at once or at a restart.  The
same screens are the sysop's tools' Configuration (F), on text terminals
and 3270s.  Keys are edited in place, unset, or taken from the sample's
examples; sections made (uncommented where the file has them commented
out), renamed and deleted (commented out).  The file is checked as the
BBS would read it, written whole with its permissions and owner kept and
the old one as bbs.conf.bak, and not over a file changed since it was
read.  config get/set/unset do a key at a time, for scripts.

internal/confedit edits the file as a sysop would by hand: every comment
kept, a new key below the sample's example of it.  Its catalog is read
from bbs.conf.sample (embedded); a test keeps every key the loader reads
in the sample, which gained comments where keys had none.

SIGHUP (ExecReload in bbs.service.sample), or writing on the sysop's
screen, reads the file again and puts in force what may change while
callers are on: [general]'s names, texts, limits, timeouts, GeoIP and
levels, [level], [menu], [strings], [chan] (but dir) and the forum's
options; the rest is logged as waiting for a restart.  A file the BBS
would not start with changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 18:56:40 +00:00
Claude 34c8757d0d Live settings: snapshot reads through Conf, Reconfigure hooks
The BBS, image boards and forum read their settings through an atomic
snapshot (Conf, conf, opts), so a new configuration can be swapped in
while callers are on. Menus and [strings] swap the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 18:36:52 +00:00
Claude 114e56c928 Image boards: an archive of pruned threads
As 4chan's, a thread pruned off a board's last page is archived, not
deleted: off the board's pages and catalog, whole, its files kept,
read-only.  No one replies to it, staff neither (store.AddPost refuses
too, for a reply already on its way); its posts are not deleted by
their passwords (staff still can).  Its page says it is archived in
place of the form and its first post wears a badge.

- /chan/b/archive lists a board's archived threads, the last first;
  /chan/b/archive.json is 4chan's (the numbers, oldest first); an
  archived thread's JSON has archived and archived_on, and boards.json
  is_archived
- [chan] archive_days (3; 0: always) is how long they stay: then they
  are deleted with their files, looked to when a thread is made and
  when the archive or the thread is looked at
- a board's archive setting (bbs chan board set DIR archive no) prunes
  as before, deleting at once; boards have one by default, as do
  those of an older database
- the terminals: a board's thread list has Archive (A), to read them;
  archived threads offer no reply

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 18:17:57 +00:00
Claude 56f022c8aa Image boards: Flash (SWF and FLV), played by Ruffle
A board takes Flash when its files say swf or flv (bbs chan board set f
files swf,flv), as 4chan's /f/ did, and [chan] ruffle names Ruffle's
self-hosted package (make ruffle fetches it from npm into ruffle/).

- SWF: FWS and CWS read for the stage, frames, rate and sounds, the
  tags walked as they unpack with nothing kept (a zlib bomb costs no
  memory and is refused); ZWS (LZMA) taken as 550x400 with sound
- FLV: onMetaData (AMF0) for size and length, the tags for sound and
  the video codec (Sorenson, Screen, VP6, VP6 alpha, H.264); ffmpeg
  thumbnails it, a movie gets a card
- sound needs the board's sound; an FLV is held to max_video

Clicking a Flash thumbnail plays it in a sandboxed frame (/chan/flash:
allow-scripts alone, by its CSP and the frame's attribute): no origin,
no cookies, nothing of the page.  The page fetches the file with its own
cookies and hands the bytes over; Ruffle runs with networking, scripting
and links off.  Ruffle 0.7.1 does not play a standalone FLV, so the BBS
makes a small AVM1 movie of its own (/chan/flvplayer.swf: NetStream
into a Video of the FLV's size) that plays it from a blob of the frame.
Ruffle's files are served at /chan/ruffle/ with CORS open (the frame
has no origin), only the package's .js, .wasm and .map.

Played in Chromium with Ruffle 0.7.1: a movie, and a Sorenson FLV with
sound through the player; both frames of origin "null", cookies
refused, no CSP violations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 10:31:03 +00:00
Claude f911e6968a Image boards: WebM, MP4 and PDF uploads
A board takes files besides images when its file types say so (bbs chan
board set DIR files webm,mp4,pdf; sound yes), as 4chan's take WebM and
/po/ PDFs.  Each file is known by its bytes and read before it is kept:

- WebM: its EBML walked for the doc type (webm, not any Matroska), the
  tracks' codecs (VP8, VP9, AV1; Vorbis, Opus), size and length
- MP4: its boxes walked for the movie header and tracks (H.264, AV1,
  VP9; AAC, Opus); HEVC and the like refused, as browsers do not all
  play them
- PDF: whole (%PDF- to %%EOF), its pages counted and first page's size
  found where its objects are not compressed

Videos are at most 4096 pixels a side and [chan] max_video seconds long
(120; one that does not say is refused while there is a limit), and
silent unless the board takes sound.  Thumbnails come from [chan]
ffmpeg (the first frame, the container named to it) and pdftoppm (the
first page), else a card saying what the file is.

In the page a video's thumbnail plays it in place with [Close]; a PDF's
opens it in a tab, served without the boards' CSP (a viewer will not
run under it) and nosniff.  The post form lists what the board takes;
posts say a video's length, a PDF's pages; the JSON has 4chan's
webm_audio and max_webm_duration, and duration_ms, page_count,
file_types.  Terminals show their thumbnails.

Fuzzing the readers found an EBML element head read past its parent
(a panic); fixed, the input kept as a regression case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 09:49:11 +00:00
Claude 14aa6d40ac Fix two races behind the flaky door test
TestDoorSession failed about once in 100-200 runs, two ways:

- "fork/exec door.sh: permission denied": the server made unix sockets
  under a umask of 0177, and the umask is the whole process's.  A file
  made by another goroutine meanwhile lost its mode: here the test's
  door script, written as the server started, came out 0600.  In the
  BBS the same could befall anything made while a listener started.
  The socket is now made in a private directory beside its place, given
  its mode and group there, then renamed into place: still no moment
  when others could connect, and no umask touched.  Closing the
  listener removes the socket.

- the door's last output lost ("Bye from the door" never came): a door
  without a pty wrote to cmd.StdoutPipe, which Wait closes as soon as
  the door exits, while the reader may not have drained it.  The door
  now writes to a pipe of the runner's own, read to its end.

TestOutputAfterExit (door) lost 28-48 KB of a door's last output on
every run before; TestSocketLeavesUmask (server) saw 0755 files made
0600 within a few dozen tries.  Both pass now, and TestDoorSession
passed 500 runs in a row under -race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 09:13:27 +00:00
Claude b89bac2a38 geoip: regions and cities, from city databases
- the reader gives an address's region (the first subdivision) and city
  where the database has them: GeoLite2/GeoIP2 City and DB-IP's City
  Lite as MaxMind DBs; DB-IP's city CSV and IP2Location LITE DB3 and up
  as CSVs (now read with encoding/csv, quoted fields and all)
- CSVs stream in (gzipped or not) and are kept small: each place once,
  each range by its start, IPv4 apart in 4 bytes; DB-IP's city list,
  7.8 million ranges, in 135 MB
- geoip.File reads the first time at once and later changes in the
  background, the old reader answering meanwhile; the server reads the
  database when it starts; the image boards share the BBS's when the
  file is the same
- bbs.Place has the city; the log and the sysop's node list show
  "Mountain View, California, United States"; who's online, the API and
  the forum's flags still show only the country
- checked against MaxMind's reader on DB-IP's city database of October
  2026 in both formats: the same country, region and city for 200,000
  addresses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 08:48:51 +00:00
Claude 5c66347b5b phone: North America's area codes from NANPA's own report
NANPA's report of 14 October 2026 (reports.nanpa.com/public/
npa_report.csv) has thirteen geographic area codes in service that
libphonenumber's data of 8 October lacks: 357, 436, 457, 465, 471, 483,
621, 624, 679, 729, 837, 861 and 924 (the nine dropped before among
them), and 538, 542 and 543 for personal services.

The generator now takes the report too (-nanpa; make phone-data
NANPA=...) and writes nanpa.go: each area code in service, or announced
with its day, with its country and state or province, or what service
it is.  A number in an area code NANPA has in service is one even
before libphonenumber has it; the area's place is NANPA's state or
province unless libphonenumber names the exchange; an announced code
(273 Quebec, 565 Georgia...) becomes a number on its day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 08:37:28 +00:00
Claude 2f34dfc09d phone: every country's numbering plan, from libphonenumber
NANPA's site was out of reach, so the hand-made tables were checked
against Google's libphonenumber (its data of 2026-10-08, kept up from
NANPA and the national regulators) and then replaced by it:

- the area-code check found 273 (Quebec) and 633 (Canadian personal)
  missing, and nine US codes it has nowhere (357, 436, 457, 483, 624,
  679, 837, 861, 924): those are gone with the old tables
- internal/phone/gen makes metadata.go (every territory's calling code,
  international and trunk prefixes, shared-code rules, number kinds and
  formats) and places.gz (269,198 prefixes to places, 151 calling codes)
  from a libphonenumber checkout: make phone-data
- Parse follows libphonenumber's rules: national prefixes taken off and
  transformed, shared codes told apart by leading digits and plans,
  the kind of number (fixed line, mobile, toll-free...), the place to
  the exchange where known, and numbers written as each country does
  (+44 20 7123 4567, +81 3-1234-5678)
- checked against nyaruka/phonenumbers on 34,362 numbers: the same
  country, kind and place for all; formats differ only for the Faroes,
  where its bundled data is older
- the tables load when first wanted (about 6 MB); the sysop's node list
  says which callers are on mobiles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 08:26:38 +00:00
Claude 4d49631d37 Where callers are: GeoIP for the forums, caller ID decoding
- internal/phone reads modem caller IDs with its own tables: the ITU's
  country calling codes (shared ones told apart), the NANP's area codes
  by state and province, toll-free and other services, and how each
  country dials, so national numbers read as [general] phone_country
- [general] geoip (with geoip_credit) is the BBS's country database;
  [chan] geoip falls back to it.  geoip.File keeps a database file up
  to date for both
- bbs.Locate and Node.Place: a caller's place by caller ID, else by
  address; the connect log, who's online (the country), the sysop's node
  list (number and state) and the API's /who show it
- messages keep the poster's country (messages.country); the web forum
  shows its flag by the poster's name in every theme and on Online
  Users, with the database's credit at the foot ([http] forum_flags)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 08:05:27 +00:00
Claude 649b4fc426 geoip: checked against DB-IP's database; ZZ, 6to4 and Teredo; credit
Checked on DB-IP's IP to Country Lite (October 2026) against MaxMind's
own reader: 200,000 addresses, IPv4 and IPv6, every country and name
alike from the .mmdb (plain or gzipped). From its CSV: ZZ (and XX, --)
is no country; IPv6 that carries an IPv4 address (6to4, Teredo) is
looked up by it, as a MaxMind DB's tree does; plainer names for the
countries ISO names formally (Russia, DR Congo, Vatican City...).

[chan] geoip_credit and geoip_credit_url put the credit the database's
licence asks for (DB-IP's CC BY 4.0, GeoLite2's) at each page's foot.
An ID's + is escaped in its attribute: the test reads the page as a
browser does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 04:34:04 +00:00
Claude 6ea47bb179 Image boards: poster IDs and country flags
A board with ids gives each poster an ID in each thread, as 4chan's: a
keyed hash of their address, the board and the thread, the same all
through a thread, another in the next. Each has its colour; hovering
counts its posts, clicking marks them.

A board with flags shows each poster's country's flag (an emoji, its
name on hovering), from [chan] geoip: a country database read by the
new internal/geoip, which reads MaxMind DB files (GeoLite2, DB-IP
Lite, IPinfo's...; tested on files made by MaxMind's own writer in
each record size, and broken ones) and CSVs of ranges (DB-IP's,
IP2Location LITE's), plain or gzipped, read again when the file
changes. Country names from ISO 3166.

Both are kept with each post, shown on the terminals by the name, and
given in the JSON as 4chan's id, country and country_name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 04:20:29 +00:00
Claude a47cbc946f Image boards: captcha and Options settings, boards for users alone
[chan] captcha_length (4 to 10), captcha_level (easy, normal, hard:
how far the letters turn and wave, the lines and specks) and
captcha_lifetime; options = yes|no for the post form's Options line
(sage, nonoko: without it posts bump, on the web and the terminals).
A board's own captcha and options (yes, no, default) say otherwise
than [chan]'s.

A board's login is now no, post (only users post, as before; yes
still means it) or all: only the BBS's users see the board, its pages
redirecting others to sign in, its JSON refused, its images not
there, its front-page images left out and the board marked (members).
boards.json says login and captcha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 02:40:13 +00:00
Claude 3b04006858 Image boards: captchas for those not signed in; members' posts marked
Posting without signing in takes a captcha, drawn here: crooked
letters over noise, its answer sealed in its token (AES-GCM with the
boards' secret), good once and for ten minutes, a new one by script.
[chan] captcha = yes (the default) or no. Signed-in users and the
terminals' callers post without one.

Posts by signed-in users are marked as a member's (a check by the
name, member in the JSON, [member] on the terminals); ticking Sign it
as NAME posts under the account's own name, which no one else can use
(account in the JSON, [signed] on the terminals). forced_anon boards
mark but never sign.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-14 02:28:14 +00:00