====== Running a hub ======

This page is for sysops who want to host games for other BBSes. A hub is the ''doorhub'' program plus a Synchronet BBS on the same machine where the games run (the **door BBS**).

===== How a hub works =====

<code>
 member BBS --RLogin--> connector ==SSH tunnel==> hub --RLogin--> door BBS
 (caller)               (member's machine)        (doorhub)      (your Synchronet)
</code>

  * Each member BBS has a hub account: an SSH user name and password, and a system tag. The hub accepts only RLogin tunnels on these accounts. There is no shell, no file access and no other forwarding.
  * The member BBS sends the caller's password, ''[TAG]Name'' and a game code. The hub checks that the tag belongs to the account that logged in.
  * The hub keeps its own list of players. The first time it sees ''[TAG]Name'' it makes a user on your Synchronet called ''Name (TAG)'', with a random password only the hub knows.
  * It logs that user in to your Synchronet by RLogin with the terminal type ''xtrn=CODE''. Synchronet's ''logon.js'' runs that door straight away and hangs up when it ends, so the player never sees your BBS's menus.
  * After a game the player goes back to their BBS, or back to the hub menu if they came through it.

All the hub's data is in one folder:

^ File ^ What it holds ^
| ''hub.json'' | settings, member BBSes, games |
| ''players.json'' | players: names, door BBS users and passwords, play counts |
| ''host_ed25519'' | the hub's SSH host key. Back it up. |
| ''mkuser.js'' | written by the hub each time it starts; makes users with jsexec |
| ''doorhub.log'' | the log, when the hub runs as a Windows service |

===== What you need =====

  * **Linux** (x64 or arm64) or **Windows** (64-bit) with a **Synchronet BBS on the same machine**. Door Hub was built and tested with Synchronet 3.22; any recent version with ''rlogin_auto_xtrn'' in ''logon.js'' works. This can be your main BBS or a separate one just for the hub.
  * The doors you want to share, installed and working on that BBS.
  * For members outside your network: a fixed internet address or a DNS name, and one TCP port forwarded to the hub (2022 by default). See [[doorhub:internet_and_security|Internet and security]].
  * **Permission to share each door.** Your own doors and free software are fine. Check the licence of commercial doors: some registrations cover one BBS only.

===== Prepare the door BBS =====

**1. Turn on RLogin.** In ''ctrl/sbbs.ini'', section ''[BBS]'', make sure ''Options'' includes ''ALLOW_RLOGIN'' and ''RLoginPort'' is set:

<code ini>
[BBS]
	RLoginPort = 513
	Options = XTRN_MINIMIZED | ALLOW_RLOGIN | ALLOW_SSH
</code>

The hub connects from the same machine (127.0.0.1). Port 513 does **not** need to be open to the internet.

**2. Turn on direct-to-door logins.** In ''ctrl/modopts.ini'', section ''[logon]'':

<code ini>
[logon]
	rlogin_auto_xtrn = true
</code>

**3. Check each door you want to share.** It needs an **Internal Code** (SCFG, External Programs, Online Programs) and must be usable by a new user:

  * The section's and the program's **Access Requirements** must allow a new user. Blank, ''ANSI'' or ''NOT GUEST'' are fine; ''SYSOP'' is not.
  * Hub players are made with your BBS's normal new-user settings (security level, flags, time per day). If you limit new users, hub players are limited the same way.
  * It doesn't matter which section a door is in: the hub starts it by its Internal Code. You can put the shared doors in their own section.
  * Multi-node doors need **Multiple Concurrent Users** set, as for any busy BBS.

**4.** Restart Synchronet (or let it recycle) after changing ''sbbs.ini'' or ''modopts.ini''.

Your BBS's new-user questions don't affect hub players: the hub makes them with ''jsexec'', not through the new-user form.

===== Install the hub =====

  * [[doorhub:hub_linux|Hub on Linux]]
  * [[doorhub:hub_windows|Hub on Windows]]

Then add [[doorhub:games|games]] and [[doorhub:member_bbses|member BBSes]], and open it to the internet ([[doorhub:internet_and_security|Internet and security]]).

===== Try it yourself first =====

Before you invite anyone, add your own BBS as a member: ''doorhub bbs add'' a tag for it, run a connector on the same machine using the ini it prints (with ''ssh_host = 127.0.0.1''), add a ''?doorhub.js'' door with Access Requirements ''SYSOP'', and play each game through the hub. That's how the Kalgoorlie Door Hub was tested.
