diff --git a/docs/wiki/Access-Levels.md b/docs/wiki/Access-Levels.md index 12037fd..e2e2df2 100644 --- a/docs/wiki/Access-Levels.md +++ b/docs/wiki/Access-Levels.md @@ -1,9 +1,10 @@ Every user has an **access level** (0 to 255) and **flags** (letters A to -Z). The sysop says what each level may do, and what message areas, file -areas, doors and menus require. Sysops pass every check. +Z). The sysop decides what each level may do, and what level and flags +each message area, file area, door and menu requires. Sysops pass every +check. -Without any of it nothing changes: a user's level is 20 and nothing -requires more. +None of this is required. If you set nothing up, every user's level is 20 +and nothing requires more. ## Levels @@ -29,14 +30,14 @@ downloads = 20 name = Trusted ``` -A user's level gets what the `[level]` at or below it says: level 35 above -gets `[level 20]`'s. A level under every `[level]` has no limits. Each -`[level]` may say: +A user gets the settings of the highest `[level]` at or below their own +level, so in the example above, level 35 gets `[level 20]`'s settings. A +level below every `[level]` section has no limits. Each `[level]` can set: -| | default | | +| Key | Default | What it sets | |---|---|---| | `name` | `Level N` | shown in the profile and to the API | -| `time` | `0` | minutes online a day; the caller is warned at 5 and 1 minutes left and hung up at the end (and gets at least a minute of a call, to read and log off). A door's time limit is cut to what is left | +| `time` | `0` | minutes online a day; the caller is warned at 5 and 1 minutes left and hung up at the end (and gets at least a minute of a call, to read and log off). A door's time limit is cut to what is left | | `downloads` | `0` | files a day, by any way (the BBS, FTP, 3270, the API) | | `ratio` | `0` | files a user may download for each they have uploaded (0: no ratio); the files uploaded are those still in the areas | | `ratio_free` | `0` | files a user may download before the ratio counts: with `ratio = 3` and `ratio_free = 10`, someone with 2 uploads may download 16 | @@ -47,25 +48,26 @@ gets `[level 20]`'s. A level under every `[level]` has no limits. Each | `download`, `upload` | `yes` | files | | `doors` | `yes` | doors | -The day is the server's local day; time and downloads start again at -midnight. +Days follow the server's local time, so time and download allowances +start again at midnight. ## Requirements -What an area, a door or a menu requires is written as terms that must all -hold: +A requirement for an area, door or menu is written as a list of terms, +and the user must meet all of them: -| term | | +| Term | Meaning | |---|---| | `30` | level 30 or higher | | `F`, `FB` | has flag F (and B) | | `!X` | does not have flag X | | `sysop` | sysops only | -`30 F !X` is level 30 or more, with F, without X. Nothing is anyone -logged in. A locked user meets none. +So `30 F !X` means level 30 or more, with flag F and without flag X. An +empty requirement lets in anyone who is logged in. A locked user meets no +requirement. -| where | how | | +| Where | How | Notes | |---|---|---| | message area | `bbs area require AREA READ POST` | who sees it (in lists, newsgroups by NNTP, the API) and who posts | | file area | `bbs filearea require AREA DOWNLOAD UPLOAD` | an area is listed to those who may do either | @@ -73,13 +75,14 @@ logged in. A locked user meets none. | menu | `require = 50` in its `[menu]` | to be taken into it | | menu item | `x = menu:extras Extras \| 50 X` | the item is shown only to those who meet what follows `\|` | -`-` on the command line is none: `bbs area require General - 20`. +On the command line, `-` means no requirement: `bbs area require General - 20`. ## Validation -New users start at `new_user_level`; their welcome says they wait for the -sysop's validation, and they may mail the sysop even when their level may -not mail. The sysop validates them: +New users start at `new_user_level`. Their welcome tells them they are +waiting for the sysop to validate them, and they can mail the sysop even +if their level cannot send mail. The sysop validates them in any of three +ways: - on the BBS: `V` on the main menu (*Validate users (N)*) goes through those waiting: validate, set another level, lock, skip; @@ -88,9 +91,9 @@ not mail. The sysop validates them: - by the API: `PATCH /api/v1/admin/users/{name}` with `level` and `flags` (`"AB"`, or an edit `"+A -B"`). -Users see their own level, flags, time left and downloads in their -profile (and at `GET /api/v1/me`, `access`); others see neither. No one -changes their own. +Users can see their own level, flags, time left and downloads in their +profile (and in `access` at `GET /api/v1/me`), but not anyone else's. No +one can change their own. Drop files give doors the caller's level as their security level (255 for sysops). diff --git a/docs/wiki/Administration.md b/docs/wiki/Administration.md index 081f59c..1830213 100644 --- a/docs/wiki/Administration.md +++ b/docs/wiki/Administration.md @@ -1,6 +1,7 @@ -Everything is done with the `bbs` command, on the configuration the BBS -runs with (`-config FILE`; without it, the defaults and `bbs.db` here). -These are safe to run while the BBS is serving. +This page lists the `bbs` commands a sysop uses day to day. Each command +works on the configuration the BBS runs with (`-config FILE`; without it, +the defaults and `bbs.db` in the current directory). All of them are safe +to run while the BBS is serving callers. ## Users @@ -42,7 +43,7 @@ bbs sshkey list [USER] bbs sshkey del ID ``` -Users add their own from their profile, or by the API: [SSH](SSH). +Users can also add their own keys from their profile or through the API: see [SSH](SSH). ## Message areas @@ -58,13 +59,15 @@ bbs area keep AREA MESSAGES DAYS # keep the newest MESSAGES, for DAYS (0: no bbs area purge # take away what areas keep no more, now ``` -What an area keeps is enforced hourly while the BBS runs (and by `bbs -area purge`): beyond its newest `MESSAGES`, and older than `DAYS`, -messages go, with their votes and polls. +The BBS applies each area's limits every hour while it runs, and `bbs +area purge` applies them at once. Messages beyond the newest `MESSAGES`, +and messages older than `DAYS`, are deleted along with their votes and +polls. -A sysop also adds areas from the BBS (`+` in the message areas) and -deletes any message. Newsgroups: [Newsgroups and NNTP](Newsgroups-and-NNTP); -echoes: [FidoNet](FidoNet). +A sysop can also add areas from inside the BBS (`+` in the message areas) +and delete any message. For newsgroups, see +[Newsgroups and NNTP](Newsgroups-and-NNTP); for echoes, see +[FidoNet](FidoNet). ## File areas @@ -94,6 +97,9 @@ See [Image boards](Image-Boards). ## Mail exchange +The BBS exchanges mail with its peers on its own schedule. These commands +do it now. + ``` bbs news sync [PEER] # exchange articles with news peers now bbs fido poll [LINK] # call FidoNet links now @@ -117,10 +123,8 @@ bbs room topic ROOM ["TOPIC"] # set its topic (none: clear it) bbs room del ROOM # it goes with its last caller ``` -See [IRC](IRC#permanent-rooms). A running BBS takes these at its next -start; BBSServ's `ROOM` changes it at once. - -The server does all of these on its own schedule; these are for now. +A running BBS picks up these changes at its next start; BBSServ's `ROOM` +command makes them at once. See [IRC](IRC#permanent-rooms). ## The rest diff --git a/docs/wiki/Backups.md b/docs/wiki/Backups.md index 6a04979..693f37c 100644 --- a/docs/wiki/Backups.md +++ b/docs/wiki/Backups.md @@ -1,63 +1,66 @@ -The BBS backs itself up: this configuration file, the database and the -files, one archive a backup, while callers are on. +The BBS can back itself up while callers are on. Each backup is one +archive holding the configuration file, the database and the files. This +page covers making backups, what is in them, and restoring one. ``` -bbs -config /etc/bbs/bbs.conf backup # one now -bbs -config /etc/bbs/bbs.conf backup list # those there are, the newest first -bbs -config /etc/bbs/bbs.conf backup restore ARCHIVE # what it would put back, and where +bbs -config /etc/bbs/bbs.conf backup # make one now +bbs -config /etc/bbs/bbs.conf backup list # list the backups, newest first +bbs -config /etc/bbs/bbs.conf backup restore ARCHIVE # show what it would restore, and where bbs -config /etc/bbs/bbs.conf backup restore ARCHIVE -yes ``` The [configuration screens](Configuration#editing-it-the-configuration-screens)' -Maintenance menu has the same: Back up now, the backups made, and -`[backup]`'s settings. +Maintenance menu does the same: Back up now, the list of backups, and the +`[backup]` settings. -## What a backup has +## What a backup holds -Each is `bbs-YYYYMMDD-HHMMSS.tar.gz` in the backup directory: +Each backup is `bbs-YYYYMMDD-HHMMSS.tar.gz` in the backup directory: -| in it | | +| File | What it is | |---|---| | `MANIFEST` | when it was made, the database's engine, where each thing was | | `bbs.conf` | the configuration file the BBS runs by | -| `database.db` | the database as a SQLite file, whatever its engine, taken whole at one moment: SQLite's by `VACUUM INTO`, a PostgreSQL or MySQL server's copied in one read-only transaction that sees nothing written after it began. Callers may go on as it is taken | +| `database.db` | the database as a SQLite file, whatever its engine, taken whole at one moment: SQLite's by `VACUUM INTO`, a PostgreSQL or MySQL server's copied in one read-only transaction that sees nothing written after it began. Callers may go on as it is taken | | `key.ssh_host_ed25519_key` ... | the SSH listeners' host keys (always, whatever `files` says): a BBS put back on another machine answers with the keys its callers know | | `files/`, `chan/`, `fido/`, `screens/`, `scripts/` | the file areas', image boards', FidoNet's, display files' and scripts' directories (with `files = yes`) | -An archive is written beside its final name and renamed to it when it is -whole: one there is one made. Past `keep`, the oldest are taken away. +An archive is written under a temporary name and renamed when it is +complete, so any archive in the directory is a whole one. Beyond `keep` +archives, the oldest are deleted. ## [backup] -| key | default | | +| Key | Default | What it sets | |---|---|---| | `dir` | `backups` beside an SQLite database | where the archives go: better on another disk, or copied off the machine (a server's database has no default: say one) | | `at` | none | daily, at this time (`03:30`) | | `keep` | `7` | archives kept (0: all) | | `files` | `yes` | the files' directories too; `no`: the configuration, the database and the host keys alone | -They take effect at a reload (`systemctl reload bbs`) or when the +Changes take effect at a reload (`systemctl reload bbs`) or when the Configuration screen saves them. -## Putting one back +## Restoring a backup -`bbs backup restore ARCHIVE` says what the archive has and where each -thing would go: where *this* system's configuration says (so a backup -moves to another machine), not where it was. With the BBS stopped, `-yes` -puts it back: +`bbs backup restore ARCHIVE` lists what the archive holds and where each +part would go. It follows *this* system's configuration rather than where +things were when the backup was made, so a backup can move to another +machine. With the BBS stopped, add `-yes` to restore it: -- each file or directory there now is renamed aside first, - `NAME.before-restore-YYYYMMDD-HHMMSS`, never written over (take them - away when all is well); +- each file or directory already there is first renamed to + `NAME.before-restore-YYYYMMDD-HHMMSS`, never overwritten (delete these + once all is well); - an SQLite database is put in the database's place; -- a PostgreSQL, MySQL or MariaDB database must be new and empty (made as - for `bbs db copy`): the archive's is copied into it. One with users is - refused before anything is unpacked or changed: make a new one, point - `database` at it, and restore again; -- what the archive does not have (the files, with `files = no`) is left - as it is. +- a PostgreSQL, MySQL or MariaDB database must be new and empty (set up + as for `bbs db copy`), and the archive's database is copied into it. If + the database already has users, the restore is refused before anything + is unpacked or changed: create a new database, point `database` at it, + and restore again; +- anything the archive does not hold (such as the files, with + `files = no`) is left as it is. -An archive whose names would climb out of where they go is refused before -anything is changed. +An archive with paths that would escape their destination is refused +before anything is changed. **See also:** [Databases](Databases), [Configuration](Configuration), [Sysop tools](Sysop-Tools) diff --git a/docs/wiki/Building.md b/docs/wiki/Building.md index e22c086..357d8a6 100644 --- a/docs/wiki/Building.md +++ b/docs/wiki/Building.md @@ -1,22 +1,27 @@ -Go 1.24 or later: +This page shows how to build bbs from source. You need Go 1.24 or later. ``` make # or: go build ./cmd/bbs make test -make install # /usr/local/bin/bbs, and /etc/bbs/bbs.conf if there is none +make install # installs /usr/local/bin/bbs, and /etc/bbs/bbs.conf if there is none ``` -There is no cgo: SQLite is [modernc.org/sqlite](https://modernc.org/sqlite); PostgreSQL is [pgx](https://github.com/jackc/pgx), MySQL [go-sql-driver](https://github.com/go-sql-driver/mysql), all built in. +bbs does not use cgo, so there is no C compiler to set up. Every database +driver is built in: SQLite is [modernc.org/sqlite](https://modernc.org/sqlite), +PostgreSQL is [pgx](https://github.com/jackc/pgx), and MySQL and MariaDB are +[go-sql-driver](https://github.com/go-sql-driver/mysql). -go3270 is the suite's fork, -[D-Modem/go3270](https://github.com/D-Modem/go3270) (module -`github.com/D-Modem/go3270`), which adds -the query replies and graphics. While that repository is private, Go -needs to fetch it from GitHub itself, with your credentials: +## go3270 + +bbs uses the D-Modem suite's fork of go3270, +[D-Modem/go3270](https://github.com/D-Modem/go3270) (Go module +`github.com/D-Modem/go3270`), which adds 3270 query replies and graphics. +While that repository is private, Go has to fetch it from GitHub with your +own credentials: ``` -export GOPRIVATE=github.com/D-Modem/* # the Makefile sets this -git config --global url."git@github.com:".insteadOf "https://github.com/" # or a token +export GOPRIVATE=github.com/D-Modem/* # the Makefile sets this for you +git config --global url."git@github.com:".insteadOf "https://github.com/" # or use a token ``` **See also:** [Running](Running), [Development](Development) diff --git a/docs/wiki/Chat-and-Paging.md b/docs/wiki/Chat-and-Paging.md index 52fde86..5574d72 100644 --- a/docs/wiki/Chat-and-Paging.md +++ b/docs/wiki/Chat-and-Paging.md @@ -1,13 +1,15 @@ -Callers on different nodes talk to each other: in chat rooms, by a -message to one node, and by paging the sysop. +Callers on different nodes can talk to each other in three ways: in chat +rooms, by sending a message to one node, and by paging the sysop. ## Chat rooms *C* on the text main menu (*Chat* on a 3270's) goes into the main room. -Anyone may make another with `/join NAME`; a room goes when its last -caller leaves, unless the sysop has made it [permanent](IRC#permanent-rooms). Whoever comes in sees its last 20 lines. +Anyone can start another room with `/join NAME`. A room closes when its +last caller leaves, unless the sysop has made it +[permanent](IRC#permanent-rooms). Anyone who joins a room sees its last +20 lines. -| command | | +| Command | What it does | |---|---| | (a line) | say it to the room | | `/me ACTION` | `* alice waves` | @@ -19,44 +21,47 @@ caller leaves, unless the sysop has made it [permanent](IRC#permanent-rooms). W | `/quit` | leave the chat | | `/help` | these | -On the text BBS a line others say shows the moment it comes, above what -you are typing, which is then drawn again. A 3270 shows nothing it was -not sent, and is better not sent anything while its caller types: the +On the text BBS, a line someone else says appears the moment it arrives, +above what you are typing, which is then redrawn. A 3270 shows only what +it is sent, and is best not sent anything while its caller types, so the chat screen shows new lines each time you press Enter (to say something, or with nothing typed) or PF5. -A caller may say 8 lines in 10 seconds; more is refused ("slow down"). +A caller can say up to 8 lines in 10 seconds; more than that is refused +("slow down"). -Rooms beginning `mrc-` are [MRC](MRC)'s, shared with other BBSes. -The rooms are channels on the BBS's [IRC](IRC) server too: `#main` and -the rest, with IRC clients in them alongside the callers. +Rooms whose names begin with `mrc-` belong to [MRC](MRC) and are shared +with other BBSes. The rooms are also channels on the BBS's [IRC](IRC) +server (`#main` and the rest), with IRC clients in them alongside the +callers. ## Messages to a node -*Who's online* on the text BBS ends by offering to send a node a line; -`/msg NODE TEXT` does it from chat (on a 3270 too). The line reaches its -caller wherever they are: on the text BBS at the prompt they are at, on a -3270 on the message line of their next screen (with `(+N)` when more are -waiting). +On the text BBS, *Who's online* ends by offering to send a line to a +node, and `/msg NODE TEXT` does the same from chat (on a 3270 too). The +line reaches the caller wherever they are: on the text BBS, at whatever +prompt they are at; on a 3270, on the message line of their next screen +(with `(+N)` when more are waiting). ## Paging the sysop -*S* on the text main menu (*Page the sysop* on a 3270) asks what it is -about, and tells every sysop logged in (and not busy): +*S* on the text main menu (*Page the sysop* on a 3270) asks what the page +is about, and tells every sysop who is logged in and not busy: ``` ** alice (node 2) is paging you: my upload failed (Chat, then /answer) ** ``` The caller waits in a private room of their own (`sysop-2`), which only -they and sysops can join. A sysop answers with `/answer` in chat (the -caller waiting longest), or `/answer NODE`; `/pages` lists who is -waiting, and `/busy` turns pages to them off (and on again). The sysop's -main menu shows `Chat (1 paging)` while someone waits. If the caller -gives up (`/quit`, PF3), the page goes. +they and sysops can join. A sysop answers with `/answer` in chat (which +picks the caller who has waited longest) or `/answer NODE`. `/pages` +lists who is waiting, and `/busy` turns pages to that sysop off and on. +The sysop's main menu shows `Chat (1 paging)` while someone waits. If the +caller gives up (`/quit`, PF3), the page is cancelled. -If no sysop is on, the caller is offered to leave the sysop a message, and -`page_command` (in `[general]`) runs, to tell the sysop some other way: +If no sysop is on, the caller is offered the chance to leave the sysop a +message, and `page_command` (in `[general]`) runs to tell the sysop some +other way: ``` [general] @@ -64,14 +69,14 @@ page_command = /usr/local/bin/notify-sysop {user} {node} {reason} ``` `{user}`, `{node}` and `{reason}` are filled in as whole arguments, and -also given as `BBS_PAGE_USER`, `BBS_PAGE_NODE` and `BBS_PAGE_REASON`; -there is no shell, so nothing a caller typed is run. It may take 30 -seconds. For example, with [ntfy](https://ntfy.sh): +are also given as `BBS_PAGE_USER`, `BBS_PAGE_NODE` and `BBS_PAGE_REASON`. +There is no shell, so nothing a caller typed is ever run. The command can +take up to 30 seconds. For example, with [ntfy](https://ntfy.sh): ``` page_command = curl -s -d "{user} on node {node}: {reason}" https://ntfy.sh/my-bbs-pages ``` -A caller pages at most once a minute. +A caller can page at most once a minute. **See also:** [Administration](Administration), [Security](Security) diff --git a/docs/wiki/Configuration.md b/docs/wiki/Configuration.md index 2b3535d..9bce6ee 100644 --- a/docs/wiki/Configuration.md +++ b/docs/wiki/Configuration.md @@ -1,24 +1,38 @@ -[bbs.conf.sample](https://github.com/D-Modem/bbs/blob/HEAD/bbs.conf.sample) has every option, and the [Configuration reference](Configuration-Reference) lists them all, section by section. `[general]` is the -system (name, database, log, banner, message of the day, timeouts, limits); -each `[listen NAME]` is a port or unix socket: +The BBS reads its settings from one file, `bbs.conf`. This page explains +how the file is laid out, how to edit it in the configuration screens, and +which settings can change while callers are on. +[bbs.conf.sample](https://github.com/D-Modem/bbs/blob/HEAD/bbs.conf.sample) +has every option with comments, and the +[Configuration reference](Configuration-Reference) lists them all, section +by section. -| `type` | what comes in | +## Listeners + +`[general]` holds the system-wide settings (name, database, log, banner, +message of the day, timeouts and limits). Each `[listen NAME]` section is a +port or unix socket that callers come in on, and its `type` says what kind +of caller to expect: + +| `type` | What comes in | |---|---| | `telnet` | a telnet client; with `tn3270 = yes` (the default) 3270s get 3270 screens | | `raw` | bytes as they come: app_dmodem's `mode = tcp`, a modemmenu `tcp` or `unix` item | | `rlogin` | RFC 1282, as modemmenu's `rlogin` items speak it | | `ssh` | SSH: the text BBS, logged in by password or key ([SSH](SSH)) | -`address` is `host:port`, or a path for a unix socket (`socket_mode`, -`socket_group`). Any listener may read a session header first (`header = -yes`), and with `trust_user = yes` take the caller as logged in already: see -[Modem callers](Modem-Callers) (not `ssh`, which logs its callers in itself). `petscii` and `rip` say whether -its callers may be Commodores or RIPscrip terminals: [PETSCII and RIP](PETSCII-and-RIP); `vt` -whether terminals are asked what they are: [Terminal identification](Terminal-Identification). +`address` is `host:port`, or a path for a unix socket (with +`socket_mode` and `socket_group`). Any listener except `ssh` can read a +session header first (`header = yes`), and with `trust_user = yes` it +treats the caller as already logged in; see +[Modem callers](Modem-Callers). (An `ssh` listener logs its callers in +itself.) `petscii` and `rip` say whether callers may be Commodores or +RIPscrip terminals (see [PETSCII and RIP](PETSCII-and-RIP)), and `vt` says +whether terminals are asked what they are (see +[Terminal identification](Terminal-Identification)). ## The sections -| section | what | page | +| Section | What it sets | Page | |---|---|---| | `[general]` | the system: name, sysop, database, log, banner, message of the day, logo, new users, limits, timeouts, file areas' directory and limits | here, [Security](Security) | | `[listen NAME]` | a port or socket callers come in on | here, [Modem callers](Modem-Callers), [TN3270](TN3270) | @@ -41,19 +55,20 @@ whether terminals are asked what they are: [Terminal identification](Terminal-Id | `page_command` (in `[general]`) | telling the sysop of a page when they are not on | [Chat and paging](Chat-and-Paging) | | `geoip`, `geoip_credit`, `phone_country` (in `[general]`) | where callers are: a country database for addresses, the home country of caller IDs | [Modem callers](Modem-Callers#where-callers-are), [Web forum](Web-Forum#flags) | -`bbs check` reads the file and says what it found, with a warning for -anything risky (a password that may cross in the clear, a socket that -trusts whoever connects, a link without a password). +`bbs check` reads the file and reports what it found. It warns about +anything risky, such as a password that may cross the network in the +clear, a socket that trusts whoever connects, or a link without a +password. ## Editing it: the configuration screens -`bbs -config /etc/bbs/bbs.conf config` is full-screen menus on your -terminal for the file and the accounts, the BBS running or not. The same -menus are on the [sysop's tools](Sysop-Tools) (`F`, Configuration): full -screen on ANSI terminals, with PF keys on a 3270, and numbered lines on a -terminal with neither. +`bbs -config /etc/bbs/bbs.conf config` opens full-screen menus on your +terminal for editing the file and the accounts, whether or not the BBS is +running. The same menus are in the [sysop tools](Sysop-Tools) (`F`, +Configuration). They are full screen on ANSI terminals, use PF keys on a +3270, and become numbered lines on a terminal with neither. -| menu | what is in it | +| Menu | What is in it | |---|---| | Board configuration | the BBS's name, the sysop's, the location, postal address, dial-in numbers and internet addresses; the banner, message of the day, goodbye, logo; menus and prompts | | System configuration | the user and group it runs as; the database and log; where files are kept and how large they may be; deny lists, the hack log, bans; scheduled events; every section of the file as it is | @@ -62,12 +77,12 @@ terminal with neither. | Users and groups | the accounts (level, flags, sysop, locked, a new password; new ones; deleted ones) and the access levels | | Maintenance | disk space; what message areas keep, old messages taken out; the image boards' archive; backups: one now, those made, `[backup]` ([Backups](Backups)) | -System passwords (PAM, LDAP) are modemmenu's to check: it logs callers in -and hands them to the BBS ([Modem callers](Modem-Callers)). -Running as a user of its own (System configuration's Run as user) is in -[Running](Running#running-as-a-user-of-its-own). +System passwords (PAM, LDAP) are checked by modemmenu, which logs callers +in and hands them to the BBS (see [Modem callers](Modem-Callers)). Running +the BBS as a user of its own (System configuration's Run as user) is +covered in [Running](Running#running-as-a-user-of-its-own). -| key | | +| Key | What it does | |---|---| | arrows, PgUp, PgDn, Home, End | move (a letter goes to the next line beginning with it) | | Enter | open a menu, change a value (typed on the foot line, Enter to keep it), do an action | @@ -78,41 +93,45 @@ Running as a user of its own (System configuration's Run as user) is in | F10 | save and exit | | `A`, `D` | add one (a listener, a door, a user ...), delete it | -On a 3270, `S` by a menu opens it, values are typed over and sent with -Enter, PF1 is help, PF3 back, PF9 and PF10 as F9 and F10. On a terminal -without ANSI, a number opens or changes a line, `S` saves and exits, `X` -leaves without saving. +On a 3270, type `S` beside a menu to open it, type over values and send +them with Enter; PF1 is help, PF3 goes back, and PF9 and PF10 work like F9 +and F10. On a terminal without ANSI, type a line's number to open or change +it, `S` to save and exit, or `X` to leave without saving. -Nothing changes until you save: a changed line is marked `*` and the -foot counts what is not saved. The main menu's Review changes lists it -all, and Check the configuration reads the file as the BBS would. On -saving, the file is checked first (it is not saved if the BBS would not -start with it, or if someone changed it since it was read), written whole -with its permissions and owner kept and the last one as `bbs.conf.bak`, -every comment kept where it was (a new key goes below the sample's -commented example of it); then the accounts' and areas' changes are made. -On the sysop's menu, what may change while callers are on is put in force -at once, and the screen says what waits for a restart. With no file, the -screens offer to begin it from the sample. +Nothing changes until you save. A changed line is marked `*`, and the +bottom line counts the unsaved changes. The main menu's Review changes +lists them all, and Check the configuration reads the file as the BBS +would. -A key at a time, for scripts: +When you save, the file is checked first. It is not saved if the BBS would +not start with it, or if someone else changed it since it was read. It is +then written whole, keeping its permissions and owner, with the previous +version kept as `bbs.conf.bak`. Every comment stays where it was, and a new +key goes below the sample's commented example of it. After that, the +changes to accounts and areas are made. From the sysop's menu, settings +that can change while callers are on take effect at once, and the screen +says which ones wait for a restart. If there is no file yet, the screens +offer to start one from the sample. + +Scripts can read and change one key at a time: bbs -config /etc/bbs/bbs.conf config get general name bbs -config /etc/bbs/bbs.conf config get "listen telnet" bbs -config /etc/bbs/bbs.conf config set "listen ssh" address :2222 bbs -config /etc/bbs/bbs.conf config unset general motd -each checked as the BBS would read it before it is written, and what -changed printed with when it takes effect. +Each change is checked as the BBS would read it before it is written, +and the command prints what changed and when it takes effect. ## Changing it while callers are on -`systemctl reload bbs` (`ExecReload` in bbs.service.sample: SIGHUP) reads -the file again. A file the BBS would not start with changes nothing (the -log says why). Otherwise these take effect at once, and the log lists the -rest, which wait for a restart: +`systemctl reload bbs` (`ExecReload` in bbs.service.sample, which sends +SIGHUP) makes the BBS read the file again. If the BBS would not start with +the new file, nothing changes and the log says why. Otherwise the keys +below take effect at once, and the log lists the other changes, which wait +for a restart: -| section | live keys | +| Section | Keys that change at once | |---|---| | `[general]` | `name`, `sysop`, `location`, `postal_address`, `phone`, `addresses`, `banner`, `banner_file`, `motd`, `motd_file`, `goodbye`, `new_users`, `max_nodes`, `attempts`, `fail_delay`, `login_timeout`, `idle_timeout`, `throttle_failures`, `throttle_time`, `page_command`, `qwk_id`, `geoip`, `geoip_credit`, `geoip_credit_url`, `phone_country`, `new_user_level`, `validated_level` | | `[level N]` | all, and levels added or taken out | @@ -121,15 +140,19 @@ rest, which wait for a restart: | `[chan]` | all but `dir` | | `[http]` | `forum_guests`, `forum_theme`, `forum_flags` | -Listeners, servers (FTP, NNTP, IRC, the HTTP API ...), networks, doors, the -database and the log are made when the BBS starts, so they wait for a -restart; so does what a caller's session took when it began (its idle -timeout). The sysop's Configuration screen puts the file in force itself -when it writes it, and says which changes took effect and which wait. -bbs.service.sample's `ProtectSystem=strict` keeps the service from writing -/etc: give it `ReadWritePaths=/etc/bbs` (and the bbs user the file) for the -screen on the BBS to write; `bbs config` as root works either way. Mind that a file the BBS may write is one any sysop may give -commands to run (doors, events, `page_command`): leave it read-only where -sysops are not all trusted as much as root. +Listeners, servers (FTP, NNTP, IRC, the HTTP API and so on), networks, +doors, the database and the log are set up when the BBS starts, so changes +to them wait for a restart. So do settings a caller's session took when it +began, such as its idle timeout. The sysop's Configuration screen applies +the file itself when it writes it, and says which changes took effect and +which wait. + +bbs.service.sample's `ProtectSystem=strict` stops the service from writing +to /etc. For the Configuration screen inside the BBS to save, give the +service `ReadWritePaths=/etc/bbs` and give the bbs user the file. `bbs +config` run as root works either way. Be aware that if the BBS can write +its configuration, any sysop can make it run commands (doors, events, +`page_command`). Keep the file read-only if not every sysop is trusted as +much as root. **See also:** [Modem callers](Modem-Callers), [TN3270](TN3270), [Security](Security), [Sysop tools](Sysop-Tools) diff --git a/docs/wiki/Customization.md b/docs/wiki/Customization.md index 6e77d59..679ca10 100644 --- a/docs/wiki/Customization.md +++ b/docs/wiki/Customization.md @@ -1,6 +1,7 @@ -The BBS's look is the sysop's: screens of their own (ANSI art, text, 3270 -screens in color), menus of their own, and the prompts' words. None of it -is needed: without it the built-in screens and menus are used. +The sysop can change how the BBS looks: their own screens (ANSI art, text +and 3270 screens in colour), their own menus, and the wording of the +prompts. None of this is required; without it, the BBS uses its built-in +screens and menus. ## Screens @@ -11,45 +12,50 @@ Display files go in one directory: screens_dir = /etc/bbs/screens ``` -A screen is a name (lower case letters, digits, `_` and `-`) and one or -more files for different terminals: +A screen has a name (lower-case letters, digits, `_` and `-`) and one or +more files, one for each kind of terminal: -| file | what | shown to | +| File | What it is | Shown to | |---|---|---| | `NAME.ans` | ANSI art in CP437, as ANSI editors (PabloDraw, Moebius, TheDraw) save it; a SAUCE record after ^Z is dropped | ANSI terminals | -| `NAME.asc` | text (UTF-8 or ASCII) with [tags](#tags) for color, a page at a time | any text terminal; 3270s when there is no `.3270` | +| `NAME.asc` | text (UTF-8 or ASCII) with [tags](#tags) for colour, a page at a time | any text terminal; 3270s when there is no `.3270` | | `NAME.txt` | the same as `.asc` | the same | -| `NAME.3270` | text with color tags (below) | 3270s | +| `NAME.3270` | text with colour tags (below) | 3270s | | `NAME.rip` | RIPscrip (graphics and ANSI) in CP437; its buttons send keys to the menu showing it | [RIP terminals](PETSCII-and-RIP) | | `NAME.seq` | PETSCII, as C64 editors save it, sent as it is (no @-codes) | [Commodores](PETSCII-and-RIP) | -An ANSI terminal gets `.ans`, else `.asc`, else `.txt`; a RIP terminal -`.rip` before those; a plain one `.asc` or `.txt`; a Commodore `.seq`, -else `.asc` or `.txt` (translated); a 3270 `.3270`, `.asc` or `.txt`. ANSI art goes to a UTF-8 -terminal as UTF-8, and to any other as the CP437 bytes it is (what -SyncTERM, NetRunner and DOS terminal programs want). Files are read -each time they are shown, so they can be changed while the BBS runs; the -largest read is 256 KB. +Each terminal gets the first file it can show: -These are shown by themselves: +- an ANSI terminal: `.ans`, then `.asc`, then `.txt` +- a RIP terminal: `.rip`, then the same as ANSI +- a plain terminal: `.asc` or `.txt` +- a Commodore: `.seq`, then `.asc` or `.txt` (translated) +- a 3270: `.3270`, `.asc` or `.txt` -| name | when | in place of | +ANSI art is sent to a UTF-8 terminal as UTF-8, and to any other terminal +as its original CP437 bytes, which is what SyncTERM, NetRunner and DOS +terminal programs expect. Files are read each time they are shown, so you +can change them while the BBS runs. The largest file read is 256 KB. + +The BBS shows these screens by itself: + +| Name | When | Replaces | |---|---|---| | `logon` | when a caller connects, before the name prompt (on a 3270, in the logon screen's upper part) | the system's name, banner and how they came | | `newuser` | before a new user's questions | (added) | | `welcome` | after the login | the welcome lines (the message of the day still follows) | | `goodbye` | at a logoff | the `goodbye` line | -Others are shown by menus: `screen = NAME` on a menu, or a `screen:NAME` -item. [screens.sample](https://github.com/D-Modem/bbs/tree/HEAD/screens.sample) +Menus show the others, with `screen = NAME` on a menu or a `screen:NAME` +item. [screens.sample](https://github.com/D-Modem/bbs/tree/HEAD/screens.sample) has a set to start from. ### @-codes -Screens, menu titles, labels and prompts, and the strings take codes -that are filled in when shown: +Screens, menu titles, labels, prompts and strings can hold codes that are +filled in when they are shown: -| code | | +| Code | Filled in with | |---|---| | `@BBS@` `@SYSOP@` `@LOCATION@` | the system | | `@PHONE@` `@ADDRESSES@` `@POSTAL@` | how to reach it: `[general]`'s `phone`, `addresses`, `postal_address` | @@ -62,17 +68,18 @@ that are filled in when shown: | `@CLS@` | clear the screen | | `@PAUSE@` | wait for a key (on a 3270, a new page) | -`@CODE:20@` pads (or cuts) the value to 20 characters, `@CODE:-20@` -aligns it right: art keeps its shape whatever a name's length. Anything -else between @s (an e-mail address) is left as it is. The values are -cleaned like anything a caller writes: no escape sequences get into art -through a user's name. +`@CODE:20@` pads or cuts the value to 20 characters, and `@CODE:-20@` +aligns it to the right, so art keeps its shape whatever the length of a +name. Anything else between two @ signs (such as an email address) is left +as it is. Values are cleaned like anything a caller writes, so no escape +sequences can get into art through a user's name. ### Tags -Text screens (`.asc`, `.txt`), the [strings](#strings) and a -[menu's](#menus) title, labels and prompt take tags in braces: shortcuts -for ANSI's escape sequences, as `.3270` files have for a 3270's colors. +Text screens (`.asc`, `.txt`), the [strings](#strings), and a +[menu's](#menus) title, labels and prompt can hold tags in braces. Tags +are shortcuts for ANSI escape sequences, like the tags `.3270` files use +for a 3270's colours. ``` {clear}{cyan}{bright}*** @BBS@ ***{reset} @@ -80,38 +87,43 @@ for ANSI's escape sequences, as `.3270` files have for a 3270's colors. {pause} ``` -| tag | | +| Tag | What it does | |---|---| | `{clear}` `{cls}` | clear the screen (as `@CLS@`) | | `{pause}` | wait for a key (as `@PAUSE@`; in a string, dropped) | | `{home}` `{eol}` | the cursor to the top left; clear to the end of the line | -| `{black}` `{red}` `{green}` `{yellow}` `{blue}` `{magenta}` `{cyan}` `{white}` | the color of the letters (`{pink}` and `{turquoise}`, the 3270's names, are magenta and cyan) | -| `{on black}` ... `{on white}` | the color behind them | +| `{black}` `{red}` `{green}` `{yellow}` `{blue}` `{magenta}` `{cyan}` `{white}` | the colour of the letters (`{pink}` and `{turquoise}`, the 3270's names, are magenta and cyan) | +| `{on black}` ... `{on white}` | the colour behind them | | `{bright}` `{bold}` / `{normal}` | bright, or not | | `{blink}` `{underline}` `{reverse}` | | | `{default}` `{reset}` | plain again | -Each terminal gets what it can show: an ANSI terminal the escape -sequences; one without color (`Mono`) bright, underline and the like but -no colors; a Commodore its colors (no backgrounds, blink or underline); -a VT52 the clears and the cursor's moves; a plain terminal nothing (a -`{clear}` a new line). A screen ends plain whatever its last color. On -a 3270 a text screen's colors are its colors (each change taking a -column, below) and the other tags are dropped; a menu's labels show -their colors the same way, its title and prompt plain. Where tags -cannot be shown at all (a RIP terminal's buttons, a menu's title in -Who's online) they are dropped too. A menu's label keeps to its column -whatever its tags, and ends plain. In a text screen a line holding only -a `{clear}` or a `{pause}` (or `@CLS@`, `@PAUSE@`) leaves no blank line -behind. +Each terminal gets what it can show: -Only the sysop's text has tags: a caller who calls themselves `{red}bob` -is shown as `{red}bob`. ANSI art (`.ans`) keeps its braces as they are: -it has its own escape sequences. +- an ANSI terminal gets the escape sequences; +- a terminal without colour (`Mono`) gets bright, underline and the like, + but no colours; +- a Commodore gets its own colours (but no backgrounds, blink or + underline); +- a VT52 gets the clears and cursor moves; +- a plain terminal gets nothing (a `{clear}` becomes a new line). + +A screen always ends plain, whatever its last colour. On a 3270, a text +screen keeps its colours (each change takes a column, as explained below) +and the other tags are dropped. A menu's labels show their colours the +same way, while its title and prompt are plain. Where tags cannot be shown +at all (on a RIP terminal's buttons, or a menu's title in Who's online), +they are dropped too. A menu label stays in its column whatever its tags, +and ends plain. In a text screen, a line holding only `{clear}` or +`{pause}` (or `@CLS@` or `@PAUSE@`) leaves no blank line behind. + +Tags work only in the sysop's text: a caller who names themselves +`{red}bob` is shown as `{red}bob`. ANSI art (`.ans`) keeps its braces +as they are, because it has its own escape sequences. ### 3270 screens -A `.3270` file is lines of text with tags that change the color for the +A `.3270` file is lines of text with tags that change the colour for the rest of the line: ``` @@ -119,17 +131,17 @@ rest of the line: {blue}A bulletin board, by telnet, modem and TN3270.{default} plain again ``` -`{blue}` `{red}` `{pink}` `{green}` `{turquoise}` `{yellow}` `{white}` -`{default}`, and `{bright}` / `{normal}` (and `{clear}` and `{pause}` for a -new page; the text terminals' names, `{magenta}`, `{cyan}`, `{reset}`, are -taken too). On a 3270 each change of color takes a blank column (an -attribute byte, as 3270 fields work). +The tags are `{blue}` `{red}` `{pink}` `{green}` `{turquoise}` `{yellow}` +`{white}` `{default}`, `{bright}` and `{normal}`, plus `{clear}` and +`{pause}` for a new page. The text terminals' names (`{magenta}`, `{cyan}`, +`{reset}`) work too. On a 3270, each change of colour takes up a blank +column, because that is where the 3270 keeps the field's attribute byte. ## Menus -`[menu NAME]` sections make menus; `[menu main]` takes the place of the -built-in main menu, on text terminals and 3270s alike, and the others are -reached from it (and from each other). +Each `[menu NAME]` section makes a menu. `[menu main]` replaces the +built-in main menu on text terminals and 3270s alike, and the other menus +are reached from it and from each other. ``` [menu main] @@ -151,10 +163,10 @@ u = users User list z = back Back ``` -Each item is `KEY = ACTION Label`: one character (not `;` or `#`, which -begin comments), then what it does: +Each item is `KEY = ACTION Label`. The key is one character (not `;` or +`#`, which begin comments), and the action is what the item does: -| action | | +| Action | What it does | |---|---| | `areas` `mail` `who` `users` `profile` `info` `files` `boards` `doors` `chat` `page` `callers` `feedback` `qwk` `sysop` | the built-in parts (`callers`: the last callers; `feedback`: mail to the sysop; `qwk`: [offline mail](Offline-Mail); `boards`: the [image boards](Image-Boards); `sysop`: the [sysop tools](Sysop-Tools), for sysops) | | `terminal` | a 3270's terminal details | @@ -166,14 +178,14 @@ begin comments), then what it does: | `area:NAME` | straight into a message area | | `script:NAME` | run a script of `scripts_dir` ([Scripting](Scripting)) | -With `screen =`, a text terminal sees the screen (which shows the keys -itself), and a 3270 the screen's `.3270` (or `.asc`, `.txt`) version if -it has one, else the list of items in a box: a menu drawn as ANSI art -alone still works on a 3270. On a 3270 the key is typed in the option field; -PF3 goes back (on the main menu, logs off if a `logoff` item is there). -Doors are for text terminals: on a 3270, a door item says so. `bbs -check` refuses a menu that names a menu, door or screen that is not -there, and lists the menus it read. +With `screen =`, a text terminal sees the screen, which shows the keys +itself. A 3270 sees the screen's `.3270` (or `.asc` or `.txt`) version if +there is one, or otherwise the list of items in a box, so a menu drawn +only as ANSI art still works on a 3270. On a 3270 the caller types the key +in the option field, and PF3 goes back (on the main menu, it logs off if +there is a `logoff` item). Doors are for text terminals only; on a 3270, a +door item says so. `bbs check` refuses a menu that names a menu, door or +screen that does not exist, and lists the menus it read. ## Strings @@ -188,9 +200,9 @@ logoff_confirm = "Leaving so soon, @USER@?" welcome = "Hi @USER@, @NEWMAIL@ new letters." ``` -Each takes @-codes and [tags](#tags); quote a value to keep spaces at its -end. `welcome` is the 3270 main menu's greeting too (shown without its -tags, on both kinds of terminal). +Each string can hold @-codes and [tags](#tags). Put a value in quotes to +keep spaces at its end. `welcome` is also the greeting on the 3270 main +menu (shown there without its tags). ``` command_prompt = "{yellow}@USER@{default} @ {cyan}@BBS@{default} > " diff --git a/docs/wiki/Databases.md b/docs/wiki/Databases.md index 23d2749..6664816 100644 --- a/docs/wiki/Databases.md +++ b/docs/wiki/Databases.md @@ -1,9 +1,15 @@ The BBS keeps its users, messages, mail, file records, FidoNet and news -state, tokens and keys in one database: **SQLite** (the default, one file, -nothing to run), **PostgreSQL** (12 or later), **MySQL** (8.0 or later) or -**MariaDB** (10.11 or later; 10.6 with a difference, below). -File areas' files are kept on disk in every case (`files_dir`). Tested with -PostgreSQL 16, MySQL 8.4, and MariaDB 11.4, 10.11 and 10.6. +state, tokens and keys in one database. It can be: + +- **SQLite**, the default: one file, with nothing else to run +- **PostgreSQL** 12 or later +- **MySQL** 8.0 or later +- **MariaDB** 10.11 or later (10.6 works with one difference, described + below) + +The files in the file areas are always kept on disk (in `files_dir`), not +in the database. The BBS is tested with PostgreSQL 16, MySQL 8.4, and +MariaDB 11.4, 10.11 and 10.6. ```ini [general] @@ -13,7 +19,7 @@ database = /var/lib/bbs/bbs.db ; SQLite ;database = mariadb://bbs:PASSWORD@db.example.org:3306/bbs ; MariaDB ``` -| `database` | | +| `database` | Engine | |---|---| | a path (or `sqlite:PATH`) | SQLite: the file is made (0600) if it is not there | | `postgres://` or `postgresql://` | PostgreSQL, in pgx's form: `?sslmode=require`, `?search_path=bbs` and the like after it | @@ -21,34 +27,36 @@ database = /var/lib/bbs/bbs.db ; SQLite | `mariadb://...`, `mariadb:DSN` | MariaDB, the same way (the BBS finds MariaDB behind a `mysql://` too) | | `mysql:DSN` | MySQL in go-sql-driver's own form, for a unix socket: `mysql:bbs:PASSWORD@unix(/run/mysqld/mysqld.sock)/bbs` | -The BBS makes its tables (and adds columns later versions bring) when it -starts, or with `bbs init`. The database (PostgreSQL's, or MySQL's) must -be there, and the user own it or have `CREATE` in it; on PostgreSQL the -BBS also makes a collation, `nocase`, for names that match in any case. +The BBS creates its tables when it starts, or with `bbs init`, and adds +any columns that later versions bring. On PostgreSQL, MySQL and MariaDB the +database itself must already exist, and the BBS's user must own it or have +`CREATE` in it. On PostgreSQL the BBS also creates a collation, `nocase`, +so that names match in any case. -Logs and `bbs check` show the address with its password as `xxxxx`. The -configuration file has it in the clear: keep it 0640, the BBS's group's. +Logs and `bbs check` show the address with its password replaced by +`xxxxx`. The configuration file holds the password in the clear, so keep +the file at mode 0640, owned by the BBS's group. ## What differs -Little, by design: the BBS writes its SQL once, and each engine is given -its own forms of what differs (ids, placeholders, upserts, booleans, what -counts as a duplicate). +Very little, by design. The BBS writes its SQL once, and each engine gets +its own form of the parts that differ (ids, placeholders, upserts, +booleans, and what counts as a duplicate). - **Names** (users, areas, files) match in any case on all three; letters - with accents are not their plain letters (René is not Rene). SQLite + with accents are not their plain letters (René is not Rene). SQLite folds the case of ASCII letters only: `RENÉ` finds René on PostgreSQL and MySQL, not on SQLite. - **MySQL** keeps names, Message-IDs and other indexed text in `VARCHAR(255)`, descriptions and the like in `VARCHAR(1024)`, messages - in `MEDIUMTEXT` (16 MB). The BBS's connection sets the SQL mode it + in `MEDIUMTEXT` (16 MB). The BBS's connection sets the SQL mode it needs (`ANSI_QUOTES`, strict), whatever the server's default. - **MariaDB** is a MySQL to the BBS, but for its collations, which the BBS chooses when it connects: UCA 14.0's (`utf8mb4_uca1400_as_ci`, - 10.10 and later), which match names as MySQL's do. MariaDB 10.6 (out of + 10.10 and later), which match names as MySQL's do. MariaDB 10.6 (out of support since July 2026) has no collation that ignores case but not accents: there names ignore both (René *is* Rene, and only one of them - can be a user). `bbs check` and the log say which. + can be a user). `bbs check` and the log say which. - **SQLite** uses one connection (it takes one writer at a time); the servers up to ten. @@ -58,16 +66,17 @@ counts as a duplicate). bbs db copy postgres://bbs:PASSWORD@db.example.org/bbs ``` -copies the configured database, every table, into a new, empty one (made -as `bbs init` would), keeping ids, then says so; then set `database =` to -the new one. The BBS should be stopped while it copies. It goes any way: -SQLite to PostgreSQL, MySQL to SQLite, PostgreSQL to MySQL. +This copies every table of the configured database into a new, empty one +(set up as `bbs init` would), keeping the ids. When it is done, set +`database =` to the new one. Stop the BBS while it copies. It works in any +direction: SQLite to PostgreSQL, MySQL to SQLite, PostgreSQL to MySQL, and +so on. ## Backups -`bbs backup` (and `[backup]`'s `at`, daily) takes the database whole while -callers are on, with the configuration and the files: see -[Backups](Backups). A server's own tools do as well: `pg_dump`, -`mysqldump --single-transaction`. +`bbs backup` (or a daily backup set with `[backup]`'s `at`) copies the +whole database while callers are on, along with the configuration and the +files: see [Backups](Backups). A database server's own tools work as well, +such as `pg_dump` or `mysqldump --single-transaction`. **See also:** [Configuration](Configuration), [Running](Running), [Development](Development) diff --git a/docs/wiki/Development.md b/docs/wiki/Development.md index 819c79d..f255cf3 100644 --- a/docs/wiki/Development.md +++ b/docs/wiki/Development.md @@ -1,6 +1,10 @@ +This page is for people working on the BBS's code: how the source is laid +out, how the screens are shared between terminals, and what the tests +cover. + ## Layout -| | | +| Path | What it holds | |---|---| | `cmd/bbs` | the command: serve, check, init, user and area administration | | `internal/server` | listeners, session headers, rlogin, SSH, telling 3270s from the rest | @@ -41,7 +45,7 @@ | `internal/api` | the HTTP API: REST, server-sent events, WebSockets, metrics, OpenAPI; the web terminal page (`web/`: xterm.js, the page) | | `proto` | the WebSocket protocol, `bbs.v1` (`make proto` regenerates `internal/api/pb`) | | `internal/tcpserv` | what finger and gopher share: limits, timeouts | -| `internal/screens` | the sysop's display files: finding them, @-codes, 3270 color tags | +| `internal/screens` | the sysop's display files: finding them, @-codes, 3270 colour tags | | `internal/xfer` | XMODEM, YMODEM, ZMODEM and Kermit, both ways | | `internal/logo` | the logo: a PNG, or the name in a pixel font | | `internal/bbs` | the BBS itself: nodes, logins, new users, posting, cleaning text | @@ -51,11 +55,11 @@ ## Screens The screens after the login are written once, in `internal/app`, and -drawn by each front end. A screen is a description in -`internal/view`'s terms, handed to the front end, which shows it, waits -for the caller and says what they chose: +each front end draws them. A screen is a description in `internal/view`'s +terms. It is handed to the front end, which shows it, waits for the +caller, and reports what they chose: -| view | text terminal | 3270 | +| View | Text terminal | 3270 | |---|---|---| | `Menu` | `[K] Label` in two columns (one under 60 columns), RIP buttons, the command prompt | a box of keys, `Option ===>` | | `Table` | numbered rows a page at a time; `Area number, [N]ew scan, [Q]uit: ` | `S` by a row; PF keys; PF7/PF8 | @@ -65,22 +69,24 @@ for the caller and says what they chose: | `Draft` | `To`, `Subject`, the full-screen editor (ANSI) or the line editor | the editor screen | | `Confirm`, `Say`, `Show` | `[Y/n]`, a line, lines and a pause | a Y/N field, the message line, a page | -An action has a key for text terminals and a PF key for 3270s (and a -short label for the 3270's key line). What a front end alone can do is -its `app.Frontend`: the sysop's display files, chat, doors (text), file -transfers (protocols on text, IND$FILE on a 3270), the terminal's line -on the profile and what may be switched there, the goodbye. The logins -stay with the front ends, since they decide what the terminal is. +An action has a key for text terminals and a PF key for 3270s (plus a +short label for the 3270's key line). Whatever only a front end can do is +in its `app.Frontend`: the sysop's display files, chat, doors (text only), +file transfers (protocols on text, IND$FILE on a 3270), the terminal line +in the profile and the settings that can be switched there, and the +goodbye. Logins stay with the front ends, because they decide what the +terminal is. -A new screen is a function in `internal/app` building views; a new -front end implements `app.Frontend`. `internal/app`'s tests drive the -screens with a scripted front end, no terminal at all. +To add a screen, write a function in `internal/app` that builds views. To +add a front end, implement `app.Frontend`. `internal/app`'s tests drive +the screens with a scripted front end, with no terminal at all. ## Tests -With `BBS_TEST_DATABASE` set to a PostgreSQL, MySQL or MariaDB server, every test's -store is a database of its own there (a schema on PostgreSQL, a database -on MySQL, dropped after), so the whole suite runs on that engine: +With `BBS_TEST_DATABASE` set to a PostgreSQL, MySQL or MariaDB server, +each test gets a database of its own there (a schema on PostgreSQL, a +database on MySQL, dropped afterwards), so the whole suite runs on that +engine: ``` BBS_TEST_DATABASE='postgres://bbs:PASSWORD@127.0.0.1/bbs?sslmode=disable' go test ./... @@ -88,9 +94,12 @@ BBS_TEST_DATABASE='mysql://bbs:PASSWORD@127.0.0.1:3306/bbs' go test ./... BBS_TEST_DATABASE='mariadb://bbs:PASSWORD@127.0.0.1:3306/bbs' go test ./... ``` -(the user may `CREATE SCHEMA`, or `CREATE DATABASE`). The store's own -tests check what the engines do differently: names in any case, ids, -upserts, booleans, bytes, long text, cascades, copying from SQLite. +The user must be allowed to `CREATE SCHEMA` (or `CREATE DATABASE`). The +store's own tests check the things the engines do differently: names in +any case, ids, upserts, booleans, bytes, long text, cascades, and copying +from SQLite. + +### What the tests cover `make test` runs the unit tests (text cleaning, names and passwords, the configuration, telnet negotiation and the 3270 handoff) and whole sessions @@ -115,27 +124,27 @@ articles (parsing, limits, decoding, wildmats), the NNTP server with Python's nntplib as a newsreader (login, reading, overview, posting), its refusals (posting without a login, AUTHINFO before STARTTLS, forged headers, control messages, oversized articles, IHAVE from a stranger), two -BBSes peered both ways, and IHAVE. With `BBS_TEST_INN=host:port` it also -syncs with a running INN. FidoNet: packets and messages, a hub with two +BBSes peered both ways, and IHAVE. With `BBS_TEST_INN=host:port` it also +syncs with a running INN. FidoNet: packets and messages, a hub with two nodes exchanging echomail by binkp (SEEN-BY, PATH, threads, forwarding), netmail and replies, wrong passwords, unknown addresses and impostors, dupes, loops, bad and foreign packets, the echo-newsgroup gateway, and, when binkd and CrashMail are installed, a hub run by them: echomail and -netmail both ways, calling it and called by it. Doors: the drop files, +netmail both ways, calling it and called by it. Doors: the drop files, the runner (CP437 and UTF-8, time limit, hanging up, idle, single-caller doors, a pseudo-terminal), a caller opening a door from the menu, and, when the bbs-dosemu2 image is built, a real DOS door talking by FOSSIL in -it. Chat: rooms, history, private rooms, flooding, node messages, paging +it. Chat: rooms, history, private rooms, flooding, node messages, paging and answering, the page command (and that it runs no shell); two callers chatting and paging on the text BBS; a 3270 (s3270) chatting with a text -caller and getting a node message on its message line. Finger and +caller and getting a node message on its message line. Finger and gopher: their answers and refusals, with the finger program and curl as -clients. Customization: finding display files by terminal, SAUCE, -@-codes and widths, color tags; menus and strings in the configuration +clients. Customization: finding display files by terminal, SAUCE, +@-codes and widths, colour tags; menus and strings in the configuration and what it refuses; a text caller through an ANSI logon (CP437 as it is), the strings, a welcome screen, the sysop's menus and submenus, a screen with a pause and a goodbye screen; and a 3270 (s3270) through a -colored logon screen, welcome, the sysop's main menu and a screen. +coloured logon screen, welcome, the sysop's main menu and a screen. The shared screens: `internal/app` driven by a scripted front end (posting, reading on and back, a new scan and reply, a number not on the page, mail to no one and to the sysop, a node message, deleting, the @@ -165,10 +174,10 @@ and for a user, posting with refusals caught, a runaway loop stopped and a slow caller not, failures told to the sysop alone, a hang-up the script cannot catch, exit, the sample poll, the configuration's checks, and the sample one-liners on a text terminal and on a 3270 by s3270); the file base (FILE_ID.DIZ in CP437 -with colors, a ZIP's and a tar.gz's listings, new files, finding by the +with colours, a ZIP's and a tar.gz's listings, new files, finding by the DIZ's words, tagging by numbers, a batch of two by YMODEM, ratios and the day's limit together, the API's search and listings); MRC (a fake MRC server: the handshake, arrivals, NEWROOM, lines and -actions both ways, colors taken out, our own lines not shown twice, +actions both ways, colours taken out, our own lines not shown twice, private messages and server answers to one user, PING and IAMHERE, !commands and !!, a user in two rooms, LOGOFF, the line dropped and those here put back, rooms not MRC's not sent, require; on IRC, an MRC @@ -204,41 +213,41 @@ The HTTP API: logins, tokens and scopes, every REST endpoint and its refusals, rate limits, the OpenAPI document against the routes, server-sent events and node messages, both WebSockets (auth by header and by first message, chat between them, paging and answering, mail events, bad -frames, refused origins and tokens) and the metrics. And a terminal caller and +frames, refused origins and tokens) and the metrics. And a terminal caller and a web caller (the JSON WebSocket) together: chatting in one room both ways, `/who`, node messages each way, and the web caller paging the -sysop, who answers at the terminal. SSH: logging in by password, +sysop, who answers at the terminal. SSH: logging in by password, keyboard-interactive and key (and not by a wrong one, someone else's, or into a locked account), `new` to the BBS's prompt, the pty's terminal type and size, refused commands, SFTP and forwarding, a user adding and deleting a key in their profile, host keys made and kept (ed25519, RSA, ECDSA) and refused when readable, the configuration, legacy ciphers only when asked for, and the OpenSSH client logging in by key with a pty. -PETSCII: the translation (letters, colors, reverse, CR and LF, cursor +PETSCII: the translation (letters, colours, reverse, CR and LF, cursor movement, box drawing, accents, runes split across writes, wrapping) and the keys back; a Commodore logging in with DEL editing, its one column menus, a .seq screen as it is, the profile's width, no escape ever sent; -a Commodore found while logging in: by DEL typed in the name, by a shifted letter (and not by UTF-8), by a name in capitals and the DEL question (or not, with a backspace), and no question for a name in lower case. RIP: MegaNums, the +a Commodore found while logging in: by DEL typed in the name, by a shifted letter (and not by UTF-8), by a name in capitals and the DEL question (or not, with a backspace), and no question for a name in lower case. RIP: MegaNums, the commands and their escaping, the menu scene; a RIP terminal found by its answer, given a .rip screen, menus as buttons, the scene cleared on a choice and a pause before the next; an ANSI terminal without RIP given -none of it. Access levels: requirements read and written back, met and +none of it. Access levels: requirements read and written back, met and not (flags, !flags, sysop, locked users), flag edits; levels found for a user; areas hidden and posting refused by level and by flags, mail only to the sysop, chat and paging refused, the day's downloads counted and limited, doors, validation; the day's time running out (warned, hung up, counted); a new user waiting and validated by the sysop on the BBS; the API (no user raises their own level, levels and flags seen only by -sysops and the user, area requirements); the configuration. Terminal identification: the answers of DEC's terminals and +sysops and the user, area requirements); the configuration. Terminal identification: the answers of DEC's terminals and of emulators (VT100 to VT525, xterm old and new, VTE, tmux, SyncTERM, PuTTY, the Linux console, a VT52) read into names, levels, sixel and monochrome; DEC Special Graphics and Latin-1 output, escapes passing through it; VT52 output; a VT220 given DEC graphics, Latin-1 and bold, shown as a VT220; a VT52 given its escapes and its cursor keys ignored; -a terminal answering nothing left plain. The web terminal: the page, its +a terminal answering nothing left plain. The web terminal: the page, its headers and files (and no others), WebSockets refused from another origin or without the subprotocol, and a caller logging in through it, -its size taken, shown as a web terminal, logging off. The web forum: +its size taken, shown as a web terminal, logging off. The web forum: guests reading (and not what needs a level), logging in and out by the API's session tokens (and not by an API key), signing up; topics and replies, forms refused without their token, posts' HTML escaped and links @@ -247,10 +256,10 @@ topics and areas, aliases hiding the writer, deleting (the writer's own, the sysop's any), news-only areas, search and who's online; in the store, topics threaded across areas, read marks, a topic mended when its first post or its replies' parent goes, and threads found for messages from -before. Every page in each theme, for a guest and a member; choosing a +before. Every page in each theme, for a guest and a member; choosing a theme (a member's form needing its token, an unknown theme refused, no going back off the forum), and the forum's own theme until a caller -chooses. Updating xterm.js: +chooses. Updating xterm.js: `npm pack @xterm/xterm @xterm/addon-fit @xterm/addon-image`, and copy `lib/xterm.js`, `css/xterm.css`, `lib/addon-fit.js`, `lib/addon-image.js` and the license into `internal/api/web` (without their source map lines); diff --git a/docs/wiki/Doors.md b/docs/wiki/Doors.md index da4cb94..ff66c7e 100644 --- a/docs/wiki/Doors.md +++ b/docs/wiki/Doors.md @@ -1,14 +1,21 @@ -Text callers (telnet, modem, rlogin) open doors with *D* on the main menu. -A door is a program the BBS hands the caller's line to: it writes the drop -files doors read (DOOR.SYS, DORINFO1.DEF, DOOR32.SYS and CHAIN.TXT, in the -node's own directory), runs the door, and joins the two until the door -ends, the caller hangs up (the door is stopped), the door's time limit -runs out, or the caller types nothing for the idle time. A door's output -in CP437 is shown as UTF-8 to UTF-8 terminals, and what they type goes -back as CP437; a CP437 terminal (SyncTERM, NetRunner, a modem caller) gets -the bytes as they are. 3270 callers do not see doors: doors are ANSI. +A door is a program, often a game, that the BBS hands the caller's line +to. Text callers (telnet, modem, rlogin) open doors with *D* on the main +menu. This page covers DOS doors, Linux doors, and doors on other +systems. -**DOS doors** run in dosemu2, in Docker. `doors/dosemu2` builds the image: +When a caller opens a door, the BBS writes the drop files that doors read +(DOOR.SYS, DORINFO1.DEF, DOOR32.SYS and CHAIN.TXT, in the node's own +directory), runs the door, and connects the caller to it. The door runs +until it ends, the caller hangs up (which stops the door), the door's time +limit runs out, or the caller types nothing for the idle time. A door's +CP437 output is shown as UTF-8 on UTF-8 terminals, and what those callers +type goes back as CP437. A CP437 terminal (SyncTERM, NetRunner, a modem +caller) gets the bytes unchanged. 3270 callers do not see doors, because +doors are ANSI programs. + +## DOS doors + +DOS doors run in dosemu2, in Docker. `doors/dosemu2` builds the image: dosemu2 with its fdpp kernel and comcom64 shell, built from source on Ubuntu (no PPA needed): @@ -16,13 +23,14 @@ Ubuntu (no PPA needed): make doors-image ; docker build -t bbs-dosemu2 doors/dosemu2 ``` -In the container the door's drive is F: (`/doors`, mount your doors there) -and the node's drop files are on G: (`/node`); the caller is on COM1 behind -dosemu2's own FOSSIL driver, which is what DOS doors talk to. The image's -`rundoor DOSDIR COMMAND` loads the FOSSIL, goes to the door's directory and -runs it; what the door shows on its own screen (not COM1) and dosemu2's -messages go to `dosemu.out` in the node's directory, and the command's -own errors (Docker's) to `door.log` there. +In the container, the door's drive is F: (`/doors`; mount your doors +there) and the node's drop files are on G: (`/node`). The caller is on +COM1, behind dosemu2's own FOSSIL driver, which is what DOS doors talk to. +The image's `rundoor DOSDIR COMMAND` loads the FOSSIL driver, changes to +the door's directory and runs it. Anything the door shows on its own +screen (rather than COM1), and dosemu2's messages, go to `dosemu.out` in +the node's directory; errors from the command itself (Docker's) go to +`door.log` there. ``` [door lord] @@ -33,42 +41,44 @@ time_limit = 60 cleanup = docker rm -f bbs-door{node} ``` -`{node}`, `{dir}` (the node's directory), `{uid}` and `{gid}` (the BBS's -own: the door writes the node's files as the BBS), `{userid}`, -`{minutes}`, `{rows}`, `{cols}` and `{baud}` are filled in. Most doors are +The BBS fills in `{node}`, `{dir}` (the node's directory), `{uid}` and +`{gid}` (the BBS's own, so the door writes the node's files as the BBS), +`{userid}`, `{minutes}`, `{rows}`, `{cols}` and `{baud}`. Most doors are told where the drop file is on their command line or in their own -configuration: here that is `G:\DOOR.SYS` (or `G:\DORINFO1.DEF`, ...). -Each node has its own directory, so multi-node doors work; `single = yes` -lets one caller at a time into a door that is not. dosemu2 runs the door -under its CPU emulator unless the host offers `/dev/kvm` to the container -(`--device /dev/kvm`, untried here); a door starts in about a second -under the emulator. +configuration; here that is `G:\DOOR.SYS` (or `G:\DORINFO1.DEF`, and so +on). Each node has its own directory, so multi-node doors work, and +`single = yes` lets only one caller at a time into a door that is not +multi-node. dosemu2 runs the door under its CPU emulator unless the host +gives the container `/dev/kvm` (`--device /dev/kvm`, not yet tried). Under +the emulator, a door starts in about a second. -**Linux doors**: any program that talks to a terminal on its standard -input and output, with `pty = yes` for one that wants a terminal (most -do), and `charset = utf-8` for one that writes UTF-8. DOOR32.SYS says -`door32_comm = local` to them. +The BBS runs `docker` itself, so its user must be allowed to. That means +the `docker` group (which is as powerful as root, so think twice), or +rootless Docker or Podman (`command = podman run ...`). The door's +container has no network (`--network none`), runs as the BBS's user rather +than root, and is removed when the door ends or the caller hangs up. -The BBS runs `docker` itself, so its user must be allowed to: the -`docker` group (which is as good as root: think twice), or rootless Docker -or Podman (`command = podman run ...`). The door's container has no -network (`--network none`), runs as the BBS's user, not root, and is -removed when the door ends or the caller hangs up. +This was tested with a FOSSIL door written for the purpose +(`doors/dosemu2/testdoor`, which reads DOOR.SYS, writes CP437 and ANSI, +and echoes keys) through the whole BBS: the caller types, the door +answers, and when the caller hangs up inside it, the container goes. -It was tried with a FOSSIL door of its own (`doors/dosemu2/testdoor`, -which reads DOOR.SYS, writes CP437 and ANSI and echoes keys) through the -whole BBS: the caller types, the door answers, the caller hangs up in it -and the container goes. +## Linux doors + +A Linux door is any program that talks to a terminal on its standard +input and output. Set `pty = yes` for a program that wants a terminal +(most do), and `charset = utf-8` for one that writes UTF-8. DOOR32.SYS +tells these doors `door32_comm = local`. ## Doors elsewhere -A door can be on another system: the caller's line is joined to it over -the network rather than to a program here. Such a door has a `type` and -no command or drop files. It is shown and opened like any other, with -the same time limit, idle time, `require`, `sysop_only` and character -set (CP437 by default, translated for UTF-8 terminals). +A door can also be on another system, with the caller's line connected to +it over the network instead of to a program here. Such a door has a +`type` and no command or drop files. It is listed and opened like any +other door, with the same time limit, idle time, `require`, `sysop_only` +and character set (CP437 by default, translated for UTF-8 terminals). -| `type` | | settings | +| `type` | What it is | Settings | |---|---|---| | `telnet` | a telnet door server | `address` (host:port) | | `rlogin` | an RLogin door server (RFC 1282) | `address`; `client_user`, `server_user` (default `{user}`, the caller's name), `terminal` (`ansi`) | @@ -93,20 +103,20 @@ tag = XB host_key = SHA256:... ``` -How each gets in: +How the BBS connects to each: -- **Telnet**: the server's negotiation is answered here: the BBS is a - binary ANSI terminal of the caller's size (`TERMINAL-TYPE`, `NAWS`), and - the server may echo. None of it reaches the caller. -- **RLogin**: the client and server user names and the terminal (with the - line's speed), then the session. -- **BBSLink**: a token from BBSLink's web server, which then authenticates - the caller with your codes (as MD5s with the token), then telnet. It - knows the caller by their user number. -- **DoorParty**: an SSH tunnel with its account, no - doorparty-connector needed, then RLogin through it as `[TAG]name`, the - door's code as the terminal type. Without `host_key`, the server's key - isn't checked: `bbs check` warns, and each call logs the key's - fingerprint to put there. +- **Telnet**: the BBS answers the server's negotiation itself, presenting + a binary ANSI terminal of the caller's size (`TERMINAL-TYPE`, `NAWS`), + and lets the server echo. None of this reaches the caller. +- **RLogin**: the BBS sends the client and server user names and the + terminal (with the line's speed), then starts the session. +- **BBSLink**: the BBS gets a token from BBSLink's web server, which then + authenticates the caller with your codes (sent as MD5s with the token), + and connects by telnet. BBSLink knows the caller by their user number. +- **DoorParty**: the BBS opens an SSH tunnel with its account (no + doorparty-connector is needed), then connects through it by RLogin as + `[TAG]name`, with the door's code as the terminal type. Without + `host_key`, the server's key is not checked; `bbs check` warns about + this, and each call logs the key's fingerprint so you can add it. **See also:** [Security](Security), [Future work](https://github.com/D-Modem/bbs/blob/HEAD/TODO.md) diff --git a/docs/wiki/FidoNet.md b/docs/wiki/FidoNet.md index 50a30c2..290cf6f 100644 --- a/docs/wiki/FidoNet.md +++ b/docs/wiki/FidoNet.md @@ -1,9 +1,9 @@ The BBS can be a node (or point) of FidoNet or any other FTN network -(fsxNet, AgoraNet, a network of your own): a message area becomes an -echo when it is given an echo tag, users write netmail by addressing mail -to `Name@zone:net/node`, and the BBS exchanges packets with its links by -binkp, calling them and answering them. It is its own tosser, scanner and -mailer: no other FTN software is needed. +(fsxNet, AgoraNet, or a network of your own). A message area becomes an +echo when it is given an echo tag, users send netmail by addressing mail +to `Name@zone:net/node`, and the BBS exchanges packets with its links over +binkp, both calling them and answering their calls. The BBS is its own +tosser, scanner and mailer, so no other FTN software is needed. ``` bbs area echo General FSX_GEN ; General is the echo FSX_GEN @@ -54,60 +54,71 @@ areafix = yes ; ...and asks for, by AreaFix and FileFix areafix_password = FIXIT2 ``` -**Echomail**: what users post in an echo is packed for each link that -carries it (with MSGID, REPLY for threads, PID, TZUTC, CHRS, tear and -origin lines, SEEN-BY and PATH), and what links send is tossed into the -echo, decoded from its character set (CP437 and the other DOS code pages, -Latin-1, KOI8, Windows code pages, UTF-8, by its CHRS kludge) and cleaned -like anything else a caller writes. With more than one link the BBS -passes echomail on between them, by SEEN-BY, as a hub does. Messages are -taken once (by MSGID, or a digest of messages that lack one) and never if -this system is in their PATH already. +## Echomail -**Netmail**: on the text BBS and on a 3270, mail to `Name@1:2/3` (or -`Name@1:2/3.4`) is netmail, sent by the link with that address, the -link of that point's node, or else the link with `route = yes`. Netmail -for this system goes to the user of that name, or the sysop, from +Messages users post in an echo are packed for each link that carries it +(with MSGID, REPLY for threads, PID, TZUTC, CHRS, tear and origin lines, +SEEN-BY and PATH). Messages that links send are tossed into the echo, +decoded from their character set according to their CHRS kludge (CP437 +and the other DOS code pages, Latin-1, KOI8, Windows code pages, UTF-8), +and cleaned like anything else a caller writes. With more than one link, +the BBS passes echomail on between them by SEEN-BY, as a hub does. Each +message is taken only once (by its MSGID, or by a digest for messages +without one), and never if this system is already in its PATH. + +## Netmail + +On the text BBS and on a 3270, mail to `Name@1:2/3` (or `Name@1:2/3.4`) is +netmail. It is sent through the link with that address, or the link of +that point's node, or otherwise the link with `route = yes`. Netmail for +this system goes to the user of that name (or to the sysop), from `Name@zone:net/node`, so *Reply* answers it as netmail (with a REPLY -kludge). The BBS routes no one else's netmail: it is a leaf. +kludge). The BBS does not route anyone else's netmail: it is a leaf. -**binkp** (FTS-1026) with CRAM-MD5 passwords (FTS-1027): links are known by -their address and password, others are turned away; a password is never -sent in the clear unless `plain_password = yes`. Packets are Type 2+, -sent as ARCmail bundles (`packer = zip`, the default, or `arc`, `arj`, -`lha`) or bare (`none`); received bundles of any of the four (whatever -they are called: the BBS reads their contents to tell) and packets are -tossed, and broken packets go to `dir/bad`. Files with no TIC that are a -day old (file requests, a sysop's file sent by hand) are set aside in -`dir/in/LINK/files`. New mail is packed within a minute -(netmail at once), and a link with a host is called when it has mail waiting (again every -five minutes while calls fail) and every `poll` seconds. The first scan -for a new link only marks where to start: the history is not dumped on -it. +## binkp -An area that is both an echo and a newsgroup is a gateway: echomail is +The mailer speaks binkp (FTS-1026) with CRAM-MD5 passwords (FTS-1027). +Links are recognised by their address and password, and other systems are +turned away. A password is never sent in the clear unless +`plain_password = yes`. + +Packets are Type 2+, sent as ARCmail bundles (`packer = zip`, the default, +or `arc`, `arj`, `lha`) or as bare packets (`none`). Received bundles of +any of the four kinds (whatever they are called; the BBS reads their +contents to tell) and bare packets are tossed, and broken packets go to +`dir/bad`. Files without a TIC that are a day old (such as file requests, +or a file a sysop sent by hand) are set aside in `dir/in/LINK/files`. + +New mail is packed within a minute (netmail at once). A link with a host +is called when mail is waiting for it (and again every five minutes while +calls fail), and every `poll` seconds. The first scan for a new link only +marks where to start, so the link is not sent the whole history. + +## Gateways to newsgroups + +An area that is both an echo and a newsgroup is a gateway. Echomail is served to newsreaders as articles (From `Name `, -the Message-ID made of the MSGID as other gateways make it), and articles -from news peers go out as echomail. Most FidoNet echoes do not want -gated traffic: ask first. +with the Message-ID made from the MSGID as other gateways do), and +articles from news peers go out as echomail. Most FidoNet echoes do not +want gated traffic, so ask first. ## Bundles -ARCmail comes in ZIP from nearly every hub, but older systems send ARC, -ARJ or LHA. The BBS reads all four itself (no archivers to install): -ZIP's stored and deflated, ARC's stored, packed, squeezed, crunched and -squashed, ARJ's methods 1 to 4, and LHA's `-lh0-`, `-lh4-` to `-lh7-` -with header levels 0 to 2. What it writes, with `packer = arc`, `arj` -or `lha`, is stored, uncompressed: every unpacker reads it. The same -readers list archives in the file areas and find their FILE_ID.DIZ. +Nearly every hub sends ARCmail as ZIP, but older systems send ARC, ARJ or +LHA. The BBS reads all four itself, so there are no archivers to install: +ZIP's stored and deflated methods; ARC's stored, packed, squeezed, +crunched and squashed; ARJ's methods 1 to 4; and LHA's `-lh0-` and +`-lh4-` to `-lh7-`, with header levels 0 to 2. Bundles it writes with +`packer = arc`, `arj` or `lha` are stored uncompressed, so every unpacker +can read them. The same readers list archives in the file areas and find +their FILE_ID.DIZ. ## Nodelists -`nodelist` in `[fido]` names nodelists (FTS-5000), by path or pattern, -or `area:NAME` for the file area the NODELIST file echo fills; the newest -file of each is read, plain or in an archive, and read again when a newer -one comes. -With a nodelist: +`nodelist` in `[fido]` names nodelists (FTS-5000) by path or pattern, or +as `area:NAME` for the file area that the NODELIST file echo fills. The +BBS reads the newest file of each, plain or in an archive, and reads it +again when a newer one arrives. With a nodelist: - netmail to a node it lacks, or has as down, is refused as it is written, and the writer is told the system's name and place when it is @@ -117,15 +128,16 @@ With a nodelist: - `bbs fido node` and `bbs fido nodes` look systems up, and callers can too: **N** (PF5 on a 3270) in their mailbox searches the nodelist. -Only zones the nodelists have are checked: netmail for other zones, and -for links, goes as it did. +Only zones that the nodelists cover are checked. Netmail for other zones, +and for links, is sent without a check. ## AreaFix and FileFix -A link with `areafix = yes` manages its own echoes: it has, of those -`echoes` (and `fileechoes`) allow, the ones it asks for, by netmail to -AreaFix (or AreaMgr) and to FileFix (or FileMgr, AllFix, Raid, TicFix) -with its `areafix_password` as the subject and a command a line: +A link with `areafix = yes` manages its own echoes. Out of the echoes +that `echoes` (and `fileechoes`) allow, it gets the ones it asks for, by +sending netmail to AreaFix (or AreaMgr) and FileFix (or FileMgr, AllFix, +Raid, TicFix) with its `areafix_password` as the subject and one command +per line: ``` +FSX_GEN link it (a pattern too: +FSX_*) @@ -136,39 +148,43 @@ with its `areafix_password` as the subject and a command a line: %HELP this ``` -The answer comes back by netmail. The sysop can do the same from the +The answer comes back by netmail. The sysop can do the same from the command line (`bbs fido link`, `unlink`, `filelink`, `fileunlink`) and see -what a link has (`bbs fido subs`). A link without `areafix` has every -echo `echoes` allows, as before. +what a link has (`bbs fido subs`). A link without `areafix` gets every +echo that `echoes` allows. -The other way, `bbs fido areafix hub COMMAND...` (and `filefix`) writes -to a link's robot with `areafix_password`; `create = yes` on that link has -the echoes and file echoes it then sends made here (a message area, or a -sysop-upload file area, named by the tag) instead of dropped. +In the other direction, `bbs fido areafix hub COMMAND...` (or `filefix`) +writes to a link's robot with `areafix_password`. With `create = yes` on +that link, the echoes and file echoes it then sends are created here (as +a message area, or a sysop-upload file area, named by the tag) instead of +being dropped. ## File echoes -A file area becomes a file echo with `bbs filearea echo AREA TAG`. Files -come with TICs (FTS-5006): each is checked (from the link, its -`tic_password`, size and CRC-32, not a dupe and not already past this -system), put in the area with its description, and passed on, with its -own TIC, to the other links that carry the echo and are not in its -SEEN-BY. A TIC's `Replaces` removes the older files it names, of those -that came by a file echo. Files uploaded here (by callers, FTP or `bbs -file add`) are hatched: sent to every link that carries the echo. A file -that does not match its TIC goes to `dir/bad`; a TIC waits a day for its -file. As with echomail, the first scan for a link only marks where to +A file area becomes a file echo with `bbs filearea echo AREA TAG`. Files +arrive with TICs (FTS-5006). Each file is checked (that it came from the +link with its `tic_password`, its size and CRC-32, that it is not a +duplicate, and that it has not already passed this system), put in the +area with its description, and passed on with its own TIC to the other +links that carry the echo and are not in its SEEN-BY. A TIC's `Replaces` +removes the older files it names, among those that came by a file echo. +Files uploaded here (by callers, by FTP or with `bbs file add`) are +hatched, which means sent to every link that carries the echo. A file +that does not match its TIC goes to `dir/bad`, and a TIC waits a day for +its file. As with echomail, the first scan for a link only marks where to start. -## Tried against +## Testing -binkd 1.1a and CrashMail II 1.7: echomail and netmail both ways, calling -binkd and called by it, with ZIP bundles and CRAM-MD5. Bundles made by -the real `arc`, `arj` and `jlha` are tossed, and what the BBS writes those -tools unpack. +The BBS was tested against binkd 1.1a and CrashMail II 1.7, with echomail +and netmail in both directions, both calling binkd and being called by it, +with ZIP bundles and CRAM-MD5. Bundles made by the real `arc`, `arj` and +`jlha` are tossed correctly, and those tools unpack what the BBS writes. -What is not done: file requests (FREQ), routing others' netmail, binkp's -NR mode, CRYPT and multiple batches (it speaks binkp/1.0, which every -mailer accepts), and EMSI for mailers calling by modem. +## Not supported + +File requests (FREQ), routing other systems' netmail, binkp's NR mode, +CRYPT and multiple batches (the BBS speaks binkp/1.0, which every mailer +accepts), and EMSI for mailers calling by modem. **See also:** [Newsgroups and NNTP](Newsgroups-and-NNTP), [Security](Security) diff --git a/docs/wiki/File-Transfers.md b/docs/wiki/File-Transfers.md index 2b5b55d..423ff56 100644 --- a/docs/wiki/File-Transfers.md +++ b/docs/wiki/File-Transfers.md @@ -1,9 +1,14 @@ -Besides FTP, files move over the caller's own line. +As well as using FTP, callers can move files over their own connection to +the BBS. This page covers the transfer protocols for text callers and +IND$FILE for 3270 callers. -**Text callers** (telnet, modem, rlogin) pick a file's details and press -*D* to download, or *U* in an area to upload, then a protocol: +## Text callers -| key | protocol | | +Text callers (telnet, modem, rlogin) open a file's details and press *D* +to download it, or press *U* in an area to upload, and then choose a +protocol: + +| Key | Protocol | Notes | |---|---|---| | X | XMODEM | CRC, or checksum if the terminal program asks; 128-byte blocks | | 1 | XMODEM-1K | 1K blocks | @@ -11,22 +16,28 @@ Besides FTP, files move over the caller's own line. | Z | ZMODEM | batch, CRC-32, error recovery; most terminal programs start it by themselves | | K | Kermit | for 7-bit lines and anything else that fails | -XMODEM sends no name, so the BBS asks for one. Names a terminal program -sends lose any path (`C:\DOS\GAME.ZIP` becomes `GAME.ZIP`) and characters -the file areas do not take; an upload goes through the same checks, size -limit and daily allowance as one by FTP, and is kept only if it all came. -X/Y/ZMODEM need an 8-bit clean line: a modem, rlogin, or telnet in binary -mode (the BBS asks for it; a client that refuses is warned). +XMODEM does not send a file name, so the BBS asks for one. Names that a +terminal program sends lose any path (`C:\DOS\GAME.ZIP` becomes +`GAME.ZIP`) and any characters the file areas do not accept. An upload +goes through the same checks, size limit and daily allowance as an FTP +upload, and is kept only if it arrived complete. XMODEM, YMODEM and ZMODEM +need an 8-bit clean line: a modem, rlogin, or telnet in binary mode (the +BBS asks for binary mode, and warns a client that refuses). -**3270 callers** use their emulator's file transfer (IND$FILE): in a file -area (8 on the main menu, then S by an area), with the cursor on the -command line, start a transfer: *send* to upload into the area, *receive* -to download a file of it, the host file name being the file's name. The -emulator types `IND$FILE PUT name` or `IND$FILE GET name` and the BBS plays -the host's part in DFT mode (structured fields), as TSO's IND$FILE does. -Binary mode keeps a file as it is; ASCII with CR/LF stores text with CR LF -line ends and gives it back as the PC wants it. TSO or VM/CMS host type -both work. The emulator must do DFT (x3270, c3270, wc3270 and PCOMM do; -*Your terminal* shows reply 95, Distributed Data Management). +## 3270 callers + +3270 callers use their emulator's file transfer, IND$FILE. In a file area +(8 on the main menu, then S beside an area), with the cursor on the +command line, start a transfer: *send* to upload into the area, or +*receive* to download one of its files, with the file's name as the host +file name. The emulator types `IND$FILE PUT name` or `IND$FILE GET name`, +and the BBS plays the host's part in DFT mode (structured fields), as +TSO's IND$FILE does. + +Binary mode keeps a file exactly as it is. ASCII with CR/LF stores text +with CR LF line ends and gives it back the way the PC expects. Both the +TSO and VM/CMS host types work. The emulator must support DFT (x3270, +c3270, wc3270 and PCOMM do; *Your terminal* shows reply 95, Distributed +Data Management). **See also:** [Files and FTP](Files-and-FTP), [TN3270](TN3270) diff --git a/docs/wiki/Files-and-FTP.md b/docs/wiki/Files-and-FTP.md index 0285463..176b8df 100644 --- a/docs/wiki/Files-and-FTP.md +++ b/docs/wiki/Files-and-FTP.md @@ -1,37 +1,39 @@ -File areas hold files; callers browse them from the BBS (*F* on the main -menu) and move them with an FTP client, logging in with their BBS name -and password: each area is a directory. +File areas hold files for callers to download and upload. Callers browse +them on the BBS (*F* on the main menu), and can also use an FTP client, +logging in with their BBS name and password; each area is a directory +there. ## On the BBS -| | key | PF | | +| Action | Key | PF | What it does | |---|---|---|---| | an area | its number | `S` by it | its files, by name | | new files | `N` | PF5 | the files added since your last call (the last 30 days on a first call), in every area, newest first | | find | `F` | PF10 | files whose name or descriptions have the words (in any case) | | batch | `B` | | the files tagged, to download together (text terminals) | -A file's details show its description and, for an archive, its longer -description: an archive uploaded with a `FILE_ID.DIZ` (in the archive's -top level) is described by it, the first line that says something -becoming its description unless the uploader gave one (CP437 art is -decoded, colors and control characters left out, at most 20 lines). -From the details: +A file's details show its description and, for an archive, a longer +description. If an archive is uploaded with a `FILE_ID.DIZ` at its top +level, that file becomes the long description, and its first meaningful +line becomes the description unless the uploader gave one. (CP437 art is +decoded, colours and control characters are removed, and at most 20 +lines are kept.) From the details, a caller can: -| | key | PF | | +| Action | Key | PF | Notes | |---|---|---|---| | download | `D` | | by a transfer protocol ([File transfers](File-Transfers)) | | tag | `T` | | into the batch, or out of it | | view | `V` | PF6 | what is in a ZIP, tar or tar.gz: names, sizes, dates | | describe, remove | `E`, `R` | PF5, PF9 | its uploader's or a sysop's | -In an area, `T` tags by numbers (`1 3 5-7`); `*` marks those tagged. -The batch goes by YMODEM, ZMODEM or Kermit (XMODEM sends one file), all -at once; a file counts as downloaded once the protocol has gone on to -the next or the transfer has ended well, and leaves the batch. The day's -downloads and the [ratio](Access-Levels) are checked for the whole batch -before it starts. On a 3270, files come and go by IND$FILE on the -area's command line ([TN3270](TN3270)). +In an area, `T` tags files by number (`1 3 5-7`), and `*` marks the +tagged ones. The batch is sent all at once by YMODEM, ZMODEM or Kermit +(XMODEM sends only one file). A file counts as downloaded, and leaves the +batch, once the protocol has moved on to the next file or the transfer +has ended successfully. The day's downloads and the +[ratio](Access-Levels) are checked for the whole batch before it starts. +On a 3270, files are uploaded and downloaded with IND$FILE on the area's +command line (see [TN3270](TN3270)). ``` ; bbs.conf @@ -57,11 +59,14 @@ bbs file add Games ./doom.zip "Shareware Doom" bbs file list Games ``` -The FTP side is [ftpserverlib](https://github.com/fclairamb/ftpserverlib) -with a file system of the BBS's own: `/` lists the areas, an area its -files, and nothing of the server's disk is reachable. Files are stored -under their record's number (`files_dir/1`, `files_dir/2`, ...), so no name -a user gives becomes a path. Users may: +## The FTP server + +The FTP server is built on +[ftpserverlib](https://github.com/fclairamb/ftpserverlib) with the BBS's +own file system: `/` lists the areas, each area lists its files, and +nothing else on the server's disk can be reached. Files are stored under +their record's number (`files_dir/1`, `files_dir/2` and so on), so a name a +user gives never becomes a path. Users can: - download anything (resuming too); - upload a new file into an area (not a sysop-only one), whose name is @@ -72,17 +77,19 @@ a user gives becomes a path. Users may: - delete their own files (sysops any). Everything else (overwriting, appending, resuming uploads, renaming, -directories, SITE, MFMT, CHMOD) is refused. Active mode is off (FTP -bounce), data connections must come from the control connection's -address, and the login is the BBS's, with its failure delay and its -throttling by address. `tls = required` (the default) refuses `USER` -before TLS, so no password crosses in the clear; `implicit` is TLS from -the first byte; `optional` and `no` are there for old clients, and `bbs -check` warns of them. `anonymous = yes` lets `anonymous` and `ftp` in to -download only. +directories, SITE, MFMT, CHMOD) is refused. Active mode is off, to prevent +FTP bounce attacks, and data connections must come from the same address +as the control connection. Logins are checked like any BBS login, with +its failure delay and throttling by address. -Open the FTP port and the passive range in the firewall. An FTP session -is not a node: it does not show in who's online or count against -`max_nodes`; `[ftp] max_clients` and `max_per_ip` limit it. +`tls = required` (the default) refuses `USER` before TLS, so no password +crosses the network in the clear. `implicit` uses TLS from the first byte. +`optional` and `no` are there for old clients, and `bbs check` warns about +them. `anonymous = yes` lets `anonymous` and `ftp` log in to download +only. + +Open the FTP port and the passive port range in the firewall. An FTP +session is not a node: it does not appear in Who's online or count against +`max_nodes`. `[ftp] max_clients` and `max_per_ip` limit FTP sessions. **See also:** [File transfers](File-Transfers), [Security](Security) diff --git a/docs/wiki/Finger-and-Gopher.md b/docs/wiki/Finger-and-Gopher.md index 333d0ae..cb149da 100644 --- a/docs/wiki/Finger-and-Gopher.md +++ b/docs/wiki/Finger-and-Gopher.md @@ -1,12 +1,12 @@ -Two small servers tell the world about the BBS: finger, who is on and who -a user is; gopher, the system's own gopherspace, with the message and -file areas the sysop opens to it. Both are off unless their section is -there. +Two small servers tell the world about the BBS. Finger shows who is on +and who a user is. Gopher serves the system's own gopherspace, with the +message and file areas the sysop opens to it. Both are off unless their +section is in the configuration. -Their usual ports are below 1024: run the BBS with +Their usual ports are below 1024, so either run the BBS with `AmbientCapabilities=CAP_NET_BIND_SERVICE` (see [bbs.service.sample](https://github.com/D-Modem/bbs/blob/HEAD/bbs.service.sample)), -or give another port. +or use another port. ## Finger @@ -36,9 +36,9 @@ Calls: 14 Posts: 5 ``` -It tells no addresses, no caller IDs and nothing of locked accounts, and -forwards nothing (`user@otherhost` is refused). `online = no` and -`users = no` turn the two halves off. +Finger never shows addresses, caller IDs or anything about locked +accounts, and it forwards nothing (`user@otherhost` is refused). +`online = no` and `users = no` turn off its two halves. ## Gopher @@ -54,17 +54,17 @@ max_per_ip = 8 ``` The root menu has *About this system* (name, location, sysop, number of -users, the message of the day), *Who's online*, and, when they are -opened, *Message areas* and *File areas*. An area lists its messages 50 -at a time (oldest first, with *More...*); a message is text; a file is -sent as it is (type 9; GIF and PNG/JPEG as images). +users and the message of the day), *Who's online*, and, if the sysop has +opened them, *Message areas* and *File areas*. An area lists its messages +50 at a time (oldest first, with *More...*). A message is served as text, +and a file as it is (type 9, or as an image for GIF, PNG and JPEG). -Gopher has no login: what it shows, it shows to anyone. So by default it -shows no message areas and no files, and `bbs check` warns when `areas` -or `files` is set. `areas` matches area names without regard to case -(`*` is all of them); an area not matched is not there, whatever is -asked. Selectors are not paths: they name records of the BBS's -database, and nothing of the server's disk is reachable. +Gopher has no login, so everything it shows, it shows to anyone. That is +why it shows no message areas and no files by default, and `bbs check` +warns when `areas` or `files` is set. `areas` matches area names in any +case (`*` matches all of them), and an area that does not match cannot be +reached, whatever is asked. Selectors are not paths: they name records in +the BBS's database, and nothing on the server's disk can be reached. ``` $ curl gopher://bbs.example.org/1/areas diff --git a/docs/wiki/HTTP-API.md b/docs/wiki/HTTP-API.md index 18da416..877d35f 100644 --- a/docs/wiki/HTTP-API.md +++ b/docs/wiki/HTTP-API.md @@ -1,6 +1,6 @@ The BBS has an HTTP API for programs and web front ends: REST for accounts, message areas, mail and files; server-sent events; and -WebSockets for chat, in JSON or protobuf. A web client is a node like +WebSockets for chat, in JSON or protobuf. A web client is a node like any other: it shows in *Who's online*, chats with terminal callers, gets node messages and can page the sysop. @@ -15,10 +15,10 @@ key_file = /etc/bbs/tls/key.pem ;metrics = 127.0.0.1:9100 ``` -| setting | default | | +| Setting | Default | What it sets | |---|---|---| | `address` | `:8443` | where it listens | -| `tls` | `yes` | TLS needs `cert_file` and `key_file`. `tls = no` is for `127.0.0.1` behind a proxy that has TLS; `bbs check` warns about it on any other address | +| `tls` | `yes` | TLS needs `cert_file` and `key_file`. `tls = no` is for `127.0.0.1` behind a proxy that has TLS; `bbs check` warns about it on any other address | | `trusted_proxies` | (none) | reverse proxies in front (addresses or CIDR ranges, by spaces or commas), believed when they say whose a request is: [below](#behind-a-proxy) | | `secure_cookies` | as `tls` | the forum's and image boards' login cookies go over HTTPS only; say `yes` when a proxy in front has the TLS | | `anonymous` | `yes` | `/system` and `/who` without a token | @@ -37,9 +37,9 @@ The OpenAPI 3.1 description is at `/api/v1/openapi.json`. ## Behind a proxy The server can sit behind a reverse proxy (nginx, Caddy, HAProxy, a load -balancer) that has the TLS. Every request then comes from the proxy's -address, so name it, and the server believes it when it says whose a -request is: +balancer) that handles TLS. Every request then comes from the proxy's +address, so list the proxy in `trusted_proxies`, and the server will +trust it to say which caller each request is from: ```ini [http] @@ -60,15 +60,16 @@ location / { } ``` -The caller is the last address in `X-Forwarded-For` (else `Forwarded`'s -`for=`, else `X-Real-IP`) that is not a trusted proxy: the ones before it -are whatever the caller sent, and are not believed. That address is then -the request's everywhere: rate limits, logins and the logs, the forum, the -web terminal's throttling, the [image boards](Image-Boards)' flood control -and bans, and the `[security]` deny lists and bans (a refused caller gets -403). Connections from a trusted proxy are not held to `max_per_ip`: they -are many callers'. Requests from anywhere else are taken as they come, and -their forwarding headers ignored. +The caller's address is the last address in `X-Forwarded-For` (or else +`Forwarded`'s `for=`, or else `X-Real-IP`) that is not a trusted proxy. +Any addresses before it are whatever the caller sent, and are not +trusted. That address is then used for the request everywhere: rate +limits, logins and the logs, the forum, the web terminal's throttling, the +[image boards](Image-Boards)' flood control and bans, and the +`[security]` deny lists and bans (a refused caller gets 403). Connections +from a trusted proxy are not held to `max_per_ip`, because they carry +many callers. Requests from anywhere else are taken as they come, and +their forwarding headers are ignored. ## Tokens and scopes @@ -79,13 +80,13 @@ Every request but `/login`, `/openapi.json` and (when `anonymous = yes`) (and `"scopes"`, to have fewer) returns `{"token": ..., "expires": ...}`. `POST /api/v1/logout` ends it. - An **API key**, for a program: `bbs token add alice -scope read,post - -expires 90 -name "my bot"` prints it once. `bbs token list [USER]` and + -expires 90 -name "my bot"` prints it once. `bbs token list [USER]` and `bbs token revoke ID` manage them, and users see and revoke their own at `/api/v1/me/tokens`. -Only a hash of a token is kept. A locked user's tokens stop working. +Only a hash of a token is kept. A locked user's tokens stop working. -| scope | allows | +| Scope | Allows | |---|---| | `read` | the account, users, message areas and messages, last read | | `post` | posting | @@ -96,10 +97,11 @@ Only a hash of a token is kept. A locked user's tokens stop working. ## REST -All under `/api/v1`, JSON in and out (but uploads and downloads). +Every endpoint is under `/api/v1` and takes and returns JSON (except +uploads and downloads). Errors are `{"error": "...", "code": "..."}`. -| | | scope | +| Request | What it does | Scope | |---|---|---| | `POST /login`, `POST /logout` | a session token; ending it | (none), any | | `GET /system` | the name, sysop, counts, features | anonymous | @@ -152,12 +154,12 @@ curl -s -H "Authorization: Bearer $TOKEN" https://bbs.example.org:8443/api/v1/ar ## Streams and nodes -The event stream and each WebSocket take a node, as a caller does -(`Via` is `web`): it counts against `max_nodes`, shows in *Who's online*, -and gets the node's events: lines said in its chat room, node messages, -pages (for sysops), new mail and notices. The node goes when the -connection does. `POST /nodes/{n}/message`, `/page` and answering a -page are done from the token's open stream (409 without one). A page +The event stream and each WebSocket take a node, just as a caller does +(`Via` is `web`). The node counts against `max_nodes`, shows in *Who's +online*, and receives the node's events: lines said in its chat room, +node messages, pages (for sysops), new mail and notices. The node ends +when the connection does. `POST /nodes/{n}/message`, `/page` and answering a +page are done from the token's open stream (409 without one). A page that reaches no sysop is 503 (`unavailable`), as the WebSocket's Page request answers it, and is not left waiting. @@ -175,7 +177,7 @@ seconds to keep it open. Two endpoints speak the same protocol, `bbs.v1`, defined in [`proto/bbs.proto`](https://github.com/D-Modem/bbs/blob/HEAD/proto/bbs.proto): -| endpoint | subprotocol | frames | +| Endpoint | Subprotocol | Frames | |---|---|---| | `/api/v1/ws` | `bbs.v1.json` | text: protobuf's JSON mapping (lowerCamelCase fields, enums by name, RFC 3339 times) | | `/api/v1/ws/proto` | `bbs.v1.proto` | binary: protobuf | @@ -183,13 +185,13 @@ Two endpoints speak the same protocol, `bbs.v1`, defined in The client sends `ClientMessage`s with an `id` of its choosing; each is answered by `ServerMessage`s with that `id`: `ok` (with `room` when the client's room changed), `error` (`code` and `message`), or what was asked -for. Events and the welcome come with id 0. +for. Events and the welcome come with id 0. A browser cannot set headers on a WebSocket, so unless the upgrade had an `Authorization` header the first message must be `auth`, within 10 -seconds. The token needs the `chat` scope. +seconds. The token needs the `chat` scope. -| request | answer | +| Request | Answer | |---|---| | `auth {token}` | `welcome {bbs, user, node, scopes}` | | `join {room}` | `lines` (the room's last lines), then `ok {room}` | @@ -218,7 +220,7 @@ A session in JSON (`>` from the client): ``` Clients of the protobuf endpoint generate code from `proto/bbs.proto` -(`protoc --go_out=...`, `--python_out=...` and so on). In JavaScript: +(`protoc --go_out=...`, `--python_out=...` and so on). In JavaScript: ```js const ws = new WebSocket("wss://bbs.example.org:8443/api/v1/ws", "bbs.v1.json"); @@ -230,7 +232,7 @@ ws.onmessage = (m) => { }; ``` -The server pings every 30 seconds. Frames are at most 16 KB; a frame +The server pings every 30 seconds. Frames are at most 16 KB; a frame that does not read is answered by an error, and the same limits as on a terminal apply (200 characters a line, 8 lines in 10 seconds). @@ -239,26 +241,26 @@ terminal apply (200 characters a line, 8 lines in 10 seconds). `/terminal` (and `/`, which goes there when the [web forum](Web-Forum) is off) is the BBS in a browser: a page with [xterm.js](https://xtermjs.org/) (5.5, MIT licensed, built into the `bbs` binary: nothing is loaded from elsewhere) whose terminal is joined -to the text BBS by a WebSocket, `/terminal/ws`. The caller is a node like +to the text BBS by a WebSocket, `/terminal/ws`. The caller is a node like a telnet caller (*Who's online* says `web terminal`) and logs in at the -BBS's own prompt, as on telnet: no token. They get ANSI color and UTF-8 +BBS's own prompt, as on telnet: no token. They get ANSI colour and UTF-8 (ANSI art's CP437 shown as Unicode), menus, messages, mail, chat, paging -and doors; not file transfers (download files by the API or FTP). Its +and doors; not file transfers (download files by the API or FTP). Its xterm.js has the image addon, so the [image boards](Image-Boards)' pictures (sixel) show in it. -| | | +| Path | What it serves | |---|---| | `GET /terminal` | the page | | `GET /terminal/xterm.js`, `addon-fit.js`, `addon-image.js`, `terminal.js`, `xterm.css`, `terminal.css`, `LICENSE.xterm` | its files | | `GET /terminal/ws?cols=&rows=` | the WebSocket, subprotocol `bbs.terminal`: binary frames, the terminal's bytes both ways; the size the page fits its window to (40-255 columns, 10-200 rows), kept for the call | -The page allows scripts only from the BBS itself, no framing, and -WebSockets only from its own host (and the `cors` origin). Connections -count against `max_per_ip` and `rate`, logins against the throttle as a -terminal's do; behind a proxy on 127.0.0.1, throttling is the proxy's to -do (the BBS sees every caller as the proxy). `terminal = no` turns the -page off. +The page allows scripts only from the BBS itself, cannot be framed, and +accepts WebSockets only from its own host (and the `cors` origin). +Connections count against `max_per_ip` and `rate`, and logins count +against the throttle as a terminal's do. Behind a proxy on 127.0.0.1 +without `trusted_proxies`, throttling is up to the proxy, because the BBS +sees every caller as the proxy. `terminal = no` turns the page off. ## Metrics @@ -273,14 +275,14 @@ text format: `bbs_nodes`, `bbs_nodes_by_via{via}`, `bbs_max_nodes`, - TLS by default; tokens never go in URLs (only in the `Authorization` header or a WebSocket's first message). -- Tokens are 32 random bytes; only their SHA-256 is stored. A wrong +- Tokens are 32 random bytes; only their SHA-256 is stored. A wrong token waits as a wrong password does, and failed logins are logged and counted like a terminal's. - Rate limits per token (per address without one), connections per address, JSON bodies at most 64 KB with unknown fields refused, uploads limited as on the BBS. - No CORS unless one origin is named; WebSockets from origins other than - it and the API's own host are refused. Responses carry `nosniff` and `no-store`. + it and the API's own host are refused. Responses carry `nosniff` and `no-store`. - What web clients say and post is cleaned as a terminal caller's is. **See also:** [Chat and paging](Chat-and-Paging), [Security](Security), [Configuration](Configuration) diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md index 620b55f..31288d3 100644 --- a/docs/wiki/Home.md +++ b/docs/wiki/Home.md @@ -1,9 +1,13 @@ -`bbs` is a bulletin board system in Go. One telnet port serves both kinds -of terminal: a TN3270 client (x3270, c3270, wc3270, Vista, PCOMM) gets -full 3270 screens with PF keys, through -[go3270](https://github.com/D-Modem/go3270); any other telnet client -gets a text BBS with ANSI color where the terminal has it. Modem callers -come in through the D-Modem suite: [app_dmodem](https://github.com/D-Modem/D-Modem) +bbs is a bulletin board system in Go for telnet, SSH, TN3270 and modem +callers, and part of the [D-Modem suite](https://github.com/D-Modem/D-Modem). +This is its documentation: how to set it up, how to run it, and how to use +everything it does. + +One telnet port serves every kind of terminal. A TN3270 client (x3270, +c3270, wc3270, Vista, PCOMM) gets full 3270 screens with PF keys, through +[go3270](https://github.com/D-Modem/go3270). Any other client gets a text +BBS with ANSI colour where the terminal has it. Modem callers come in +through the D-Modem suite: [app_dmodem](https://github.com/D-Modem/D-Modem) straight from Asterisk, or [modemmenu](https://github.com/D-Modem/menu) after its login. @@ -24,107 +28,120 @@ Main menu [G] Goodbye ``` -The same caller on a 3270: +## Start here -``` - D-Modem BBS Main menu Node 1 +| If you want to | Read | +|---|---| +| Try it out in a few minutes | [Building](Building), then [Running](Running) | +| Set up a board for real | [Running](Running), [Configuration](Configuration), [Databases](Databases), [Backups](Backups) | +| Look after a running board | [Administration](Administration), [Sysop tools](Sysop-Tools), [Access levels](Access-Levels) | +| Make it look like your own | [Customization](Customization), [Scripting](Scripting) | +| Take calls by modem | [Modem callers](Modem-Callers) | +| Join FidoNet, QWK networks or Usenet | [FidoNet](FidoNet), [Offline mail](Offline-Mail#qwk-networks), [Newsgroups and NNTP](Newsgroups-and-NNTP) | +| Put the board on the web | [Web forum](Web-Forum), [Image boards](Image-Boards), [HTTP API](HTTP-API) | +| Work on the code | [Development](Development) | - Welcome, alice. +Every setting is listed in the [Configuration reference](Configuration-Reference), +which is generated from `bbs.conf.sample`. - ┌───────────────────────────────────────────┐ - │ M Message areas │ - │ E E-mail (1 new) │ - │ W Who's online │ - │ U User list │ - │ P Your profile │ - │ I System info │ - │ C Chat │ - │ S Page the sysop │ - │ T Your terminal │ - │ G Goodbye │ - └───────────────────────────────────────────┘ +## What it does - Option ===> +**For callers** - Enter=Select PF3=Back -``` +- [Message areas](Message-Areas) with new scans, searching, threads, votes + and polls, written in a [full-screen editor](Writing-Messages) +- Private mail, chat rooms, node messages and [paging the sysop](Chat-and-Paging) +- Who's online (with how each caller came in), the user list, the last + callers, feedback to the sysop, and a profile of their own +- [File areas](Files-and-FTP) with X/Y/ZMODEM, Kermit and IND$FILE + [transfers](File-Transfers), and an FTP (FTPS) server +- [Offline mail](Offline-Mail): QWK packets of new messages, and REP packets + of replies +- [Doors](Doors): DOS door games in dosemu2, Linux programs, and door + networks such as BBSLink and DoorParty -What there is: +**Terminals** -- [message areas](Message-Areas): a new scan of the areas you choose, messages to you, finding - messages by their words, read by number, post, reply (quoting - from a window in the [full-screen editor](Writing-Messages)), - reply by mail; areas only the sysop posts in; authors and the sysop - delete messages -- private mail: inbox, read, reply, delete -- [offline mail](Offline-Mail): QWK packets of new messages and mail, REP packets of replies - brought back (by a transfer protocol, IND$FILE, FTP or the API); QWK networks as a hub or a node -- [SSH](SSH): logging in by password or key, the text BBS encrypted -- [Commodore 64s and RIPscrip terminals](PETSCII-and-RIP): PETSCII at 40 columns; menus as RIP buttons -- [VT terminals identified](Terminal-Identification) (answerback, DA1, DA2, XTVERSION, VT52): DEC line drawing and Latin-1, bold on monochrome VTs, VT52 escapes -- who's online (and how each caller came: ssh, telnet, tn3270, rlogin, modem - with its rate), the user list, system info -- the last callers (*L*), feedback to the sysop (*K*, which any caller may - send), the user list with each user's details and a line about themselves -- your profile: where you call from, a line about yourself, expert menus - (the prompt alone, `?` for the rest), your password, SSH keys, ANSI and UTF-8 -- [file areas](Files-and-FTP): files listed with their size, uploader, downloads and - SHA-256, moved by XMODEM, YMODEM, ZMODEM or Kermit on the text BBS, by - IND$FILE on a 3270 ([file transfers](File-Transfers)), or by FTP (FTPS); deleted by their uploader or the - sysop -- [newsgroups](Newsgroups-and-NNTP): message areas given a newsgroup name are served by NNTP to - newsreaders and exchanged with other news servers (INN and the like) -- [FidoNet](FidoNet) (or any FTN network): message areas that are echoes, netmail - as private mail, file echoes (TIC), AreaFix and FileFix, nodelists, and a - binkp mailer to exchange ZIP, ARC, ARJ or LHA bundles with links -- [doors](Doors): DOS door games in dosemu2 (in Docker), with a FOSSIL on COM1 - and the usual drop files, or any Linux program, for text callers; doors - elsewhere by telnet or RLogin, and the door networks BBSLink and DoorParty -- [chat](Chat-and-Paging): rooms, messages to a node, paging the sysop; the rooms are - [IRC](IRC) channels too, for IRC clients, and [MRC](MRC)'s rooms join the - BBSes' Multi Relay Chat -- [finger and gopher](Finger-and-Gopher): who is on, and chosen areas in gopherspace -- [a web forum](Web-Forum): the message areas as a bulletin board in the browser, in the manner of Invision Power Board 3, or of IPB 5, 4, 2 or 1, Ikonboard, vBulletin 6 back to 2 or Lite, XenForo 2.3 back to 1, MyBB 1.8 back to 1.2, PunBB 1.4 and 1.2, FluxBB 1.5, YaBB 2.5 back to 1, Simple Machines Forum 3.0 back to 1, or phpBB 3.3 back to 1 (themes) -- [image boards](Image-Boards): anonymous boards of images and replies at /chan/, in the manner of kusaba x and 4chan: bumping, sage, tripcodes (2channel's, and secure ones), greentext and >>quotes, a catalog, oekaki boards to draw on with stroke replay, staff's bans and reports, Yotsuba, Yotsuba B, Futaba, Burichan, Photon and Tomorrow styles, and 4chan's JSON; on the terminals too, with the pictures in sixel, kitty's or iTerm2's graphics, or coloured blocks -- [a web terminal](HTTP-API#the-web-terminal): the BBS in a browser (xterm.js, built in) -- [an HTTP API](HTTP-API): REST, server-sent events, and WebSockets (JSON or protobuf) where web clients chat with terminal callers; Prometheus metrics -- [customization](Customization): ANSI art and 3270 screens, menus of the sysop's, @-codes, the prompts' words -- [access levels](Access-Levels): levels and flags, areas, doors and menus that require them, time and download limits a day, new users validated by the sysop -- new users sign themselves up (or not: `new_users = no`) -- [SQLite, PostgreSQL, MySQL or MariaDB](Databases), and `bbs db copy` between them +- [TN3270](TN3270) screens with PF keys, and 3270 graphics where the + emulator has them +- [SSH](SSH), with passwords or keys +- [Commodore 64s in PETSCII and RIPscrip terminals](PETSCII-and-RIP) +- [VT terminals](Terminal-Identification), with DEC line drawing, monochrome + and VT52 support +- [Sixel graphics](Sixel-Graphics) for the logo and pictures -## The pages +**Networks** -| | | +- [FidoNet](FidoNet) and other FTN networks: echomail, netmail, file + echoes, AreaFix and a built-in binkp mailer +- [Newsgroups](Newsgroups-and-NNTP) served by NNTP and exchanged with other + news servers +- [IRC](IRC), where the chat rooms are channels, and [MRC](MRC), the chat + network shared with other BBSes +- [Finger and gopher](Finger-and-Gopher) + +**On the web** + +- [A web forum](Web-Forum) of the message areas, in the style of classic + forum software (Invision Power Board, vBulletin, phpBB and many more) +- [Image boards](Image-Boards) in the style of kusaba x and 4chan, also + shown on the terminals +- [A web terminal](HTTP-API#the-web-terminal) and an [HTTP API](HTTP-API) + with REST, server-sent events and WebSockets + +**For the sysop** + +- New users who sign themselves up (or not, with `new_users = no`), and + [access levels](Access-Levels) with flags, daily limits and validation +- [Customization](Customization) with ANSI art, 3270 screens, menus and + prompts, and [scripting](Scripting) in JavaScript +- [SQLite, PostgreSQL, MySQL or MariaDB](Databases), with `bbs db copy` + between them +- [Backups](Backups) while callers are on, and [security](Security) + settings to keep callers out + +## All pages + +| Page | What it covers | |---|---| | [Building](Building) | Go, the go3270 fork, `make` | -| [Running](Running) | first start, systemd, the defaults | +| [Running](Running) | the first start, systemd, running as its own user | | [Administration](Administration) | the `bbs` command: users, areas, files, mail exchange | -| [Databases](Databases) | SQLite, PostgreSQL, MySQL, MariaDB; moving between them | -| [Configuration](Configuration) | `bbs.conf`: its sections, listeners | -| [Access levels](Access-Levels) | levels, flags, what areas, doors and menus require, daily limits, validation | +| [Sysop tools](Sysop-Tools) | the sysop's menu inside the BBS, and scheduled events | +| [Configuration](Configuration) | `bbs.conf`: its sections, listeners and configuration screens | +| [Configuration reference](Configuration-Reference) | every section and key | +| [Databases](Databases) | SQLite, PostgreSQL, MySQL and MariaDB, and moving between them | +| [Backups](Backups) | making backups, and restoring them | | [Customization](Customization) | screens (ANSI art, 3270), menus, prompts | | [Scripting](Scripting) | the sysop's own screens in JavaScript, on every terminal | +| [Access levels](Access-Levels) | levels, flags, requirements, daily limits, validation | | [SSH](SSH) | the SSH listener, keys, host keys | -| [Modem callers](Modem-Callers) | app_dmodem and modemmenu | +| [Modem callers](Modem-Callers) | app_dmodem and modemmenu, and where callers are | | [TN3270](TN3270) | 3270 terminals, PF keys, 3270 graphics | -| [Sixel graphics](Sixel-Graphics) | the logo on sixel terminals | +| [Sixel graphics](Sixel-Graphics) | the logo and pictures on sixel terminals | | [PETSCII and RIP](PETSCII-and-RIP) | Commodore 64s and 128s; RIPscrip graphics and buttons | -| [Terminal identification](Terminal-Identification) | VT terminals asked what they are: DEC graphics, monochrome, VT52 | +| [Terminal identification](Terminal-Identification) | how VT terminals are recognised: DEC graphics, monochrome, VT52 | +| [Message areas](Message-Areas) | reading, new scans, searching, votes and polls | +| [Writing messages](Writing-Messages) | the full-screen editor, the line editor, the 3270 editor | +| [Offline mail](Offline-Mail) | QWK packets, REP replies, QWK networks | | [Files and FTP](Files-and-FTP) | file areas, the FTP (FTPS) server | | [File transfers](File-Transfers) | X/Y/ZMODEM, Kermit, IND$FILE | -| [Offline mail](Offline-Mail) | QWK packets, REP replies, QWK networks | -| [Doors](Doors) | DOS doors in dosemu2 (Docker), Linux doors | +| [Doors](Doors) | DOS doors in dosemu2 (Docker), Linux doors, doors on other systems | | [Newsgroups and NNTP](Newsgroups-and-NNTP) | the NNTP server, news peers | | [FidoNet](FidoNet) | echomail, netmail, binkp, file echoes, AreaFix, nodelists | | [Chat and paging](Chat-and-Paging) | chat rooms, node messages, paging the sysop | -| [IRC](IRC) | the IRC server: the chat rooms as channels | +| [IRC](IRC) | the IRC server, with the chat rooms as channels | | [MRC](MRC) | Multi Relay Chat: chat rooms shared with other BBSes | | [Finger and gopher](Finger-and-Gopher) | who is on, and the BBS in gopherspace | | [Web forum](Web-Forum) | the message areas as a web forum | -| [Image boards](Image-Boards) | anonymous image boards, as kusaba x and 4chan | +| [Image boards](Image-Boards) | anonymous image boards, in the style of kusaba x and 4chan | | [HTTP API](HTTP-API) | REST, events, WebSockets in JSON and protobuf, tokens, metrics | | [Security](Security) | what is guarded, and how | -| [Development](Development) | the source's layout, the tests | +| [Development](Development) | the source's layout, the shared screens, the tests | -Future work is in [TODO.md](https://github.com/D-Modem/bbs/blob/HEAD/TODO.md). +## More + +- The wiki is also a website: [d-modem.github.io/bbs](https://d-modem.github.io/bbs/). +- Planned work is in [TODO.md](https://github.com/D-Modem/bbs/blob/HEAD/TODO.md). +- The other parts of the suite are listed in the + [README](https://github.com/D-Modem/bbs#the-d-modem-suite). diff --git a/docs/wiki/IRC.md b/docs/wiki/IRC.md index 6236b47..61a992e 100644 --- a/docs/wiki/IRC.md +++ b/docs/wiki/IRC.md @@ -1,5 +1,3 @@ -# IRC - The BBS has an IRC server, and its channels are the [chat rooms](Chat-and-Paging). Someone in HexChat, irssi, WeeChat or any other IRC client talks with callers on telnet, SSH, 3270s, the web terminal and the API. IRC is @@ -13,7 +11,7 @@ tls_cert = /etc/bbs/tls.crt tls_key = /etc/bbs/tls.key ``` -| setting | default | | +| Setting | Default | What it sets | |---|---|---| | `address` | `:6667` | plain IRC (`none`: TLS only) | | `tls_address` | (none) | IRC over TLS, with `tls_cert` and `tls_key` | @@ -52,7 +50,7 @@ send it node messages, and the sysop can throw it off like any caller. (letters, digits and `-`, up to 20) makes a room. One client can be in up to 20 at once. Joining shows the room's last 20 lines. -| IRC | the BBS | +| On IRC | On the BBS | |---|---| | `PRIVMSG #room :text` | a line in the room | | `/me waves` (CTCP ACTION) | `* alice waves` | @@ -64,7 +62,7 @@ up to 20 at once. Joining shows the room's last 20 lines. Sysops show as channel operators (`@`), but there's little to operate: rooms have no modes, kicks or bans, and only [permanent -rooms](#permanent-rooms) have topics. Colors and other formatting are +rooms](#permanent-rooms) have topics. Colours and other formatting are stripped from lines going into the rooms. A sysop is told of a page by a `NOTICE`. Joining `#sysop-N` answers the @@ -76,7 +74,7 @@ of each line, the history replayed on join included), `echo-message`, ## Permanent rooms -A room goes when its last caller leaves, unless the sysop makes it +A room closes when its last caller leaves, unless the sysop makes it permanent. BBSServ holds a permanent room open, empty or not and across restarts. It sits in the channel as an operator (`@BBSServ` in `NAMES` and `WHO`), and `LIST` and BBSServ's `ROOMS` show the room with its @@ -84,7 +82,7 @@ topic even when no one is in it. Permanent rooms are the BBS's own: on the text BBS and 3270s too, `/rooms` lists them with their topics, and coming in shows the topic. -| | | +| Command | What it does | |---|---| | `/msg BBSServ ROOMS` | the permanent rooms (anyone) | | `/msg BBSServ ROOM ADD #room [topic]` | make a room permanent (the sysop) | @@ -94,7 +92,7 @@ coming in shows the topic. | `/topic [text]` | in the BBS's chat: the room's topic; the sysop sets it | | `bbs room list`, `add`, `topic`, `del` | the same from the shell | -A topic set is told to those in the room: on IRC as a `TOPIC` from +When a topic is set, everyone in the room is told: on IRC as a `TOPIC` from BBSServ, on the BBS as a line ("sysop set the topic: ..."). Changes made with the `bbs` command reach a running BBS at its next start; those made through BBSServ apply at once. @@ -107,7 +105,7 @@ account of whoever asks. Talk to it with `/msg BBSServ COMMAND`, or with its own command, `/BS COMMAND` (`/BBSSERV` also works). Its answers come as notices. -| command | | +| Command | What it does | |---|---| | `HELP [command]` | the commands, or how to use one | | `INFO` | your account: level, where you call from, alias, signature, settings, unread mail, keys, tokens, new scan | @@ -142,3 +140,5 @@ The IRC protocol's parts come from [ergo](https://github.com/ergochat/ergo): NickServ and ChanServ run. Its tests also use irc-go's client (`ircevent`). + +**See also:** [Chat and paging](Chat-and-Paging), [MRC](MRC), [Security](Security) diff --git a/docs/wiki/Image-Boards.md b/docs/wiki/Image-Boards.md index 81e9c38..d939bf3 100644 --- a/docs/wiki/Image-Boards.md +++ b/docs/wiki/Image-Boards.md @@ -1,5 +1,3 @@ -# Image boards - The HTTP API's server also serves image boards, at `/chan/`, in the manner of kusaba x and of 4chan that it followed (and Futaba before both): boards by directory (`/chan/b/`, `/chan/g/`), threads that start with an @@ -47,7 +45,7 @@ address = :8443 ;archive_days = 3 ; days a pruned thread stays in its board's archive (0: always) ``` -| setting | default | | +| Setting | Default | What it sets | |---|---|---| | `chan` (in `[http]`) | `yes` | the image boards at `/chan/` | | `dir` | `chan` | where images and thumbnails are kept, and the boards' secret (`dir/secret`, made the first time: keep it, or secure tripcodes change) | @@ -80,7 +78,7 @@ account where there is none: a modem's), limits and pruning. A post's picture is shown above it, as well as the terminal can: -| terminal | how | +| Terminal | How | |---|---| | kitty, Ghostty | kitty's graphics protocol (by what they say they are) | | sixel: xterm (`-ti vt340`), foot, mlterm, WezTerm, Windows Terminal, iTerm2, SyncTERM, the [web terminal](HTTP-API#the-web-terminal) | sixel | @@ -104,7 +102,7 @@ each browser, which keeps it in a cookie). A thread starts with an image (unless the board is `text_only`); replies need a comment, an image, or both. -| typed | | +| Typed | Result | |---|---| | `Name#password` | a tripcode: `Name !WokonZwxw2`. The same as 2channel's and 4chan's: `#tea` is `!WokonZwxw2` here too | | `Name##password` | a secure tripcode, `!!...`, made with this site's secret: it cannot be found by trying passwords elsewhere | @@ -256,7 +254,7 @@ bbs chan ban list bbs chan ban del ID ``` -| board setting | default | | +| Board setting | Default | What it sets | |---|---|---| | `title`, `description` | | as the board's banner shows them | | `pages`, `per_page` | 10, 10 | threads kept: pages of threads | @@ -293,7 +291,7 @@ bbs chan board set po files pdf What a file is is found from its bytes, never its name, and each is read before it is kept: -| | taken | refused | +| Format | Accepted | Refused | |---|---|---| | WebM | VP8, VP9 or AV1 video, Vorbis or Opus sound | a Matroska file that is not WebM (browsers do not play it), other codecs, other tracks, two videos in one | | MP4 | H.264, AV1 or VP9 video, AAC or Opus sound | HEVC and other codecs browsers do not all play; one still being written (no movie header) | @@ -333,7 +331,7 @@ bbs chan board set f sound yes ruffle = /opt/bbs/ruffle ; the directory with ruffle.js (some 30 MB, not in the BBS) ``` -| | read for | | +| Format | Read for | Notes | |---|---|---| | SWF (`FWS`, `CWS`, `ZWS`) | its stage's size, frames and rate, sounds | compressed ones are walked as they unpack, nothing kept (a small file that unpacks to much is refused at no cost); an LZMA one (`ZWS`) Ruffle unpacks, so it is taken as 550x400 with sound | | FLV | its `onMetaData` (size, length), its tags (sound, the video's codec: Sorenson H.263, Screen, VP6, VP6 alpha, H.264) | without metadata its length is its last tag's time, its size Flash's 320x240 | @@ -408,7 +406,7 @@ sum of them. Callers choose one at the top of each page (kept in a cookie): -| style | | +| Style | What it looks like | |---|---| | `yotsuba` | 4chan's, on boards not worksafe: cream and maroon | | `yotsuba-b` | 4chan's worksafe blue | @@ -422,7 +420,7 @@ Callers choose one at the top of each page (kept in a cookie): The boards can be read as JSON, in the shapes of 4chan's read-only API (github.com/4chan/4chan-API), so that its readers read these boards too: -| | | +| File | What it holds | |---|---| | `/chan/boards.json` | the boards and how they are run | | `/chan/b/threads.json` | each page's threads, when each changed, their replies | diff --git a/docs/wiki/MRC.md b/docs/wiki/MRC.md index 1a9fe85..e8678c0 100644 --- a/docs/wiki/MRC.md +++ b/docs/wiki/MRC.md @@ -1,5 +1,3 @@ -# MRC (Multi Relay Chat) - [Multi Relay Chat](https://wiki.mysticbbs.com/doku.php?id=mrc) is a chat network of BBSes: Mystic, Synchronet, ENiGMA½ and others share its rooms. The BBS joins it as its own MRC connector, with one connection to the MRC @@ -18,12 +16,12 @@ web = https://bbs.example.org/ telnet = bbs.example.org:23 ``` -| setting | default | | +| Setting | Default | What it sets | |---|---|---| | `address` | `mrc.bottomlessabyss.net:5000` | the MRC server (5001 with TLS) | | `tls` | `no` | TLS to it | | `prefix` | `mrc-` | what begins MRC's rooms here | -| `system_name` | the BBS's name | the BBS as MRC shows it (Mystic's `\|NN` colors allowed) | +| `system_name` | the BBS's name | the BBS as MRC shows it (Mystic's `\|NN` colour codes allowed) | | `web`, `telnet`, `ssh`, `sysop`, `description` | (the sysop's name, the BBS's) | what MRC's `INFO` tells of the BBS | | `require` | (anyone who may chat) | who may go into MRC's rooms ([access levels](Access-Levels)) | @@ -34,7 +32,7 @@ telnet = bbs.example.org:23 leave when they go. - Lines said there go to MRC as ` text`, and `/me` as an action. Lines from other systems show as `carol@Far_BBS: text` (on IRC, from - `carol_Far_BBS!mrc@far_bbs`). MRC's colors are taken out. + `carol_Far_BBS!mrc@far_bbs`). MRC's colour codes are removed. - `!COMMAND` is a command for the MRC server, not a line for the room: `!motd`, `!list` (its rooms), `!chatters`, `!bbses`, `!info N` and the rest (the server says which it does not know). Its answers come to whoever asked. `!!text` @@ -53,7 +51,7 @@ that it is listed even when no one here is in it. ## The protocol -As Synchronet's `mrc-connector.js` and `mrc-session.js` speak it: +The BBS speaks MRC's protocol as Synchronet's `mrc-connector.js` and `mrc-session.js` do: - the handshake `SYSTEM~BBSSEC/os_arch/1.3.5`, then the server's hello; - lines of `FromUser~FromSite~FromRoom~ToUser~MsgExt~ToRoom~Body~`; @@ -61,3 +59,5 @@ As Synchronet's `mrc-connector.js` and `mrc-session.js` speak it: - `IMALIVE` in answer to the server's `PING`; - `IAMHERE` for each user, `NEWROOM:old:new` to move, `LOGOFF` to go; - names without spaces (underscores), at most 30 characters. + +**See also:** [Chat and paging](Chat-and-Paging), [IRC](IRC) diff --git a/docs/wiki/Message-Areas.md b/docs/wiki/Message-Areas.md index 15d59da..e9370ab 100644 --- a/docs/wiki/Message-Areas.md +++ b/docs/wiki/Message-Areas.md @@ -1,5 +1,6 @@ -What a caller does in the message areas, on any terminal: the letters -are a text terminal's, the PF keys a 3270's. +This page describes what callers can do in the message areas, on any +terminal. The letters are the keys on a text terminal, and the PF keys are +a 3270's. ## The areas @@ -12,7 +13,7 @@ Message areas Area number, [N]ew scan, [T]o you, [F]ind, [S]can setup, [Q]uit: ``` -| | key | PF | | +| Action | Key | PF | What it does | |---|---|---|---| | an area | its number | `S` by it | its messages, a page at a time | | new scan | `N` | PF5 | reads the new messages of each area in the scan, area after area | @@ -23,25 +24,25 @@ Area number, [N]ew scan, [T]o you, [F]ind, [S]can setup, [Q]uit: ## Scan setup -Every area is in the new scan until it is taken out: the area's number -(or `S` by it on a 3270) switches it, `A` (PF5) puts all in, `X` (PF6) -takes all out. Areas marked `*` are in. The choice is kept with the -account. +Every area is in the new scan until the caller takes it out. Typing an +area's number (or `S` beside it on a 3270) switches it in or out, `A` +(PF5) puts every area in, and `X` (PF6) takes every area out. Areas marked +`*` are in the scan. The choice is kept with the account. -Areas a sysop put in groups are listed by group (those in none first), -with a Group column. +If the sysop has put areas in groups, they are listed by group (areas in +no group first), with a Group column. ## In an area -The messages a page at a time (Enter for more on a text terminal, -PF7/PF8 on a 3270); `*` marks those not read yet. A message's number -reads it, even one not on the page. `R` (PF5) reads from the first new -one, `P` (PF6) posts, `L` (PF9) posts a poll: a question and 2 to 10 -answers, parted by `|`. +An area lists its messages a page at a time (Enter for more on a text +terminal, PF7/PF8 on a 3270), with `*` marking those not yet read. Typing +a message's number reads it, even if it is not on the page. `R` (PF5) +reads from the first new message, `P` (PF6) posts, and `L` (PF9) posts a +poll: a question and 2 to 10 answers, separated by `|`. ## Reading -| | key | PF | +| Action | Key | PF | |---|---|---| | next | `N`, Enter, space | PF11, Enter | | previous | `P` | PF10 | @@ -54,21 +55,23 @@ answers, parted by `|`. | answer a poll (again: your answer changes) | `A` | PF12 | | back | `Q` | PF3 | -A message's votes show by its number (`+3 -1`), a poll's answers under -its text with each one's share, yours marked `*`. +A message's votes appear beside its number (`+3 -1`). A poll's answers +appear under its text with each answer's share, and your answer is marked +`*`. ## Aliases and signatures -On the profile, `I` sets an alias and `G` a signature (up to three -lines). In an area whose sysop allows aliases, posting asks whether to -post under the alias: the message is from the alias (in newsgroups and -echoes too), while the sysop still knows whose it is. An alias is -checked like a new user's name and may not be anyone's name or alias. -The signature goes under every post and mail written on the BBS. +In the profile, `I` sets an alias and `G` sets a signature (up to three +lines). In an area where the sysop allows aliases, posting asks whether to +post under the alias. The message is then from the alias (in newsgroups +and echoes too), although the sysop can still see who wrote it. An alias +is checked like a new user's name, and cannot be anyone else's name or +alias. The signature goes under every post and mail written on the BBS. -Reading in an area marks it read up to there. Reading what *To you* or -*Find* found does not: the new scan still finds those messages new. +Reading in an area marks the area read up to that point. Reading messages +found by *To you* or *Find* does not, so the new scan still shows those +messages as new. -Writing: [Writing messages](Writing-Messages). +For how to write messages, see [Writing messages](Writing-Messages). **See also:** [Administration](Administration#message-areas), [TN3270](TN3270) diff --git a/docs/wiki/Modem-Callers.md b/docs/wiki/Modem-Callers.md index 9cbfb6f..5627040 100644 --- a/docs/wiki/Modem-Callers.md +++ b/docs/wiki/Modem-Callers.md @@ -1,9 +1,15 @@ -Modem callers reach the BBS through the D-Modem suite: [app_dmodem](https://github.com/D-Modem/D-Modem/blob/main/docs/asterisk.md), D-Modem's Asterisk application, straight from the call, or [modemmenu](https://github.com/D-Modem/menu) after its login. +Modem callers reach the BBS through the D-Modem suite, in one of two ways: +straight from the call through +[app_dmodem](https://github.com/D-Modem/D-Modem/blob/main/docs/asterisk.md), +D-Modem's Asterisk application, or through +[modemmenu](https://github.com/D-Modem/menu) after its login. This page +covers both, how to give callers the same password everywhere, and how +the BBS works out where callers are. ## Straight from app_dmodem -app_dmodem's `[bbs]` profile hands each call to a TCP server, raw. The -`[listen modem]` of the sample is that server: +app_dmodem's `[bbs]` profile hands each call to a TCP server as raw +bytes. The sample's `[listen modem]` is that server: ``` ; dmodem.conf @@ -18,24 +24,26 @@ type = raw address = 127.0.0.1:2323 ``` -The caller logs in to the BBS (or signs up). Over a raw line the BBS -asks the terminal for its cursor position: an ANSI terminal (SyncTERM, -Telix, Qmodem, HyperTerminal in ANSI mode) answers, and the answer gives -its size too; anything else gets plain text. Text is 7-bit ASCII unless -the caller turns UTF-8 on. An app_dmodem that sends a session header -(`header = yes`) gives the BBS the call's rate and caller ID: set `header -= yes` on the listener too. +The caller then logs in to the BBS, or signs up. Over a raw line the BBS +asks the terminal for its cursor position. An ANSI terminal (SyncTERM, +Telix, Qmodem, HyperTerminal in ANSI mode) answers, and the answer also +tells the BBS the screen size; any other terminal gets plain text. Text is +7-bit ASCII unless the caller turns UTF-8 on. If app_dmodem sends a session +header (`header = yes`), the BBS learns the call's rate and caller ID; set +`header = yes` on the listener too. ## Behind modemmenu -modemmenu logs the caller in first and offers the BBS in its menu. Three -ways to hand the caller over, from the simplest to the closest: +modemmenu logs the caller in first and offers the BBS as an item in its +menu. There are three ways for it to hand the caller over, from the +simplest to the most closely linked. -**rlogin**, modemmenu's default for a BBS: it sends the caller's password -as the rlogin client user and the name as the server user (Synchronet's -convention). The BBS checks them against its own accounts; if they are -not right there (a user with no account here, or another password) the -caller is asked to log in, with the name typed in already. +**rlogin** is modemmenu's default for a BBS. It sends the caller's +password as the rlogin client user and their name as the server user +(Synchronet's convention). The BBS checks them against its own accounts. +If they do not match (the user has no account on the BBS, or a different +password), the caller is asked to log in, with their name already filled +in. ``` ; modemmenu.conf @@ -53,12 +61,12 @@ type = rlogin address = 127.0.0.1:2513 ``` -**A unix socket with the session header**: modemmenu has checked the -caller, and the BBS believes it (`trust_user`). Callers need no account -of their own here first: `create_users = yes` makes one for each new name -(it has no password of its own here: it logs in this way, or by -modemmenu's password, below). The header's rate, -caller ID and number show in the log and who's online. +**A unix socket with the session header** lets the BBS trust modemmenu's +login (`trust_user`). Callers do not need an account on the BBS first: +`create_users = yes` creates one for each new name. Such an account has +no BBS password of its own; it logs in this way, or with the modemmenu +password (described below). The rate, caller ID and number from the +header appear in the log and in Who's online. ``` ; modemmenu.conf @@ -82,23 +90,23 @@ socket_mode = 0660 socket_group = asterisk ``` -`trust_user` believes whoever can connect: keep the socket to modemmenu's -user (Asterisk's group, mode 0660, or 0600 and the same user). `bbs -check` warns about a trusting socket or port that others can reach. +`trust_user` trusts whoever can connect, so make sure only modemmenu's +user can reach the socket (Asterisk's group with mode 0660, or mode 0600 +and the same user). `bbs check` warns about a trusting socket or port that +others can reach. -**telnet** works too (`mode = telnet`, `port = 2300`): modemmenu's telnet +**telnet** works too (`mode = telnet`, `port = 2300`). modemmenu's telnet client says it is an `ANSI` terminal, and the caller logs in again. -**See also:** [Configuration](Configuration), [File transfers](File-Transfers) - ## The same password for telnet, SSH and the web -Accounts modemmenu logs in have no password here. With modemmenu's auth -socket, the same people log in to the BBS any other way (telnet, SSH, -TN3270, the web forum and terminal, the API, FTP, NNTP, IRC) with their -modemmenu password: the BBS asks modemmenu, and modemmenu asks its -backends (its users file, LDAP, SQL, the system's accounts by PAM) as at -its own login prompt. Nothing of the password is kept here. +Accounts that modemmenu logs in have no password on the BBS. With +modemmenu's auth socket, the same people can log in to the BBS any other +way (telnet, SSH, TN3270, the web forum and terminal, the API, FTP, NNTP, +IRC) with their modemmenu password. The BBS asks modemmenu, and modemmenu +asks its own backends (its users file, LDAP, SQL, or the system's accounts +through PAM), just as it does at its own login prompt. The BBS keeps +nothing of the password. ``` ; modemmenu.conf: answered by modemmenu -serve, or modemmenu -authd alone @@ -113,39 +121,46 @@ allow_users = bbs auth_socket = /run/modemmenu/auth.sock ``` -| `[modemmenu]` key | default | | +| `[modemmenu]` key | Default | What it sets | |---|---|---| | `auth_socket` | none | modemmenu's `[authd] listen` | | `create_users` | `yes` | a user modemmenu knows and the BBS does not gets an account at their first login (any way in), as `create_users` does for a listener: a name the BBS takes, not refused by `name_deny_file` | | `timeout` | `15` | seconds for modemmenu's answer (a wrong password comes after its `fail_delay`) | -Only accounts modemmenu made (external ones, with no password here) are -asked of it: an account with a password of its own here keeps it, and -modemmenu's password does not open it. A wrong password counts as a failed -login here (throttling, the hack log) as any other; modemmenu not -answering is said to the caller as trouble, and not counted against them. -Changing such a password is modemmenu's (its backend's), not the BBS's. +The BBS asks modemmenu only about accounts modemmenu created (external +accounts with no BBS password). An account with its own BBS password keeps +it, and the modemmenu password does not open it. A wrong password counts +as a failed login like any other (throttling, the hack log). If modemmenu +does not answer, the caller is told there is a problem, and it is not +counted against them. These passwords are changed in modemmenu (or its +backend), not in the BBS. -Without typing it at all: signed in on the BBS, *Your profile*'s sign-in -code (`C`) signs in to the web forum once, for five minutes -([Web forum](Web-Forum#sign-in-codes)); and SSH keys added there -(`K`) log in by SSH with no password. +Callers can also sign in without typing a password. While signed in on +the BBS, the sign-in code in *Your profile* (`C`) signs in to the web +forum once, within five minutes (see +[Web forum](Web-Forum#sign-in-codes)), and SSH keys added there (`K`) log +in by SSH with no password. ## Where callers are -`[general] phone_country` reads modem callers' numbers by every -country's numbering plan: the country (the shared calling codes told -apart: Jersey from Britain, Kazakhstan from Russia, Jamaica from the US), -what the number is (fixed line, mobile, toll-free, premium rate, VoIP...) -and the place it is in, to the exchange where the plan says (*Jersey -City, NJ*, *Ontario*, *London*, *Berlin*, *Tokyo*: 151 calling codes have -places). International numbers (`+44 20...`) are read whatever it is; -national ones, as exchanges mostly send them, are read as that country -dials, its trunk and international prefixes taken off (`4155550123`, -`1 415 555 0123` and `011 44...` with `US`; `020 7123 4567` and -`00 1 415...` with `GB`; `8 495 ...` and `810 ...` with `RU`). A local -number with no area code gives the country alone; withheld numbers -nothing. +With `[general] phone_country` set, the BBS reads modem callers' numbers +using each country's numbering plan. From a number it learns: + +- the country, even where countries share a calling code (Jersey and + Britain, Kazakhstan and Russia, Jamaica and the US); +- what kind of number it is (fixed line, mobile, toll-free, premium rate, + VoIP and so on); +- the place it is in, down to the exchange where the plan says (*Jersey + City, NJ*, *Ontario*, *London*, *Berlin*, *Tokyo*; 151 calling codes have + places). + +International numbers (`+44 20...`) are read whatever `phone_country` is. +National numbers, which is how exchanges mostly send them, are read the +way that country dials, with its trunk and international prefixes removed +(`4155550123`, `1 415 555 0123` and `011 44...` with `US`; `020 7123 4567` +and `00 1 415...` with `GB`; `8 495 ...` and `810 ...` with `RU`). A local +number without an area code gives only the country, and a withheld number +gives nothing. ```ini [general] @@ -153,28 +168,31 @@ phone_country = US ;geoip = /var/lib/bbs/dbip-country-lite.mmdb ; for callers by address ``` -The log says it with the call, the number as it is written abroad: +The log records this with each call, writing the number as it is written +from abroad: ``` node 3: modem on [listen modem]: rate 33600/31200, from 4155550123 (+1 415-555-0123), in San Francisco, CA, United States node 4: modem on [listen modem]: rate 26400/26400, from 08005550123 (+44 800 555 0123), in United Kingdom (toll-free) ``` -Who's online shows callers' countries (by caller ID, else by address with -`[general] geoip`); the sysop's node list (spy, chat, kick) their number -(and whether it is a mobile's) and place too. Posts keep the poster's -country for the [web forum's flags](Web-Forum#flags). +Who's online shows each caller's country (from the caller ID, or else +from their address with `[general] geoip`). The sysop's node list (spy, +chat, kick) also shows their number, whether it is a mobile, and the +place. Posts keep the poster's country for the +[web forum's flags](Web-Forum#flags). ### By address: countries, regions and cities Callers by telnet, SSH, the web terminal and the forum are placed by -their address in `[general] geoip`. A country database places them in -a country; a **city** database in a region (state, province, county) and -city too, which 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. Either kind, in either format: +their address, using the database in `[general] geoip`. A country database +gives a country. A **city** database also gives a region (state, province +or county) and a city, which 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. Either kind works, in +either format: -| | country | city | +| Format | Country databases | City databases | |---|---|---| | MaxMind DB (`.mmdb`, gzipped or not) | GeoLite2/GeoIP2 Country, DB-IP *IP to Country Lite*, IPinfo's | GeoLite2/GeoIP2 City, DB-IP *IP to City Lite* | | CSV of ranges (gzipped or not) | DB-IP's (`start,end,CC`), IP2Location LITE DB1 | DB-IP's city (`start,end,continent,CC,region,city,lat,lon`), IP2Location LITE DB3, DB5, DB9, DB11 | @@ -187,25 +205,26 @@ geoip_credit_url = https://db-ip.com ``` DB-IP's free city database is a monthly download -(`https://download.db-ip.com/free/dbip-city-lite-YYYY-MM.mmdb.gz`, 60 MB; -gzipped as it comes is fine). It takes some 120 MB of memory, its CSV -(86 MB gzipped, 7.8 million ranges) 135 MB and some 15 seconds to -read; the `.mmdb` reads at once. Replace the file and it is read again -within a minute, in the background, the old one answering meanwhile; -the BBS reads it when it starts, not at the first call. The reader was -checked against MaxMind's own on DB-IP's city database of October 2026, -both formats: the same country, region and city for 200,000 addresses. -The image boards' flags use the same file (read once) when `[chan] -geoip` is not set otherwise. +(`https://download.db-ip.com/free/dbip-city-lite-YYYY-MM.mmdb.gz`, 60 MB), +and it can stay gzipped. It takes about 120 MB of memory. Its CSV version +(86 MB gzipped, 7.8 million ranges) takes 135 MB and about 15 seconds to +read, while the `.mmdb` loads at once. The BBS reads the file when it +starts, not at the first call. If you replace the file, it is read again +in the background within a minute, and the old one answers meanwhile. The +reader was checked against MaxMind's own reader on DB-IP's city database +of October 2026, in both formats, and gave the same country, region and +city for 200,000 addresses. The image boards' flags use the same file +(loaded once) unless `[chan] geoip` says otherwise. -The plans are Google's [libphonenumber](https://github.com/google/libphonenumber)'s -(Apache License 2.0), and North America's area codes NANPA's own -([its area code report](https://nanpa.com/reports/npa-reports)): an -area code NANPA has in service is a number even where libphonenumber -has not caught up, its state or province is NANPA's, and one announced -for a later day becomes a number on that day. Both are built into the -BBS: nothing is looked up elsewhere. To make the tables again from newer -ones (`internal/phone/gen`): +The numbering plans come from Google's +[libphonenumber](https://github.com/google/libphonenumber) (Apache License +2.0), and North America's area codes from NANPA's own +[area code report](https://nanpa.com/reports/npa-reports). An area code +NANPA has in service is recognised even where libphonenumber has not +caught up, its state or province is taken from NANPA, and an area code +announced for a later date starts working on that date. Both are built +into the BBS, so nothing is looked up online. To rebuild the tables from +newer data (`internal/phone/gen`): ```sh git clone --depth 1 https://github.com/google/libphonenumber @@ -213,8 +232,10 @@ curl -O https://reports.nanpa.com/public/npa_report.csv make phone-data LIBPHONENUMBER=libphonenumber NANPA=npa_report.csv ``` -They were last made in October 2026 (NANPA's report of 14 October; -libphonenumber's data of 8 October, then missing thirteen area codes -NANPA had in service), and checked against libphonenumber's Go port -(nyaruka/phonenumbers) on 34,000 numbers: the same country, kind and -place for every one. +The tables were last rebuilt in October 2026, from NANPA's report of 14 +October and libphonenumber's data of 8 October (which was then missing +thirteen area codes NANPA had in service). They were checked against +libphonenumber's Go port (nyaruka/phonenumbers) on 34,000 numbers and gave +the same country, kind and place for every one. + +**See also:** [Configuration](Configuration), [File transfers](File-Transfers) diff --git a/docs/wiki/Newsgroups-and-NNTP.md b/docs/wiki/Newsgroups-and-NNTP.md index c612618..949b65a 100644 --- a/docs/wiki/Newsgroups-and-NNTP.md +++ b/docs/wiki/Newsgroups-and-NNTP.md @@ -1,8 +1,8 @@ -A message area becomes a newsgroup when it is given a newsgroup name. Its -messages are then articles: newsreaders (Thunderbird, slrn, tin, Pan) read -and post them through the BBS's NNTP server, and peer news servers swap -them with it, so a message posted from a modem shows up on INN and a reply -from Usenet-style readers shows up on the 3270. +A message area becomes a newsgroup when it is given a newsgroup name. Its +messages are then also news articles. Newsreaders (Thunderbird, slrn, tin, +Pan) read and post them through the BBS's NNTP server, and peer news +servers exchange them with it. So a message posted from a modem shows up +on INN, and a reply from a newsreader shows up on a 3270. ``` bbs area newsgroup General bbs.general @@ -35,23 +35,28 @@ groups = bbs.* accept_from = news.example.net ; may feed us by IHAVE ``` -**The server** speaks RFC 3977 with the readers' commands (`GROUP`, +## The server + +The NNTP server speaks RFC 3977 with the readers' commands (`GROUP`, `LISTGROUP`, `ARTICLE`/`HEAD`/`BODY`/`STAT`, `NEXT`/`LAST`, `OVER`/`XOVER`, `HDR`/`XHDR`, `LIST ACTIVE`/`NEWSGROUPS`/`OVERVIEW.FMT`, `NEWNEWS`, `POST`), `IHAVE` for peers, `AUTHINFO USER/PASS` (RFC 4643) with the BBS's login, -failure delay and throttling, and `STARTTLS` (RFC 4642). Every message has -a Message-ID; a message posted on the BBS is made into an article (From, -Date, Path, References from the thread it replies to, MIME UTF-8 text). -An article that came from elsewhere is kept exactly as it came and shown on -the BBS as text: its poster, subject and body decoded (quoted-printable, -base64, the charset, the text part of a multipart) and cleaned like -anything else a caller writes. +failure delay and throttling, and `STARTTLS` (RFC 4642). Every message has +a Message-ID. A message posted on the BBS is turned into an article (with +From, Date, Path, References from the thread it replies to, and MIME UTF-8 +text). An article that came from elsewhere is kept exactly as it arrived, +and shown on the BBS as text: its poster, subject and body are decoded +(quoted-printable, base64, the charset, the text part of a multipart) and +cleaned like anything else a caller writes. -**Peers** are synced every `interval` seconds, and by `bbs news sync`: +## Peers + +The BBS syncs with its peers every `interval` seconds, and whenever you +run `bbs news sync`: - *pull*: for each of our newsgroups the peer carries (and `groups` matches: a wildmat, `bbs.*,!bbs.test`), the articles after the last one - fetched, by `OVER` and `ARTICLE`. The first time, only the latest + fetched, by `OVER` and `ARTICLE`. The first time, only the latest `initial` of each group. - *push*: our articles posted since the last push (on the BBS, by a reader, or from another peer, never back to the peer they came from), by `IHAVE`; @@ -59,20 +64,23 @@ anything else a caller writes. The first time only records where to start: the history is not dumped on a new peer. - the peer may *feed* us by `IHAVE` from the addresses in `accept_from`; - nobody else may use `IHAVE`. Names there are looked up when the + nobody else may use `IHAVE`. Names there are looked up when the configuration is loaded (at the start and each reload), not on each connection: if a peer's address changes, reload, or list its addresses. -An article is taken once (a history of Message-IDs, also of those refused), -never if this site is in its Path already (so two peers that both carry a -group do not loop), and stored in the first of its newsgroups carried here; -this site's name goes at the head of its Path. It was tried against INN -2.7 both ways: pushing to it, pulling from it, and innxmit feeding the BBS. +Each article is taken only once (the BBS keeps a history of Message-IDs, +including refused ones), and never if this site is already in its Path, so +two peers that carry the same group do not loop. It is stored in the first +of its newsgroups that this site carries, and this site's name goes at the +head of its Path. This was tested against INN 2.7 in both directions: +pushing to it, pulling from it, and innxmit feeding the BBS. -What is not done: control messages (cancel, newgroup, rmgroup) are refused, -not acted on, and deleting a message on the BBS does not cancel it -elsewhere; a crossposted article lives in one area here; there is no -`NEWGROUPS` (newsgroups are made by the sysop) and no streaming -(`CHECK`/`TAKETHIS`), which suits a BBS's volume. +## Not supported + +Control messages (cancel, newgroup, rmgroup) are refused rather than acted +on, and deleting a message on the BBS does not cancel it elsewhere. A +crossposted article lives in only one area here. There is no `NEWGROUPS` +(the sysop creates newsgroups) and no streaming (`CHECK`/`TAKETHIS`), +which suits a BBS's volume. **See also:** [FidoNet (the echo-newsgroup gateway)](FidoNet), [Security](Security) diff --git a/docs/wiki/Offline-Mail.md b/docs/wiki/Offline-Mail.md index 538f348..652076e 100644 --- a/docs/wiki/Offline-Mail.md +++ b/docs/wiki/Offline-Mail.md @@ -1,5 +1,3 @@ -# Offline mail (QWK) - Callers can read and answer their messages offline with a QWK reader (MultiMail, OLX, SLMR, Blue Wave's QWK mode, Synchronet's own...). The BBS packs a caller's new messages into a **packet**. The caller reads it @@ -60,7 +58,7 @@ A REP is at most 16 MB and 1000 messages. ## Getting it -| how | the packet | the REP | +| Where | The packet | The REP | |---|---|---| | text BBS: *O* on the main menu | *D*ownload, by XMODEM, YMODEM, ZMODEM or Kermit | *U*pload, likewise | | 3270: *O* on the main menu | `IND$FILE GET BBSID.QWK` from the emulator's file transfer, typed on the screen's command line | `IND$FILE PUT BBSID.REP` | @@ -130,3 +128,5 @@ by [FTP](Files-and-FTP) (`/qwk`). What its REP brings is posted under the names of the node's writers, not the account's. Its access is still checked on each area. Its packet leaves out what came from the node itself. The areas a node gets are those of its account's new scan. + +**See also:** [Message areas](Message-Areas), [Files and FTP](Files-and-FTP), [File transfers](File-Transfers) diff --git a/docs/wiki/PETSCII-and-RIP.md b/docs/wiki/PETSCII-and-RIP.md index eb40cdf..59881cd 100644 --- a/docs/wiki/PETSCII-and-RIP.md +++ b/docs/wiki/PETSCII-and-RIP.md @@ -1,15 +1,16 @@ -Beside ANSI terminals, the text BBS serves two other kinds of the BBS -era: Commodore 64s and 128s in **PETSCII**, and **RIPscrip** terminals, -which draw graphics and clickable buttons. Both get the same BBS: -messages, mail, files, chat, paging, the sysop's menus and screens. +As well as ANSI terminals, the text BBS serves two other kinds of +terminal from the BBS era: Commodore 64s and 128s in **PETSCII**, and +**RIPscrip** terminals, which draw graphics and clickable buttons. Both +get the same BBS as everyone else: messages, mail, files, chat, paging, +and the sysop's menus and screens. ## PETSCII: Commodores -CCGMS, Novaterm, CGTerm, a C64 with a WiFi modem, SyncTERM or another -terminal in C64 mode, or a real C64 calling a modem line through -[app_dmodem](Modem-Callers). +Commodore callers use CCGMS, Novaterm, CGTerm, a C64 with a WiFi modem, +SyncTERM or another terminal in C64 mode, or a real C64 calling a modem +line through [app_dmodem](Modem-Callers). -A listener says which of its callers are Commodores: +Each listener says which of its callers are Commodores: ```ini [listen c64] @@ -18,41 +19,42 @@ address = :6400 petscii = yes ``` -| `petscii` | | +| `petscii` | Meaning | |---|---| -| `no` (the default) | no Commodores here | -| `yes` | every caller is one (a port, or a modem line, for C64s) | -| `auto` | a caller whose terminal is not ANSI (and not known by its type) is watched while it logs in: see below | +| `no` (the default) | no Commodores on this listener | +| `yes` | every caller is a Commodore (for a port or modem line just for C64s) | +| `auto` | a caller whose terminal is not ANSI (and not known by its type) is watched while it logs in, as described below | -A terminal type saying `petscii`, `c64`, `c128`, `commodore` or `cbm` -(over telnet) is a Commodore on any listener. +On any listener, a telnet terminal type of `petscii`, `c64`, `c128`, +`commodore` or `cbm` is taken as a Commodore. ### How `auto` finds a Commodore -A Commodore's terminal answers no question (a C64 has no status reports, -attributes or answerback), so the BBS reads its keys instead. Until it -knows, the logon screen and the name prompt are in capitals, which a C64 -in its power-on set and any other terminal both read. Then: +A Commodore's terminal answers no questions (a C64 has no status +reports, attributes or answerback), so the BBS watches its keys instead. +Until it knows, the logon screen and the name prompt are in capitals, +which both a C64 in its power-on character set and any other terminal can +read. Then: -| the caller | the BBS | +| If the caller | The BBS | |---|---| | presses a key only a Commodore has: DEL (0x14), a cursor key (not down, 0x11, which is XON), F1-F8 (0x85-0x8C), CLR (0x93), or types a shifted letter (0xC1-0xDA, unless a UTF-8 continuation byte follows it at once) | switches to PETSCII there and then: the screen cleared (and the questions' leftovers with it), the logon screen and the name prompt again | | types a name in lower case | knows it is not a Commodore (whose unshifted letters arrive as ASCII's capitals); nothing is asked | | types a name all in capitals | asks `PRESS DEL (OR BACKSPACE)`: a Commodore's DEL makes it PETSCII (and the name, which was typed in lower case, is taken so), anything else leaves it ASCII | -Whatever is not settled by the end of the login (a caller logged in by -an rlogin or a trusted header) is ASCII. The questions sent to find an -ANSI terminal or a VT52 before the name prompt show a few characters on a -C64; switching to PETSCII clears them. +A caller who is still undecided at the end of the login (for example, one +logged in by rlogin or a trusted header) gets ASCII. The questions sent +before the name prompt to find an ANSI terminal or a VT52 leave a few +characters on a C64's screen; switching to PETSCII clears them. -What the caller gets: +A Commodore caller gets: - the lower/upper case character set (and shift + C= kept from switching it), the screen cleared - 40 columns and 25 rows (the profile's `[W]idth` switches to a C128's 80): menus in one column, lists that fit (who's online, users, areas, messages, mail, files), text wrapped at 39 -- colors as the C64's color codes, reverse, clearing, cursor movement; +- colours as the C64's colour codes, reverse, clearing, cursor movement; box drawing and block characters as its graphics characters; letters with accents without them; what it has no character for as `?` - what is typed read back: letters as the set has them, RETURN, DEL to @@ -61,14 +63,15 @@ What the caller gets: it is, else `NAME.asc` or `.txt` translated (see [Customization](Customization)) -Doors are not offered (they are ANSI programs). File transfers are the -usual XMODEM, YMODEM, ZMODEM and Kermit (CCGMS and Novaterm have XMODEM); -Punter is not. +Doors are not offered, because they are ANSI programs. File transfers +use the usual XMODEM, YMODEM, ZMODEM and Kermit (CCGMS and Novaterm have +XMODEM); Punter is not supported. ## RIPscrip -RIPterm, and SyncTERM (with RIP on), draw RIPscrip 1.54: vector graphics -on a 640x350 EGA screen, with buttons that send keys when clicked. +RIPterm, and SyncTERM with RIP turned on, draw RIPscrip 1.54: vector +graphics on a 640x350 EGA screen, with buttons that send keys when +clicked. ```ini [listen telnet] @@ -77,29 +80,30 @@ address = :2300 rip = auto ``` -| `rip` | | +| `rip` | Meaning | |---|---| | `auto` (the default) | an ANSI terminal that is not a modern one (`xterm`, `screen`, `putty` and friends are not asked) is asked with `ESC [ !`; one that answers `RIPSCRIP...` has RIP | | `yes` | every ANSI caller has it | | `no` | none is asked | -The question costs one round trip: a position report follows it, which -every ANSI terminal answers, and a RIP terminal's answer comes first. +The question costs one round trip. The BBS sends a position request +straight after it, which every ANSI terminal answers, and a RIP terminal's +answer arrives first. -What the caller gets: +A RIP caller gets: - every menu (the main menu, and the sysop's own) as a scene: a title bar, a button for each item (its key underlined, clicking it the same - as pressing it) and the prompt in a text window below. When a choice + as pressing it) and the prompt in a text window below. When a choice is made the scene is cleared and the BBS goes on in text, full screen; whatever that printed waits for a key before the next menu covers it - display files: `NAME.rip` first (RIPscrip, with ANSI in it, in CP437, - @-codes filled), then `.ans`, `.asc`, `.txt`. A menu showing a `.rip` + @-codes filled), then `.ans`, `.asc`, `.txt`. A menu showing a `.rip` screen of the sysop's has its buttons, not the built-in ones - everything else as on any ANSI terminal -A caller can turn RIP off and on in their profile (`[R]IP`; on only if the -terminal answers). What they choose, and a Commodore's width, is kept for -their next call ([Terminal identification](Terminal-Identification#what-a-caller-sets)). +A caller can turn RIP off and on in their profile (`[R]IP`; it can only +be turned on if the terminal answered). Their choice, like a Commodore's +width, is kept for their next call ([Terminal identification](Terminal-Identification#what-a-caller-sets)). **See also:** [Customization](Customization), [Configuration](Configuration), [Modem callers](Modem-Callers) diff --git a/docs/wiki/Running.md b/docs/wiki/Running.md index 447db07..2c3f58c 100644 --- a/docs/wiki/Running.md +++ b/docs/wiki/Running.md @@ -1,54 +1,65 @@ +This page covers starting the BBS for the first time, running it under +systemd, and running it as a user of its own. For day-to-day work once it +is running, see [Administration](Administration). + +## First start + ``` -bbs -config /etc/bbs/bbs.conf config # the configuration screens (begun from the sample) -bbs -config /etc/bbs/bbs.conf check # the configuration, its warnings -bbs -config /etc/bbs/bbs.conf init # the database, with two areas +bbs -config /etc/bbs/bbs.conf config # edit the configuration in its screens (starts from the sample) +bbs -config /etc/bbs/bbs.conf check # read the configuration and show its warnings +bbs -config /etc/bbs/bbs.conf init # make the database, with two message areas bbs -config /etc/bbs/bbs.conf user add sysop -sysop bbs -config /etc/bbs/bbs.conf serve ``` -[bbs.service.sample](https://github.com/D-Modem/bbs/blob/HEAD/bbs.service.sample) runs it under systemd as its own -user, with the database in `/var/lib/bbs` and sockets in `/run/bbs`; -`systemctl reload bbs` puts what may change while callers are on in force -([Configuration](Configuration#changing-it-while-callers-are-on)). +Without `-config`, bbs runs with its defaults: telnet and TN3270 on port +2300, modem callers (raw) on 127.0.0.1:2323, and the database in `bbs.db` +in the current directory. The database can also be PostgreSQL, MySQL or +MariaDB: see [Databases](Databases). + +## Under systemd + +[bbs.service.sample](https://github.com/D-Modem/bbs/blob/HEAD/bbs.service.sample) +runs the BBS under systemd as its own user, with the database in +`/var/lib/bbs` and its sockets in `/run/bbs`. `systemctl reload bbs` applies +the settings that can change while callers are on (see +[Configuration](Configuration#changing-it-while-callers-are-on)). ## Running as a user of its own -Ports under 1024 (telnet's 23, finger's 79, gopher's 70) need root, or -`CAP_NET_BIND_SERVICE`. Either systemd starts the BBS as its user with -that capability (bbs.service.sample's `User=bbs` and -`AmbientCapabilities=`), or the BBS is started as root and gives root up -itself: +Ports below 1024 (telnet's 23, finger's 79, gopher's 70) need root or the +`CAP_NET_BIND_SERVICE` capability. There are two ways to give the BBS +those ports without running it as root: + +- systemd starts the BBS as its own user with that capability + (bbs.service.sample's `User=bbs` and `AmbientCapabilities=`), or +- the BBS is started as root and gives up root itself: ``` [general] user = bbs -; group = bbs (the user's own by default) +; group = bbs (the user's own group by default) ``` -Started as root, `bbs serve` reads the configuration, binds every port and -unix socket it listens on (the listeners, the HTTP API and metrics, FTP, -NNTP, IRC, finger, gopher, binkp), gives up root (its supplementary groups -become the user's: `socket_group`'s and docker's, say) and runs itself -again as the user, the same process (its PID, for systemd and `systemctl -reload`), the sockets handed down. Nothing is written as root: the -database, logs, host keys and backups are the user's. A unix socket -without `socket_group` is the user's too. +When it is started as root, `bbs serve` reads the configuration and binds +every port and unix socket it listens on (the listeners, the HTTP API and +metrics, FTP, NNTP, IRC, finger, gopher and binkp). Then it gives up root, +takes the user's supplementary groups (such as `socket_group`'s and +docker's), and runs itself again as the user. It stays the same process, +with the same PID for systemd and `systemctl reload`, and keeps the +sockets. Nothing is written as root: the database, logs, host keys and +backups all belong to the user. A unix socket without `socket_group` +belongs to the user too. Other commands started as root (`bbs user add`, `bbs init`, `bbs backup`) -give root up first as well, so that the database stays the user's; `bbs -check` and `bbs config` stay root (the configuration file is root's to -write), and `bbs backup restore` puts things back as root and gives them -(but the configuration) to the user. +also give up root first, so that the database stays the user's. `bbs +check` and `bbs config` stay root, because the configuration file is +root's to write. `bbs backup restore` restores files as root and then +hands them to the user, except the configuration. The user must be able to read the configuration (`chown root:bbs -/etc/bbs/bbs.conf; chmod 0640`), write where the database and files are, -and run the program. Under systemd, leave `User=` out (bbs.service.sample -says how). - -Without `-config` it runs with the defaults: telnet and TN3270 on port -2300, modem callers raw on 127.0.0.1:2323, the database `bbs.db` here. The database can as well -be PostgreSQL, MySQL or MariaDB: see [Databases](Databases). - -Day to day: [Administration](Administration). +/etc/bbs/bbs.conf; chmod 0640`), write where the database and files are +kept, and run the program. Under systemd, leave `User=` out when you use +this method; bbs.service.sample explains how. **See also:** [Configuration](Configuration), [Administration](Administration) diff --git a/docs/wiki/SSH.md b/docs/wiki/SSH.md index a67a338..79d4f3f 100644 --- a/docs/wiki/SSH.md +++ b/docs/wiki/SSH.md @@ -1,7 +1,7 @@ -Callers can come in by SSH: the text BBS, encrypted, logged in by their -BBS password or by a key. It is what modern BBS terminals (SyncTERM, -NetRunner, MagiTerm) and a plain `ssh` speak, and the way to keep -passwords off the wire, as telnet and rlogin do not. +Callers can reach the text BBS over SSH, encrypted, and log in with their +BBS password or with a key. Modern BBS terminals (SyncTERM, NetRunner, +MagiTerm) and a plain `ssh` client all speak SSH, and unlike telnet and +rlogin it keeps passwords off the wire. ```ini [listen ssh] @@ -15,24 +15,28 @@ ssh -p 2222 alice@bbs.example.org ## Logging in -| SSH user | how | then | +| SSH user | Logs in with | Then | |---|---|---| | a user's name | their BBS password (SSH `password` or `keyboard-interactive`) | the main menu | | a user's name | one of their keys | the main menu | | `new` | nothing | the BBS's own login prompt: `NEW` to sign up (only when `new_users = yes`) | -A name with spaces is given with `_` or `.` for them (`Alice_Smith`). Names are not case sensitive. Wrong -passwords count against the caller's address as a terminal's do -(`fail_delay`, throttling), and a locked account gets in by neither -password nor key. +For a name with spaces, use `_` or `.` in their place (`Alice_Smith`). +Names are not case-sensitive. Wrong passwords count against the caller's +address just as they do on a terminal (`fail_delay` and throttling), and a +locked account cannot log in with either a password or a key. ## Keys -A user's keys are their own to add, from the text BBS (*Your profile*, -`K`, after giving their password again: for an account modemmenu made, -its modemmenu password, or a [sign-in code](Web-Forum#sign-in-codes)), from the [HTTP API](HTTP-API) -(`POST /api/v1/me/keys` with a login's session token, not an API key), or -by the sysop: +Users add their own keys in one of these ways: + +- on the text BBS, in *Your profile* (`K`), after giving their password + again (for an account modemmenu made, its modemmenu password or a + [sign-in code](Web-Forum#sign-in-codes)); +- through the [HTTP API](HTTP-API), with `POST /api/v1/me/keys` and a + login's session token (not an API key). + +The sysop can also add them: ``` bbs sshkey add alice ~alice/.ssh/id_ed25519.pub # each line of the file (- : stdin) @@ -40,24 +44,25 @@ bbs sshkey list [USER] bbs sshkey del ID ``` -ed25519, ECDSA (and the security-key `sk-` kinds) and RSA of 2048 bits -or more are taken; DSA is not. A key belongs to one user only, a user -has 20 at most, and a key carries no options (`command=`, `from=`). The -log notes each key added, deleted and logged in with (by its SHA-256 -fingerprint). +The BBS accepts ed25519, ECDSA (including the security-key `sk-` kinds) +and RSA keys of 2048 bits or more, but not DSA. A key belongs to one user +only, a user can have up to 20, and keys carry no options (`command=`, +`from=`). The log records each key added, deleted or used to log in, by +its SHA-256 fingerprint. ## The session -Only a terminal session: a shell request, with a pty if the client asks. -The pty's terminal type and size go to the text BBS as telnet's do -(`xterm-256color` is ANSI and UTF-8, `ansi` and `syncterm` are ANSI and -CP437, anything else is asked), and `ansi`, `utf8` and `sixel` on the -listener set them as on telnet. Commands (`ssh host ls`), SFTP and SCP, -port and agent forwarding, X11 and a second session on the connection -are all refused. A resized window keeps the size the session began +The listener offers only a terminal session: a shell request, with a pty +if the client asks for one. The pty's terminal type and size go to the +text BBS just as telnet's do (`xterm-256color` means ANSI and UTF-8, +`ansi` and `syncterm` mean ANSI and CP437, and for anything else the +caller is asked). `ansi`, `utf8` and `sixel` on the listener set them as +they do on telnet. Commands (`ssh host ls`), SFTP and SCP, port and agent +forwarding, X11 and a second session on the same connection are all +refused. Resizing the window does not change the size the session began with. -A client has 30 seconds from connecting to asking for its shell; +A client has 30 seconds after connecting to ask for its shell. `max_per_ip` limits connections from one address, as on telnet. ## Host keys @@ -66,13 +71,14 @@ A client has 30 seconds from connecting to asking for its shell; host_keys = /etc/bbs/ssh_host_ed25519_key /etc/bbs/ssh_host_rsa_key ``` -By default the listener has an ed25519 and an RSA key beside the -database, `ssh_host_ed25519_key` and `ssh_host_rsa_key`, made (0600) the -first time it starts if they are not there: the log says their -fingerprints, as does `bbs check`. Keys made by `ssh-keygen` (OpenSSH or -PEM format, no passphrase) do as well; a missing one is made by its -name: RSA (3072 bits) if it says `rsa`, ECDSA P-256 if `ecdsa`, else -ed25519. A key file others may read is refused, as sshd does. +By default the listener uses an ed25519 key and an RSA key beside the +database, `ssh_host_ed25519_key` and `ssh_host_rsa_key`. If they are not +there, it creates them (mode 0600) the first time it starts, and the log +and `bbs check` show their fingerprints. Keys made by `ssh-keygen` +(OpenSSH or PEM format, without a passphrase) work too. A missing key is +created according to its name: RSA (3072 bits) if the name says `rsa`, +ECDSA P-256 if it says `ecdsa`, and ed25519 otherwise. Like sshd, the BBS +refuses a key file that other users can read. ## Old clients @@ -80,11 +86,11 @@ ed25519. A key file others may read is refused, as sshd does. legacy = yes ``` -offers, beside the usual algorithms, the AES-CBC and 3DES-CBC ciphers and -the 1024-bit `diffie-hellman-group1-sha1` key exchange, for old clients -(old SyncTERM and PuTTY builds, cryptlib) that have nothing newer. They -are weak; `bbs check` warns. Without it the server offers curve25519, -ECDH and 2048-bit or larger DH, and AES-GCM, ChaCha20-Poly1305 and -AES-CTR. +This adds the AES-CBC and 3DES-CBC ciphers and the 1024-bit +`diffie-hellman-group1-sha1` key exchange to the usual algorithms, for old +clients that have nothing newer (old SyncTERM and PuTTY builds, cryptlib). +These algorithms are weak, and `bbs check` warns about them. Without +`legacy`, the server offers curve25519, ECDH and DH of 2048 bits or more, +with AES-GCM, ChaCha20-Poly1305 and AES-CTR. **See also:** [Configuration](Configuration), [Security](Security), [HTTP API](HTTP-API) diff --git a/docs/wiki/Scripting.md b/docs/wiki/Scripting.md index c072255..1493426 100644 --- a/docs/wiki/Scripting.md +++ b/docs/wiki/Scripting.md @@ -1,8 +1,9 @@ -The sysop's own screens and features, in JavaScript. A script draws the -same screens as the rest of the BBS (menus, tables, forms, panels, -messages, the editor), so it works on every terminal: a text terminal in -ANSI, ASCII or PETSCII, a RIP terminal (whose menus are buttons), and a -3270. It acts as its caller, with their access. +Sysops can add their own screens and features to the BBS in JavaScript. +A script draws the same kinds of screen as the rest of the BBS (menus, +tables, forms, panels, messages and the editor), so it works on every +terminal: a text terminal in ANSI, ASCII or PETSCII, a RIP terminal (where +menus become buttons), and a 3270. A script acts as its caller, with the +caller's access. ``` ; bbs.conf @@ -14,24 +15,26 @@ o = script:oneliners One-liners p = script:poll Today's poll ``` -`NAME.js` in `scripts_dir` is the script `script:NAME` runs (names are -lower case letters, digits, `_` and `-`). A `logon.js` there runs after -every login, before the menus. `bbs check` compiles every script and -refuses a configuration whose scripts do not compile or whose menus name -a script that is not there; a script changed while the BBS runs is -compiled again at its next run. `scripts.sample` has two to start from: -one-liners and a poll. +A menu item `script:NAME` runs `NAME.js` from `scripts_dir` (names are +lower-case letters, digits, `_` and `-`). A `logon.js` there runs after +every login, before the menus. `bbs check` compiles every script, and +refuses a configuration if a script does not compile or a menu names a +script that does not exist. A script changed while the BBS runs is +compiled again the next time it runs. `scripts.sample` has two scripts to +start from: one-liners and a poll. ## What a script is -[goja](https://github.com/dop251/goja)'s JavaScript: ECMAScript 5.1 and -much of 6 (`let`, arrow functions, classes, `Map`, template strings), in -strict mode. A script has no files, network, processes or timers: only -the objects below. It may compute for two seconds between one screen and -the next (the caller's time at a screen is not counted); past that it is -stopped and the caller told. A script that fails is logged and the -caller told (a sysop is told why); the caller hanging up or going idle -ends it, whatever it catches. `exit()` ends it early. +Scripts run in [goja](https://github.com/dop251/goja), which supports +ECMAScript 5.1 and much of ECMAScript 6 (`let`, arrow functions, classes, +`Map`, template strings), in strict mode. A script cannot reach files, the +network, processes or timers; it has only the objects described below. + +A script may compute for up to two seconds between one screen and the +next (time the caller spends at a screen does not count). Beyond that it +is stopped and the caller is told. A script that fails is logged and the +caller is told (a sysop is also told why). If the caller hangs up or goes +idle, the script ends, whatever it catches. `exit()` ends a script early. ```js // a guestbook in eight lines @@ -46,7 +49,7 @@ if (k === "S") { ## ui: the screens -| | returns | | +| Function | Returns | Notes | |---|---|---| | `ui.menu({title, intro, items: [{key, label}], prompt, screen})` | the key chosen (upper case), `""`, or `ui.BACK` (a 3270's PF3) | `intro`: lines before the items; `screen`: a display file in their place | | `ui.table({title, note, columns: [{title, width, right, wide}], rows, empty, pick, prompt, actions, more, less})` | `{action, row, num, text}` | `rows`: arrays of cells, or `{num, cells, mark, hot}`; `pick` makes rows choosable (`action` is `ui.PICK`, `row` the index, -1 for a number not shown, `num` what was typed); `wide` columns only on screens of 60 columns or more; `more`/`less` say there are pages after and before (`ui.MORE`, `ui.LESS`) | @@ -60,16 +63,18 @@ if (k === "S") { | `ui.screen(name)` | whether there was one | a display file of `screens_dir` | | `ui.kind`, `ui.pageSize`, `ui.narrow` | | `"text"` or `"3270"`; rows a table shows; under 60 columns | -Lines are strings (`\n` makes more) or `{label, text, tone, bar}`: a -label and its value, a tone (`plain`, `dim`, `bright`, `good`, `bad`, -`warn`), a bar from 0 to 1. Actions are `{id, label, key, pf, short}`: a -text terminal's key, a 3270's PF key (an action without one is not on a -3270), `short` for the 3270's key line. On a text terminal `Q` (and Enter -on an empty prompt) goes back; on a 3270, PF3. +Lines are strings (`\n` starts a new line) or objects +`{label, text, tone, bar}`, which give a label and its value, a tone +(`plain`, `dim`, `bright`, `good`, `bad` or `warn`), and a bar from 0 to 1. +Actions are `{id, label, key, pf, short}`: `key` is the key on a text +terminal, `pf` is the PF key on a 3270 (an action without one does not +appear on a 3270), and `short` is its name on the 3270's key line. On a +text terminal, `Q` (or Enter at an empty prompt) goes back; on a 3270, PF3 +goes back. ## The BBS -| | | +| Object | What it gives | |---|---| | `bbs.name`, `bbs.sysop`, `bbs.location`, `bbs.log(text)` | the system; a line in its log | | `user.id`, `.name`, `.location`, `.level`, `.flags`, `.sysop`, `.calls`, `.posts`, `.since`, `.lastCall`, `user.has(require)` | the caller; `has` takes an [access requirement](Access-Levels) such as `"20 A"` (level 20 or more, and flag A) | @@ -80,8 +85,8 @@ on an empty prompt) goes back; on a 3270, PF3. | `data.user.get` ... | the same, for the caller alone (100 names) | | `console.log(...)` | the BBS's log | -What a script keeps is in the database (`script_data`), by the script's -name: a renamed script starts afresh. A user's data goes with their -account. +A script's data is kept in the database (`script_data`) under the +script's name, so a renamed script starts afresh. A user's data is +deleted with their account. **See also:** [Customization](Customization), [Development](Development#screens) diff --git a/docs/wiki/Security.md b/docs/wiki/Security.md index fd6498f..4fe79dd 100644 --- a/docs/wiki/Security.md +++ b/docs/wiki/Security.md @@ -1,12 +1,18 @@ -- Passwords are bcrypt (cost 12); unknown users take as long to refuse as - wrong passwords; failures wait `fail_delay`; `attempts` failures hang - up; `throttle_failures` turns away an address or caller ID that keeps - failing (or signing up). +This page lists what the BBS guards against and how, service by service, +and then the settings for keeping unwanted callers out and for telnet +over TLS. + +## What is guarded, and how + +- Passwords are stored with bcrypt (cost 12). Unknown users take as long + to refuse as wrong passwords, each failure waits `fail_delay`, and after + `attempts` failures the BBS hangs up. `throttle_failures` turns away an + address or caller ID that keeps failing (or keeps signing up). - Everything users write is cleaned before it is stored and again before it is shown: no escape sequences, control characters, C1 controls, bidirectional overrides or invalid UTF-8 reach another caller's - terminal. On a 3270 these would become 3270 orders once in EBCDIC; go3270 - does not filter them itself. + terminal. On a 3270 these would become 3270 orders once converted to + EBCDIC, and go3270 does not filter them itself. - Limits everywhere: name, subject and line lengths, message size, telnet subnegotiations, session headers, rlogin fields, 64 KB for a 3270 screen's answer; timeouts for every step (telnet and TN3270 negotiation, @@ -26,50 +32,50 @@ only its own user, only if not locked, and is decided by the key the client proved (never one it merely offered); keys are added only with the password (on the BBS) or a login's session (the API), not by an - API key. Commands, SFTP, forwarding of any kind and second sessions - are refused, and a client has 30 seconds to get to its shell. A modem line is as private as the phone - network. + API key. Commands, SFTP, forwarding of any kind and second sessions + are refused, and a client has 30 seconds to get to its shell. +- A modem line is as private as the phone network. - News: a reader's article is posted as its user whatever its From says, with the BBS's own Message-ID, Date and Path; only the headers a reader - may choose (Subject, References, the body) are kept. `IHAVE` is taken + may choose (Subject, References, the body) are kept. `IHAVE` is taken only from a peer's `accept_from` addresses, and peers' articles are checked (the headers RFC 5536 requires, sizes of the article, its - headers and lines) and cleaned before a caller sees them. `tls = + headers and lines) and cleaned before a caller sees them. `tls = required` refuses `AUTHINFO` before `STARTTLS`; `no` and `optional` make - `bbs check` warn. Commands, lines and articles are limited, and so are + `bbs check` warn. Commands, lines and articles are limited, and so are clients at once and from one address. - FidoNet: a link is known by its address and its password (CRAM-MD5; in the clear only if allowed); a wrong password waits and is refused, an address that is not a link is turned away, and a system calling with - a link's address but not its password gets nothing. Packets are tossed + a link's address but not its password gets nothing. Packets are tossed only from a link's own inbound, only if from its address to ours, with - its packet password if it has one. Received file names are reduced to a + its packet password if it has one. Received file names are reduced to a safe base name; files, sessions, packets, bundles and messages have size - limits. Netmail's sender is what the message says, as anywhere in + limits. Netmail's sender is what the message says, as anywhere in FidoNet: it is not proof of who wrote it. - Doors: a DOS door runs in a container with no network, as the BBS's user, seeing only the doors' directory and its node's; the caller's - line is joined to it only through COM1. Hanging up, the time limit and - the idle time stop it. The drop files carry no password. + line is joined to it only through COM1. Hanging up, the time limit and + the idle time stop it. The drop files carry no password. - Chat: what callers say is cleaned like anything else they write, and limited (200 characters a line, 8 lines in 10 seconds); a caller pages at most once a minute; a page's private room is the caller's and the - sysops' only. `page_command` runs without a shell, the caller's words + sysops' only. `page_command` runs without a shell, the caller's words as whole arguments. - Finger tells no addresses or caller IDs and forwards nothing; gopher shows no message or file area unless the sysop names it (and `bbs check` warns when they do), and its selectors are database records, not - paths. Both limit connections at once and from one address, and time - out. + paths. Both limit connections at once and from one address, and both + time out. - The HTTP API: TLS by default (`bbs check` warns when it is off on an address others reach); tokens of 32 random bytes kept only as hashes, never in URLs, limited by scope (`sysop` only for sysops), expiring and revocable; rate limits per token and per address; JSON bodies limited and strict; one CORS origin at most, and WebSockets only from - it and the API's own host. Metrics are on an address of their own. + it and the API's own host. Metrics are on an address of their own. - Databases: SQLite's file is made 0600; a server's password is never logged (`bbs check` and the log show `xxxxx`); the configuration file - holding it should be 0640. Every query takes its values as parameters. + holding it should be 0640. Every query takes its values as parameters. - Access levels: checked in the BBS's core, so the text BBS, 3270s, FTP, NNTP and the API keep them alike; an area a user may not read is not listed, opened, or found by a message's number or Message-ID; no user @@ -82,7 +88,7 @@ the HTTP server's TLS, connection and rate limits; the caller logs in at the BBS's prompt like any terminal caller. - Screens: display files are read only from `screens_dir`, by names of - letters, digits, `_` and `-` (no paths), at most 256 KB. The values of + letters, digits, `_` and `-` (no paths), at most 256 KB. The values of @-codes are cleaned, so no escape sequence gets into a screen through a user's name or location. - The log has logins, failures, posts and mail sent (never passwords or @@ -99,26 +105,26 @@ hack_log = /var/log/bbs/hack.log ; who tried what ban_minutes = 60 ; a throttled address is banned this long ``` -- `deny_file` lists addresses and networks, one a line (`192.0.2.7`, - `198.51.100.0/24`, `2001:db8::/32`; `#` or `;` begins a comment). A +- `deny_file` lists addresses and networks, one per line (`192.0.2.7`, + `198.51.100.0/24`, `2001:db8::/32`; `#` or `;` begins a comment). A connection from one is closed at once on every service: the terminal listeners and SSH, FTP, NNTP, the HTTP API and web terminal, finger, - gopher and binkp. Callers through unix sockets (a modem server, an - upstream menu) are never refused. The file is read again when it + gopher and binkp. Callers through unix sockets (a modem server, an + upstream menu) are never refused. The file is read again when it changes; `bbs check` warns of lines that are not addresses. - `ban_minutes`: an address that `throttle_failures` turns away is banned outright for that long, from every service (not a caller ID: those are a - modem server's callers, and a ban would not stop them). Bans are kept + modem server's callers, and a ban would not stop them). Bans are kept in memory; `GET /api/v1/admin/bans` lists them and `DELETE /api/v1/admin/bans/{ip}` lifts one. -- `name_deny_file` has patterns, one a line, in any case, `*` for any run +- `name_deny_file` has patterns, one per line, in any case, `*` for any run of characters (`*sysop*`, `admin*`): no new user, nor an account an - upstream menu makes, may take a name that matches. Names such as + upstream menu makes, may take a name that matches. Names such as `sysop`, `root` and `new` are refused anyway. - The hack log has failed logins (and the names tried), logins to locked accounts, throttled and banned addresses, refused connections and - refused names, one a line with the time; `GET /api/v1/admin/hacklog` - shows its end. It is opened for each line, so it may be rotated. + refused names, one per line with the time; `GET /api/v1/admin/hacklog` + shows its end. It is opened for each line, so it may be rotated. ## Telnet over TLS @@ -130,8 +136,10 @@ tls_cert = /etc/bbs/cert.pem tls_key = /etc/bbs/key.pem ``` -A telnet or raw listener with `tls_cert` and `tls_key` takes TLS (1.2 or -later) and then telnet (or TN3270) as usual: SyncTERM (TelnetS) and -`c3270 L:host:992` speak it. A client has 15 seconds to finish the +A telnet or raw listener with `tls_cert` and `tls_key` accepts TLS (1.2 or +later) and then telnet (or TN3270) as usual. SyncTERM (TelnetS) and +`c3270 L:host:992` both speak it. A client has 15 seconds to finish the handshake. +**See also:** [SSH](SSH), [Configuration](Configuration), [Sysop tools](Sysop-Tools) + diff --git a/docs/wiki/Sixel-Graphics.md b/docs/wiki/Sixel-Graphics.md index c8093b8..aab10f6 100644 --- a/docs/wiki/Sixel-Graphics.md +++ b/docs/wiki/Sixel-Graphics.md @@ -1,25 +1,27 @@ -## Sixel graphics - Telnet callers whose terminal has sixel graphics (xterm `-ti vt340`, -mlterm, foot, WezTerm, Windows Terminal, iTerm2, SyncTERM, ...) see the -logo as a picture above the system's name: `logo = /etc/bbs/logo.png`, or -without one the name drawn in a pixel font. The BBS asks every ANSI -terminal for its device attributes (`CSI c`; sixel is attribute 4) and its -character cell in pixels (`CSI 16 t`, to fit the logo to the window), so -nothing changes for terminals without sixel. A caller turns it off (or on, -if their terminal has it) in their profile, and it stays off on their -later calls. +mlterm, foot, WezTerm, Windows Terminal, iTerm2, SyncTERM and others) see +the logo as a picture above the system's name. The logo is +`logo = /etc/bbs/logo.png`, or, if that is not set, the system's name drawn +in a pixel font. -`sixel = auto` is the default for telnet listeners and `no` for raw and -rlogin ones: a picture is slow over a modem. +The BBS asks every ANSI terminal for its device attributes (`CSI c`; +sixel is attribute 4) and for its character cell size in pixels +(`CSI 16 t`, to fit the logo to the window), so nothing changes for +terminals without sixel. A caller can turn sixel off (or on, if their +terminal has it) in their profile, and the choice is kept for their later +calls. + +`sixel = auto` is the default for telnet listeners, and `no` for raw and +rlogin listeners, because a picture is slow over a modem. ## Pictures -The [image boards](Image-Boards)' pictures are shown with sixel too, and -on terminals without it as they can: kitty's graphics protocol on kitty -and Ghostty, iTerm2's inline images on iTerm2 and mintty, and coloured -half blocks on any other UTF-8 terminal with colour. *Pictures on/off* -(**M**) on the profile turns them off for a caller. 3270s have pictures -of their own: vector graphics, or blocks (see [TN3270](TN3270#pictures)). +Pictures on the [image boards](Image-Boards) are shown with sixel too. +Terminals without sixel get the best they can show: kitty's graphics +protocol on kitty and Ghostty, iTerm2's inline images on iTerm2 and +mintty, and coloured half blocks on any other UTF-8 terminal with colour. +*Pictures on/off* (**M**) in the profile turns them off for a caller. +3270s have their own ways of showing pictures, with vector graphics or +blocks (see [TN3270](TN3270#pictures)). **See also:** [TN3270 graphics](TN3270), [Configuration](Configuration), [Image boards](Image-Boards) diff --git a/docs/wiki/Sysop-Tools.md b/docs/wiki/Sysop-Tools.md index 9349f58..4b7e0ff 100644 --- a/docs/wiki/Sysop-Tools.md +++ b/docs/wiki/Sysop-Tools.md @@ -1,17 +1,17 @@ -A sysop's main menu has `*`, *Sysop tools* (and a custom menu may have a -`sysop` item). It works on any terminal; watching a node needs a text -terminal. +Sysop tools is the sysop's menu inside the BBS, reached with `*` on a +sysop's main menu (a custom menu can also have a `sysop` item). It works on +any terminal, although watching a node needs a text terminal. -| | key | | +| Tool | Key | What it does | |---|---|---| -| watch a node | `W` | what a text caller is sent, as it is sent, on your screen: their menus, their door, their typing echoed. A key stops; their leaving ends it. Their screen size and character set are theirs | +| watch a node | `W` | what a text caller is sent, as it is sent, on your screen: their menus, their door, their typing echoed. A key stops; their leaving ends it. Their screen size and character set are theirs | | chat with a node | `C` | the caller is told you would like a word, and taken into a private chat with you at their next menu (their page's room, `sysop-N`); you wait there | | kick a node | `K` | throw a caller off, after a yes | -| users | `U` | every user's level, flags and state; for one: their level, flags (`+AB -C` adds and takes), lock or unlock, sysop rights given or taken, a new password. Not your own lock or rights | +| users | `U` | every user's level, flags and state; for one: their level, flags (`+AB -C` adds and takes), lock or unlock, sysop rights given or taken, a new password. Not your own lock or rights | | statistics | `S` | totals (users, messages, mail, files; logins, posts, pages and failed logins since the start), and calls, new users, posts and uploads for each of the last 14 days, as bars | | hack log and bans | `H` | the addresses banned now (a number lifts its ban), and `L` the [hack log](Security#keeping-callers-out)'s last 100 lines | | scheduled events | `E` | the events, when they run next and how their last run went; one's command and output, and `R` runs it now | -| configuration | `F` | the configuration menus: the board, the system, connections, services, users and groups, maintenance; nothing changes until F10 saves (F9 quits), and then what may change while callers are on is put in force at once ([Configuration](Configuration#editing-it-the-configuration-screens)). Shown when the BBS runs with `-config` | +| configuration | `F` | the configuration menus: the board, the system, connections, services, users and groups, maintenance; nothing changes until F10 saves (F9 quits), and then what may change while callers are on is put in force at once ([Configuration](Configuration#editing-it-the-configuration-screens)). Shown when the BBS runs with `-config` | | available | `A` | whether pages reach you; when not, a caller who pages is told you are not available and may leave you a message | Validating new users stays on the main menu (`V`, when some wait). @@ -32,17 +32,20 @@ every = 60 timeout = 300 ``` -An event is a program and its arguments (words parted by spaces; `"..."` -or `'...'` keep spaces in one), run without a shell, with `BBS_EVENT` set -to its name, at most one at a time. It runs `at` a time each day or -`every` so many minutes (the first after that many minutes from the -start). A run that goes past `timeout` is stopped. The log has each -run; the last run's end and output (its last 4 KB) are kept for the -sysop tools and the API. `bbs check` warns of a program it cannot find. +A scheduled event is a program the BBS runs for you, either `at` a time +each day or `every` so many minutes (the first run comes that many minutes +after the BBS starts). The command is a program and its arguments, +separated by spaces; `"..."` or `'...'` keep spaces inside one argument. +It runs without a shell, with `BBS_EVENT` set to the event's name, and only +one event runs at a time. A run that goes past `timeout` is stopped. + +Every run is logged. The last run's result and output (its last 4 KB) are +kept for the sysop tools and the API. `bbs check` warns about a program it +cannot find. ## The API -| | | +| Request | What it does | |---|---| | `GET /api/v1/admin/events` | the events, their next and last runs | | `POST /api/v1/admin/events/{name}/run` | run one now, and wait for it | diff --git a/docs/wiki/TN3270.md b/docs/wiki/TN3270.md index 9d0d69a..d6f93c5 100644 --- a/docs/wiki/TN3270.md +++ b/docs/wiki/TN3270.md @@ -1,11 +1,16 @@ -A 3270 client connects to the telnet listener like any other. The BBS -asks every client for its terminal type; one that says `IBM-3278-*`, -`IBM-3279-*`, `IBM-3277-*` or `IBM-DYNAMIC` is turned over to go3270, -which negotiates binary and end-of-record, finds the screen size (24x80 -up to the model 5's 27x132, or what IBM-DYNAMIC says) and the code page, -and the caller gets the 3270 screens: +IBM 3270 terminals and their emulators get full 3270 screens, with PF +keys and, where the terminal has them, graphics. This page covers how the +BBS recognises a 3270, the keys, and how it draws pictures. -| key | | +A 3270 client connects to the telnet listener like any other client. The +BBS asks every client for its terminal type. A client that says +`IBM-3278-*`, `IBM-3279-*`, `IBM-3277-*` or `IBM-DYNAMIC` is handed to +[go3270](https://github.com/D-Modem/go3270), which negotiates binary and +end-of-record mode and finds the screen size (from 24x80 up to the model +5's 27x132, or what IBM-DYNAMIC says) and the code page. The caller then +gets the 3270 screens: + +| Key | What it does | |---|---| | Enter | log on, choose a menu's option (by its letter), select (type `S` by a line), save | | PF3 | back, log off | @@ -16,24 +21,25 @@ and the caller gets the 3270 screens: | PF9 | delete, remove | | PF10 / PF11 | previous / next message; find messages / scan setup (the areas) | -The key line at the foot of each screen says which of these it takes. -The screens are the text BBS's (see [Development](Development#screens)): -the same choices, by PF key instead of letter. +The key line at the bottom of each screen shows which of these keys it +accepts. The screens are the same as the text BBS's (see +[Development](Development#screens)), with the same choices made by PF key +instead of by letter. ``` c3270 localhost:2300 x3270 -model 3279-4 localhost:2300 ``` -`tn3270 = no` on a listener sends 3270s the text BBS (which they cannot -show). +With `tn3270 = no` on a listener, 3270s are sent the text BBS instead, +which they cannot show. ## 3270 graphics -The BBS reads everything the terminal says of itself when it connects (its -query replies) and uses what it has: +When a terminal connects, the BBS reads everything it reports about +itself (its query replies) and uses whatever graphics it has: -| | terminals | used for | +| Feature | Terminals | Used for | |---|---|---| | graphic escape (code page 310) | nearly all: x3270, c3270, wc3270, PCOMM, Vista | the box around the main menu, rules, bar charts in System info; ASCII otherwise; pictures in blocks where there are no vector graphics | | programmed symbols | IBM PCOMM, HostExplorer, Quick3270 | the logo on the logon screen: the system's name in a pixel font, or `tn3270_logo` (a PNG), cut into character cells and loaded as a symbol set; pictures where there are no vector graphics | @@ -41,19 +47,19 @@ query replies) and uses what it has: ### Pictures -An image board's pictures (a post's thumbnail, and the image whole) are -drawn the best way the terminal has, in this order: +Pictures from the image boards (a post's thumbnail, and the full image) +are drawn in the best way the terminal supports, in this order: - **Vector graphics** (PCOMM): the picture as bitmaps, a pel for a pixel, error-diffused to the terminal's own palette: PCOMM's 16 colours (its Graphic Color reply), orange, purple, the dark shades and grey among - them. Each colour is overpainted: PCOMM's exclusive or does not combine - blue with the other colours. The cells under a picture are left empty, + them. Each colour is overpainted: PCOMM's exclusive or does not combine + blue with the other colours. The cells under a picture are left empty, and the cursor elsewhere: on PCOMM a character over a picture clears it in its cell. - **Programmed symbols** (HostExplorer, Quick3270, PCOMM with vector graphics off): the picture cut into character cells, each cell a - symbol, loaded into the terminal's symbol sets before the screen. A set + symbol, loaded into the terminal's symbol sets before the screen. A set holds 190 symbols, so the picture is as large as its cells fit in the sets there are; a blank cell needs no symbol, and cells alike share one. - With **triple-plane (colour) sets**, and the extended Load PS that @@ -75,25 +81,27 @@ drawn the best way the terminal has, in this order: - **Words** on the rest: `[cat.png, 640x480, 52 KB]`, which every terminal shows under the picture too. -A caller can turn pictures off (and on) on their profile (M, or PF11). -The profile's terminal line says which way they are drawn. +A caller can turn pictures off and on in their profile (M, or PF11). The +profile's terminal line shows how they are drawn. PCOMM sends its graphics query replies (the Segment reply that says it -has vector graphics, its colours) only when asked for them by name: the -BBS asks with a Query List for whatever its Summary reply lists that did -not come with the first Query. `cmd/gfxtest` in -[go3270](https://github.com/D-Modem/go3270) is a 3270 server -for trying vector graphics on an emulator, every record both ways logged. +has vector graphics, and its colours) only when they are asked for by +name. So the BBS sends a Query List for anything PCOMM's Summary reply +lists that did not come with the first Query. `cmd/gfxtest` in +[go3270](https://github.com/D-Modem/go3270) is a 3270 server for trying +vector graphics on an emulator, and it logs every record in both +directions. Option T of the 3270 main menu, *Your terminal*, shows what the terminal -reported: code page, cell size, graphic escape, its symbol sets and Load PS -formats, vector graphics, and every query reply in hex. The log has a line -of it for each 3270 that connects. It is the place to start when an -emulator does not show the logo. +reported: its code page, cell size, graphic escape, symbol sets and Load +PS formats, vector graphics, and every query reply in hex. The log has a +line with this for each 3270 that connects. This is the place to start +when an emulator does not show the logo. In PCOMM, programmed symbols and vector graphics need host graphics turned on in the session's configuration, with the native protocol for vector -graphics (see PCOMM's *3270 Emulator User's Reference*, "Host Graphics"). The formats are from IBM's +graphics (see PCOMM's *3270 Emulator User's Reference*, "Host Graphics"). +The formats come from IBM's [3270 Data Stream Programmer's Reference, GA23-0059-07](https://bitsavers.org/pdf/ibm/3174/GA23-0059-07_3270_Data_Stream_Programmers_Reference_199206.pdf) and Greg Price's [3270 Graphics](https://www.prycroft6.com.au/misc/3270grfx.html). diff --git a/docs/wiki/Terminal-Identification.md b/docs/wiki/Terminal-Identification.md index f2ead56..8a37ad0 100644 --- a/docs/wiki/Terminal-Identification.md +++ b/docs/wiki/Terminal-Identification.md @@ -1,9 +1,10 @@ -The BBS asks each caller's terminal what it is, as DEC's terminals were -asked, and adapts to the answer: real VTs (and emulators set up as one) -get their line drawing and character set, monochrome ones bold instead -of color, and a VT52 its own escape codes. What the terminal said shows -in *Who's online* through the [HTTP API](HTTP-API) (`terminal`), in the -caller's profile, and in the log: +The BBS asks each caller's terminal what it is, in the way DEC's terminals +were asked, and adapts to the answer. Real VTs (and emulators set up as +one) get their own line drawing and character set, monochrome terminals +get bold instead of colour, and a VT52 gets its own escape codes. The +terminal's answer appears in *Who's online* through the +[HTTP API](HTTP-API) (`terminal`), in the caller's profile, and in the +log: ``` node 3: terminal VT220 (DA1 62;1;2;6;7;8;9, DA2 1;10;0) @@ -13,49 +14,55 @@ node 5: terminal tmux 3.4 (DA1 1;2;4, DA2 84;0;0, version tmux 3.4) ## The questions -To an ANSI terminal, all at once: +An ANSI terminal is sent all of these questions at once: -| sent | asks | answered by | +| Sent | Asks for | Answered by | |---|---|---| | `ENQ` | the answerback message | terminals with one set (PuTTY says `PuTTY`) | | `CSI c` | primary device attributes (DA1): the VT level and options | every VT100 and later, xterm, most emulators; SyncTERM in its CTerm form | | `CSI > c` | secondary device attributes (DA2): the model and firmware | VT220 and later, xterm, VTE, tmux, screen, mintty | | `CSI > 0 q` | XTVERSION: name and version | xterm, tmux, foot, kitty, WezTerm, iTerm2 | | `CSI 16 t` | the character cell in pixels (for sixel) | xterm and others | -| `CSI 6 n` | the cursor position | every ANSI terminal: once it comes, the rest has | +| `CSI 6 n` | the cursor position | every ANSI terminal; by the time it arrives, the other answers have too | -The position report comes last, so the BBS waits only for it, not for a -timeout, even on a terminal that answers none of the others. To a -terminal that is not ANSI (it did not answer the BBS's first question, -the cursor position) the BBS sends a VT52's identify, `ESC Z`, which a -VT52 answers with `ESC / Z`; any other terminal shows a `Z`, which is -wiped. +The position report comes last, so the BBS waits only for it rather than +for a timeout, even on a terminal that answers none of the others. If a +terminal is not ANSI (it did not answer the BBS's first question, the +cursor position), the BBS sends it a VT52's identify request, `ESC Z`. A +VT52 answers with `ESC / Z`; any other terminal shows a `Z`, which the BBS +then wipes. ## What it is called -In order: XTVERSION's name; SyncTERM by its CTerm attributes; a VT52; a -DEC terminal by its DA2 model (VT100, VT220, VT240, VT320, VT330, VT340, -VT382, VT420, VT510, VT520, VT525, DECterm) with a DEC firmware version; -emulators by their DA2 (tmux, screen, mintty, rxvt, xterm by its patch -number, VTE); the answerback; the VT class from DA1 (VT100, VT102, VT200 -class ... VT500 class). +The BBS names the terminal from the first of these that applies: + +1. the name in its XTVERSION answer; +2. SyncTERM, from its CTerm attributes; +3. a VT52; +4. a DEC terminal, from its DA2 model (VT100, VT220, VT240, VT320, VT330, + VT340, VT382, VT420, VT510, VT520, VT525, DECterm) with a DEC firmware + version; +5. an emulator, from its DA2 (tmux, screen, mintty, rxvt, xterm by its + patch number, VTE); +6. its answerback; +7. the VT class from DA1 (VT100, VT102, VT200 class ... VT500 class). ## What it changes -- **DEC character sets.** A VT (DA1 says VT100 or later) whose terminal +- **DEC character sets.** A VT (DA1 says VT100 or later) whose terminal type does not say UTF-8 and which is not a PC's BBS terminal (`ansi`, `syncterm` and the like, which want CP437) gets line drawing and blocks in DEC Special Graphics (`ESC ( 0`, the `lqkxjm` characters), Latin-1 letters as 8-bit characters on a VT220 or later (DEC Multinational has them) on an 8-bit line, and ASCII look-alikes for - the rest. ANSI art in CP437 is drawn the same way. Typed Latin-1 - letters are read as such. The profile says `DEC graphics`. -- **Monochrome.** A DEC terminal by its model and firmware (not an - emulator) without ANSI color (DA1 option 22) — VT100 to VT520 — gets - bold for the bright colors and plain text for the rest. + the rest. ANSI art in CP437 is drawn the same way. Typed Latin-1 + letters are read as such. The profile says `DEC graphics`. +- **Monochrome.** A DEC terminal by its model and firmware (not an + emulator) without ANSI colour (DA1 option 22), from the VT100 to the + VT520, gets bold for the bright colours and plain text for the rest. - **Sixel** is known from DA1 option 4 (a VT240, VT330, VT340, xterm with it on, foot, WezTerm, mlterm), and the cell size from `CSI 16 t`. -- **VT52.** A VT52 (or a VT100 in VT52 mode) gets clearing and cursor +- **VT52.** A VT52 (or a VT100 in VT52 mode) gets clearing and cursor movement as `ESC H`, `ESC J`, `ESC K`, `ESC Y`, `ESC A`-`D`, no attributes, ASCII only; its cursor and keypad keys are not taken as commands. @@ -69,15 +76,15 @@ address = 127.0.0.1:2323 vt = no ``` -`vt = no` asks nothing (sixel is then asked for by DA1 alone, as before) -and changes nothing; `auto` (the default) asks. +With `vt = no` the BBS asks none of these questions and changes nothing +(it still checks for sixel with DA1 alone). `auto`, the default, asks. ## What a caller sets -What a caller switches in their profile is kept with their account and -begins their next call: +Settings a caller changes in their profile are kept with their account +and apply from their next call: -| setting | values | at the next call | +| Setting | Values | At the next call | |---|---|---| | `ansi` | `on`, `off` | ANSI as they set it, whatever the terminal answered (`off` turns RIP off too) | | `utf8` | `on`, `off` | UTF-8, or CP437 (ASCII where there is no ANSI) | @@ -87,8 +94,8 @@ begins their next call: | `editor` | `full`, `line` | the full-screen editor or the line editor | | `expert` | `on`, `off` | menus as their prompt alone, `?` for the rest | -A Commodore and a VT52 take only what applies to them. The settings are -`prefs` at `GET /api/v1/me`, changed with `PATCH /api/v1/me` -([HTTP API](HTTP-API)). +A Commodore or a VT52 uses only the settings that apply to it. The +settings appear as `prefs` at `GET /api/v1/me` and are changed with +`PATCH /api/v1/me` (see [HTTP API](HTTP-API)). **See also:** [PETSCII and RIP](PETSCII-and-RIP), [Sixel graphics](Sixel-Graphics), [Configuration](Configuration) diff --git a/docs/wiki/Web-Forum.md b/docs/wiki/Web-Forum.md index 11b5bff..a9952c6 100644 --- a/docs/wiki/Web-Forum.md +++ b/docs/wiki/Web-Forum.md @@ -1,5 +1,3 @@ -# Web forum - The HTTP API's server also serves the message areas as a web forum, at `/forum/` (and `/`, which goes there). It is laid out like the bulletin boards of their day: categories of forums, topics, and posts with their @@ -20,7 +18,7 @@ address = :8443 ;forum_flags = yes ``` -| setting | default | | +| Setting | Default | What it sets | |---|---|---| | `forum` | `yes` | the forum at `/forum/` (with `no`, `/` goes to the web terminal again) | | `forum_guests` | `yes` | those not logged in may read the areas anyone may read (areas with a `read` requirement never) | @@ -29,7 +27,7 @@ address = :8443 ## The pages -| | | +| Page | What it shows | |---|---| | `/forum/` | the board: the areas by their group (the areas' `group`, else *Message Areas*), each with its topics, replies, newest post and whether it has any new; the board's statistics; who is online | | `/forum/area/N` | an area's topics, newest activity first, 20 to a page; *Mark this forum read* | @@ -88,7 +86,7 @@ while flags are shown. Behind a reverse proxy, name it in ## Themes -| theme | | +| Theme | What it looks like | |---|---| | `ipb3` | the default: a board of the early 2010s in the manner of Invision Power Board 3: a dark user bar, a navy header with tabs, rounded blue category bars, posts with their author's column on the left | | `phpbb33` | prosilver as phpBB 3.3 kept it: the 3.2 look, its list headings a little taller (3.3 changed little else) | @@ -106,7 +104,7 @@ while flags are shown. Behind a reverse proxy, name it in | `xf2` | xen: a PHP board of 2017-2023 in the manner of XenForo 2's default style: a deep blue head, a lighter blue navigation bar whose chosen tab opens onto a pale row of section links, flat white blocks with blue-tinted heads, forums with comment icons that turn bright blue when unread and *Threads* / *Messages* stacked beside them, a side column with *Members online* and *Forum statistics*, an orange *Post thread* button, posts with the poster in a tinted cell and *Like* and *Reply* beneath, a dark foot | | `xf1` | classic: a PHP board of 2010-2017 in the manner of XenForo 1's default style: a deep navy head, tabs opening onto a pale blue row of links, a breadcrumb of arrow-ended crumbs, blue gradient category strips, speech-bubble forum icons with *Discussions* and *Messages* beneath, *Members Online Now*, posts with the poster in a pale box whose arrow points at the message, *Discussion in '…' started by …*, a blue *Post New Thread* pill | | `mybb18` | flat: MyBB 1.8's default look over the earlier pages (the mybb16 theme's): a white head with the board's name and linked icons, a black glossy bar with search and welcome over a grey row of the member's links, rounded tables with deep blue heads and black glossy column rows, speech-bubble forum icons, posts with the author in a grey band across the top and their counts at the right, black buttons, a grey two-tier foot | -| `mybb16` | classic: MyBB 1.4 and 1.6's default look, 1.2's pages and colors (the mybb12 theme's) with each post a table of its own: a pale blue strip with the date and *Post: #1*, the author across the top with picture, title and stars and the counts at the right, quotes in plain boxes | +| `mybb16` | classic: MyBB 1.4 and 1.6's default look, 1.2's pages and colours (the mybb12 theme's) with each post a table of its own: a pale blue strip with the date and *Post: #1*, the author across the top with picture, title and stars and the counts at the right, quotes in plain boxes | | `mybb12` | original: a PHP board of 2005-2008 in the manner of MyBB 1.0 and 1.2's default theme: a white frame on a light grey page, the board's name with a bold menu at the right, a grey *Welcome back* panel, tables in a steel-blue border with blue gradient heads and pale blue column rows over two greys, round forum lamps, *Board Statistics*, posts as rows with the author on the left and the date beneath, dashed quote boxes | | `pun14` | oxygen 2: PunBB 1.3 and 1.4's Oxygen, a lighter look over pages of its own: a grey head with the board's name, a blue bar of links and a white welcome strip, each forum list and topic in a box with a blue head and a grey row naming the columns, bevelled square forum icons, posts with a grey *Reply by* strip and the date at the right, the author with picture and counts at the left, *Profile*, *Like* and *Quote* in a row beneath, *Quick reply* at the foot | | `flux15` | air: FluxBB 1.4 and 1.5's Air over PunBB 1.2's pages (the pun12 theme's): a white rounded frame on a pale blue page, a slate-blue menu of tabs, teal headings over pale blue column rows, posts in pale blue with the author at the left, quotes in pale yellow boxes, Arial | @@ -130,7 +128,7 @@ they recall; no code or images are taken from them. `forum_theme` is the forum's; anyone (guests too) may choose another at the foot of every page, kept in a cookie (`bbs_forum_theme`) for a year. A theme lays out the board, topic lists, topics and profiles its own way, and shows the rest -(posting, searching, signing in) in its colors. A theme may build on another's templates (the phpBB 3.2 and 3.3 themes wear 3.1's, vBulletin 6's wears 5's, SMF 3.0's and 2.1's wear Curve's, XenForo 2.3's wears 2's, MyBB 1.8's wears 1.6's, which wears 1.2's, FluxBB 1.5's wears PunBB 1.2's, and YaBB 2.5's wears 2's, which wears 1's, with stylesheets of their own). +(posting, searching, signing in) in its colours. A theme may build on another's templates (the phpBB 3.2 and 3.3 themes wear 3.1's, vBulletin 6's wears 5's, SMF 3.0's and 2.1's wear Curve's, XenForo 2.3's wears 2's, MyBB 1.8's wears 1.6's, which wears 1.2's, FluxBB 1.5's wears PunBB 1.2's, and YaBB 2.5's wears 2's, which wears 1's, with stylesheets of their own). ## Logins @@ -148,7 +146,7 @@ asks *Your profile*, `C` (PF10), for a sign-in code: eight letters and digits, `ABCD-EFGH`, good once, for five minutes; a new one ends the last. The Sign In page takes the code alone, with no name or password: a password typed nowhere on the machine at hand, or for a user whose -password is modemmenu's. Anywhere else a password is asked (the web +password is modemmenu's. Anywhere else a password is asked (the web terminal, the image boards, the API, FTP), the code serves once for the password, with the user's name. diff --git a/docs/wiki/Writing-Messages.md b/docs/wiki/Writing-Messages.md index 30959ca..82b84c0 100644 --- a/docs/wiki/Writing-Messages.md +++ b/docs/wiki/Writing-Messages.md @@ -1,7 +1,7 @@ -Posts and mail are written in one of three editors, by terminal: the -full-screen editor on ANSI terminals, the line editor on the rest, and -the 3270's editor screen. First come `To` (Enter keeps what is offered) -and `Subject`. +Posts and mail are written in one of three editors, depending on the +terminal: the full-screen editor on ANSI terminals, the line editor on +other text terminals, and the editor screen on a 3270. Each one first asks +for `To` (Enter keeps what is offered) and `Subject`. ## The full-screen editor @@ -21,7 +21,7 @@ _ ^Z save ^X give up ^Y delete line ^L redraw ^Q quote 4/5 ``` -| key | | +| Key | What it does | |---|---| | typing | goes in at the cursor; a word that passes the edge wraps to the next line | | cursor keys, Home, End, PgUp, PgDn | move about | @@ -33,16 +33,17 @@ _ | ^X (or ^A) | give up, after a Y | | ^L | draw the screen again | -Lines are at most 79 characters (less on a narrower screen), and a -message at most as many lines as the line editor takes. Messages from -other nodes wait until the message is saved. +Lines can be up to 79 characters (fewer on a narrower screen), and a +message can have as many lines as the line editor allows. Messages from +other nodes are held until the message is saved. ## The line editor -On other terminals, or by choice: each line is typed and sent with -Enter, a word wrapping at the edge. On a line of its own: +The line editor is used on other terminals, or by choice. Each line is +typed and sent with Enter, and words wrap at the edge. These commands work +on a line of their own: -| | | +| Command | What it does | |---|---| | `/S` | save | | `/A` | give up | @@ -50,16 +51,16 @@ Enter, a word wrapping at the edge. On a line of its own: | `/D` | delete the last line | | `/C` | clear all | -A reply begins with the message replied to, quoted. +A reply starts with the message being answered, quoted. ## Choosing -`[E]ditor full/line` in *Your profile* switches between them on an ANSI -terminal, and the choice is kept ([`editor`](Terminal-Identification#what-a-caller-sets)). +On an ANSI terminal, `[E]ditor full/line` in *Your profile* switches +between the two editors, and the choice is kept ([`editor`](Terminal-Identification#what-a-caller-sets)). ## On a 3270 -The editor screen: `To`, `Subject`, and a screen of lines to type in; -PF5 sends, PF3 gives up. A reply begins with its quote. +A 3270 has an editor screen with `To`, `Subject` and a screen of lines to +type in. PF5 sends and PF3 gives up. A reply starts with its quote. **See also:** [TN3270](TN3270), [Terminal identification](Terminal-Identification)