A Synchronet services.ini service that lets BinktermPHP remotely
provision (or verify) Synchronet user accounts, so BinktermPHP users can be handed off into
Synchronet doors/games via RLogin, without a manual signup step.
One TCP connection = one request/response, then the connection closes. Every request carries
an action field; it may be omitted, in which case it defaults to provision (the only
action this protocol had before list_doors was added).
Request:
{"action":"provision","api_key":"<shared secret>","username":"awehttam","real_name":"...","location":"..."}real_name and location are optional. When present they're applied to the account, both
on creation and on an existing-account sync call.
Response (success):
{"success":true,"username":"awehttam","user_number":42,"created":true}created is false if the account already existed and the call was just a sync/lookup.
Response (failure):
{"success":false,"error":"reason"}Lists installed external programs (doors) so BinktermPHP can offer a one-click import into its own RLogin door configuration.
Request:
{"action":"list_doors","api_key":"<shared secret>"}Response (success):
{"success":true,"doors":[{"code":"lord","name":"Legend of the Red Dragon","sec_code":"games","sec_name":"Games","description":"...","author":"...","categories":["Games","RPG"]}]}code is the door's internal xtrn program code -- the value BinktermPHP needs for the rlogin
door's Terminal Type field (xtrn=<code>) so Synchronet's door server routes straight into
that program. Not yet exercised against a live install; see the note in
binkterm_sync_service.js if this comes back empty.
description, author, and categories are best-effort: Synchronet's own xtrn.ini record
has no such fields, so the service opportunistically re-reads the door's install-xtrn.ini
(the Desc:/By:/Cats:/Subs: header lines most doors were installed from) and includes
whatever it finds. They're simply omitted for doors with no install-xtrn.ini on disk.
Response (failure):
{"success":false,"error":"reason"}-
Copy
binkterm_sync_service.jsto your Synchronetexec/ormods/directory. -
Copy
binkterm_sync_service.ini.exampletoctrl/binkterm_sync_service.iniand edit it -- at minimum, setapi_keyto a long random value shared with BinktermPHP, and add BinktermPHP's IP address(es) totrusted_ips. Also reviewdefault_security_level(defaults to50), theUser.levelassigned to newly created accounts. Keeping these settings inctrl/binkterm_sync_service.iniinstead of hand-editing the script means a later update tobinkterm_sync_service.js(e.g. agit pull) never loses your configuration -- see the comments in the.ini.examplefile for the full key list. -
Add a section to
ctrl/services.ini, e.g.:[binkterm_sync] Port = 24512 Command = binkterm_sync_service.js MaxClients = 5 Options = TLS
Options = TLSis required to match BinktermPHP's client, which defaults to requiring TLS on this connection -- see the TLS section below. Do not setSTATIC/LOOPinOptions; those are for long-running single-instance services (e.g.ircd.js) that manage their own client loop, not the one-thread-per-connection model this script expects. -
Connections from any IP not listed in
trusted_ipsare rejected before the request body is parsed. The IP allowlist and API key are defense-in-depth, not a substitute for firewalling the port. -
Restart (or reload) the Services server.
ctrl/binkterm_sync_service.iniitself, once step 2 is done, is re-read on every connection -- only changes to the script's own code require a Services server restart, not config-only changes.
BinktermPHP's client defaults to requiring TLS on this connection. To match, add
Options = TLS to the services.ini section:
[binkterm_sync]
Port = 24512
Command = binkterm_sync_service.js
MaxClients = 5
Options = TLSThe Services server terminates TLS before binkterm_sync_service.js ever sees the socket, so
no changes to the script itself are needed. It uses the same certificate/key as every other
TLS-enabled Synchronet service (ctrl/ssl.cert), configured under SCFG -> System -> Security
-- generate a self-signed certificate there if you don't already have one.
On the BinktermPHP side, "tls": true in config/rlogin_synchronet_service.json is the default
(it applies even if the key is left out of the file entirely) -- no changes are needed there
unless you're deliberately running without TLS, in which case set "tls": false explicitly and
leave Options = TLS off here too. BinktermPHP's client accepts a self-signed certificate by
default ("tls_verify_peer": false), since this is typically a LAN/localhost link between two
systems the same sysop controls; set "tls_verify_peer": true (and optionally "tls_cafile")
for strict verification against a CA-signed certificate instead. Whichever you choose, Options
here and BinktermPHP's tls setting must agree -- a TLS client cannot reach a plaintext-only
service, or vice versa.
Accounts provisioned by this service are meant to be reached via a trusted RLogin handoff from BinktermPHP, since RLogin itself does no authentication -- whoever can connect as a given username is logged in as that user, no password required.
Restrict ctrl/rlogin.cfg to only the IP address(es) BinktermPHP connects from (one
per line; wildcards * are allowed). Any address not listed there must not be able to
reach your BBS's RLogin port at all -- firewall it in addition to the allowlist. Treat
this the same way as TRUSTED_IPS above: both lists need to be kept in sync and both
are defense-in-depth around network restriction, not a replacement for it.
MIT -- see LICENSE.