===============================================================================
                       RGTEL v2.00 for Windows and Linux
              Telnet and SSH gateway / node server for DOS and Win32 BBSes
                         (c) 2026 NewWave Software
===============================================================================

 CONTENTS
   1.  What RGTEL is
   2.  The files
   3.  How a call goes through RGTEL
   4.  Quick start (Windows)
   5.  Quick start (Linux)
   6.  RGTEL.INI - every setting
   7.  The Command line - starting a node
   8.  Example setups
   9.  The bot blocker (BotGate) and the screens callers see
  10.  Protection: bans, rate limits, blacklist, whitelist
  11.  SSH
  12.  The RGTEL screen and keys
  13.  The log
  14.  Running RGTEL as a service / in the background
  15.  Troubleshooting


===============================================================================
 1. WHAT RGTEL IS
===============================================================================

 RGTEL answers telnet (and optionally SSH) callers on the Internet and hands
 each one to your BBS as a node, the way a front end answered modem calls on
 a 1990s BBS. It:

   * listens on the telnet port (and the SSH port, if switched on),
   * keeps bots and port scanners out with a short "press ESC twice"
     challenge (BotGate),
   * temp-bans and blacklists addresses that hammer the board,
   * picks a free node number and starts your BBS (or a batch file) with
     the caller's socket, node number and IP address,
   * shows everything live in a full-screen log window.

 RGTEL works with RGFOSSIL (or NetFoss) for DOS BBSes under NTVDM, with
 Renegade's own socket support (RG32.EXE / Linux RENEGADE -H), and with any
 DOOR32-style program that takes a socket handle.


===============================================================================
 2. THE FILES
===============================================================================

   RGTEL.EXE          the Windows program (32-bit)
   rgtel              the Linux program (x86-64)
   RGTEL.INI          the configuration (see section 6) - must be next to
                      the program.  RGTEL-LINUX.INI is a sample for Linux:
                      rename it to RGTEL.INI.
   libcrypto-3.dll    OpenSSL 3 crypto library, needed only for SSH on
                      Windows - keep it next to RGTEL.EXE
   README-LINUX.TXT   short notes for the Linux version
   RGTEL.TXT          this manual

 Files you may add next to the program:

   CONNECT.ANS        shown to a caller who passes the bot blocker,
                      just before the BBS starts
   ERROR.ANS          shown to a caller who presses the wrong key at the
                      bot blocker
   GOODBYE.ANS        shown to a caller who lets the bot blocker time out
   blacklist.txt      addresses that are always refused (section 10)

 Files RGTEL makes itself:

   telnet.log         the log (name set by Log=), and telnet.log.bak when
                      the log is rolled (LogMaxKB=)
   RGTEL_ED25519.KEY  the SSH host keys, made on the first run with SSH on.
   RGTEL_RSA.KEY      Keep them: callers' SSH programs remember them.


===============================================================================
 3. HOW A CALL GOES THROUGH RGTEL
===============================================================================

   caller connects (telnet port, or SSH port)
        |
        |  1. Whitelisted?        -> skip steps 2-5
        |  2. Temp-banned?        -> dropped
        |  3. Blacklisted?        -> "Access Denied. -Click!-", dropped
        |  4. Too many connects in RateWindow seconds?  -> temp-banned
        |  5. More than MaxSameIP connections from this IP? -> temp-banned
        |  6. Any node free?      -> if not: "All Nodes Are BUSY ..."
        |  7. BotGate: "Press <ESC> twice for the BBS ..." (15 seconds)
        |        wrong key  -> ERROR.ANS, hung up
        |        no answer  -> GOODBYE.ANS, hung up
        |        ESC ESC    -> "Loading!", CONNECT.ANS
        |  8. A node number is chosen (lowest free one)
        v
   Command= is started for that node, with *N, *H and *I filled in
   and SOCKET / NFNODE set in its environment.

 When the node program exits, the node is free again. Any number of nodes
 (up to 256) run side by side.


===============================================================================
 4. QUICK START (WINDOWS)
===============================================================================

 1. Make a folder, e.g. D:\RGTEL, and copy RGTEL.EXE and RGTEL.INI into it
    (and libcrypto-3.dll if you want SSH).

 2. Edit RGTEL.INI. The lines that matter most:

      Port      = 23
      StartNode = 1
      Nodes     = 4
      StartPath = D:\RGFOSSIL
      Command   = D:\RGFOSSIL\RGFOSSIL.BAT /N*N /H*H D:\BATCH\TEL2RG.BAT *N *H *I

    (That is the RGFOSSIL setup; section 8 has others.)

 3. Allow RGTEL through the Windows firewall (Windows asks the first time
    it opens the port) and forward port 23 on your router to this PC.

 4. Start RGTEL.EXE from its own folder (double-click it, or a shortcut
    whose "Start in" is D:\RGTEL). The screen shows the settings it read,
    then "RGTEL Waiting For A Connection".

 5. Test from the same PC:   telnet 127.0.0.1
    Press ESC twice at the prompt and your BBS should start as node 1.


===============================================================================
 5. QUICK START (LINUX)
===============================================================================

 1. Make a folder, e.g. /home/bbs/rgtel, put rgtel in it and rename
    RGTEL-LINUX.INI to RGTEL.INI.

 2. Edit RGTEL.INI, for example for Linux Renegade:

      Port       = 2323
      StartPath  = /home/bbs/renegade
      Command    = /home/bbs/renegade/RENEGADE -H*H -N*N -B115200 -Q
      NodeTelnet = 1

 3. Ports below 1024 (23, 22) need root, or give the program just that one
    permission:

      sudo setcap cap_net_bind_service=+ep ./rgtel

    (do it again whenever you replace the rgtel file)

 4. Start it:

      cd /home/bbs/rgtel && ./rgtel              full-screen view
      cd /home/bbs/rgtel && ./rgtel --headless   plain log lines only

    Headless mode is used automatically when the output is not a terminal
    (systemd, nohup, output redirected to a file).

 5. Test:   telnet 127.0.0.1 2323


===============================================================================
 6. RGTEL.INI - EVERY SETTING
===============================================================================

 All settings go under [Settings]. Spaces around "=" are fine. Everything
 after a ";" is a comment - even inside Command=, so a Command line can't
 contain ";" (on Linux use && or a small script instead).

 1 = on, 0 = off.

 --- Ports and nodes ---------------------------------------------------------

   Port=23           Telnet port.
   StartNode=1       First node number RGTEL hands out.
   Nodes=4           How many nodes. With StartNode=3 and Nodes=4, callers
                     get nodes 3, 4, 5 and 6.
   HighNodeIPs=      Comma-separated addresses (for example the fTelnet web
                     terminal proxies) that get the HIGHEST free node
                     instead of the lowest, so ordinary callers keep
                     getting node 1, 2, 3 ... from the bottom up.
                       HighNodeIPs = 168.235.108.229, 168.235.86.87

 --- Starting the node -------------------------------------------------------

   Command=          The program or batch file to start for each caller,
                     with *N, *H and *I (section 7). Required - RGTEL will
                     not start without it.
   StartPath=        The folder the node program starts in. Default: the
                     RGTEL folder.
   NodeTelnet=0      1 = just before the node starts, switch the caller's
                     telnet program to character mode with RGTEL echoing
                     (WILL ECHO, WILL SGA, DO SGA). Use 1 for programs that
                     read the socket themselves and do no telnet
                     negotiation: Renegade -H (RG32.EXE, Linux RENEGADE).
                     Use 0 for RGFOSSIL, NetFoss and other drivers that do
                     their own.
   Nodeview=1        (Windows) How node windows open:
                       0 = hidden    1 = normal
                       2 = minimized 3 = maximized
                     Restart (R) also opens the new RGTEL window this way.
   CloseToTray=0     (Windows) 1 = RGTEL's own window runs in the system
                     tray. Click the tray icon to bring it back. Node
                     windows still follow Nodeview.
   NodeStdio=0       (Linux) 1 = give the node the caller's connection on
                     standard input/output (inetd style); *H and SOCKET
                     are then 0.
   NodeKillMs=500    (Linux) On shutdown each node gets a hang-up signal,
                     then is killed after this many milliseconds.

 --- Protection (section 10) -------------------------------------------------

   MaxSameIP=2       Most connections allowed at once from one address
                     (nodes in use plus callers still at the bot blocker).
                     One more gets a temp-ban. 0 = no limit.
   RateWindow=30     Seconds the connection counter looks back. Never less
                     than 15.
   RateMaxConn=4     Connections from one address within RateWindow that
                     earn a temp-ban. 0 = no rate limit.
   BanDuration=300   Length of a temp-ban in seconds. 0 = no temp-bans.
   AutoBlacklistHits=0
                     After this many temp-bans the address is added to the
                     blacklist for good. 0 = never.
   AutoRestartOnBlacklist=1
                     1 = restart RGTEL by itself after an address is
                     blacklisted, so the new entry takes hold (waits until
                     all nodes are free). 0 = restart by hand.
   Blacklist=blacklist.txt
                     The blacklist file (section 10).
   Whitelist=        Comma-separated addresses that skip all bans and
                     limits:   Whitelist = 192.168.1.10, 10.0.0.5
   BypassGate=0      1 = whitelisted addresses also skip the "press ESC
                     twice" prompt.

 --- SSH (section 11) --------------------------------------------------------

   SSH=0             1 = also take SSH callers.
   SshPort=22        SSH port (Linux default 2222). Must not be the telnet
                     port.
   SshTimeout=30     Seconds a caller has to finish the SSH login (min 5).
   SshNodeRaw=       1 = the node program does no telnet (Renegade -H);
                     0 = RGFOSSIL / NetFoss. Default: same as NodeTelnet.

 --- Log (section 13) --------------------------------------------------------

   Log=telnet.log    The log file.
   LogMaxKB=0        When the log reaches this many KB it is renamed to
                     telnet.log.bak and a new one is started. 0 = no limit.
   Debug=0           1 = also log every command line started, every rate
                     check and every whitelist pass.

 Blacklist= and Log= names without a folder are in the folder RGTEL was
 started from - so start RGTEL from its own folder. The .ANS files and
 RGTEL.INI are always read from the program's folder.


===============================================================================
 7. THE COMMAND LINE - STARTING A NODE
===============================================================================

 In Command= RGTEL replaces:

   *N   the node number                 (e.g. 1)
   *H   the caller's socket handle      (e.g. 228)
   *I   the caller's IP address         (e.g. 73.174.148.143)

 and sets these in the node's environment:

   SOCKET      the socket handle  (same as *H)
   NFNODE      the node number    (same as *N)
   REMOTEHOST  the caller's IP    (Linux)

 RGFL (RGFOSSIL) and NetFoss's NFU need SOCKET and NFNODE; RGTEL sets them
 for you.

 Windows: Command= is started as a program in StartPath. A .BAT file works
 directly. The node keeps the caller's connection until it exits; closing
 RGTEL closes all its nodes too.

 Linux: Command= is run through /bin/sh -c in StartPath. Each node runs in
 its own process group and gets SIGHUP (a "carrier drop") when RGTEL shuts
 down.


===============================================================================
 8. EXAMPLE SETUPS
===============================================================================

 --- DOS BBS with RGFOSSIL (Windows, 32-bit NTVDM) --------------------------

   StartPath  = D:\RGFOSSIL
   Command    = D:\RGFOSSIL\RGFOSSIL.BAT /N*N /H*H D:\BATCH\TEL2RG.BAT *N *H *I
   NodeTelnet = 0

   RGFOSSIL.BAT loads the FOSSIL driver for the node and runs your BBS
   batch (TEL2RG.BAT) with %1 = node, %2 = socket, %3 = IP. See
   RGFOSSIL.TXT.

 --- The same on 64-bit Windows with NTVDMx64 --------------------------------

   Command    = D:\RGFOSSIL\RGFOSSIL64.BAT /N*N /H*H D:\BATCH\TEL2RG.BAT *N *H *I

 --- DOS BBS with NetFoss ----------------------------------------------------

   StartPath  = D:\NETFOSS
   Command    = D:\NETFOSS\NF.BAT /N*N /H*H D:\BATCH\TEL2RG.BAT *N *H *I
   NodeTelnet = 0

 --- Renegade RG32.EXE (Windows), no FOSSIL ---------------------------------

   StartPath  = C:\RG
   Command    = C:\RG\RG32.EXE -H*H -N*N -B115200 -Q
   NodeTelnet = 1

 --- Renegade for Linux ------------------------------------------------------

   StartPath  = /home/bbs/renegade
   Command    = /home/bbs/renegade/RENEGADE -H*H -N*N -B115200 -Q
   NodeTelnet = 1

   For Renegade: -H gives it the socket, -N the node, -B a connect speed
   (without it Renegade waits for a modem call) and -Q makes it exit when
   the caller logs off.

 --- A Win32 (DOOR32) program -----------------------------------------------

   Command    = D:\DOORS\GAME32\GAME32.EXE -H*H -N*N

   (use whatever switches that program takes for the socket and node)


===============================================================================
 9. THE BOT BLOCKER (BOTGATE) AND THE SCREENS CALLERS SEE
===============================================================================

 Every caller (unless whitelisted with BypassGate=1) first sees:

   Renegade Bot Blocker v2.00

   Press <ESC> twice for the BBS ... 15

 The number counts down from 15 seconds.

   * ESC ESC        "Loading!", then CONNECT.ANS, then the BBS starts.
   * Any other key  "Click!", ERROR.ANS, and the caller is hung up.
   * Time runs out  "Click!", GOODBYE.ANS, and the caller is hung up.

 Scripts and bots that blindly send text or log-in strings fail the test;
 people get in with two key presses. Draw your own CONNECT.ANS, ERROR.ANS
 and GOODBYE.ANS in any ANSI editor and keep them next to the program. A
 missing file is simply skipped.

 Other messages a caller can see:
   All Nodes Are BUSY. Please Try Again Shortly!
   Access Denied. -Click!-                       (blacklisted)
   Connection Rate Exceeded. Try Again Later.    (rate limit / MaxSameIP)


===============================================================================
 10. PROTECTION: BANS, RATE LIMITS, BLACKLIST, WHITELIST
===============================================================================

 Temp-ban
   An address is temp-banned for BanDuration seconds when it
     * connects RateMaxConn times within RateWindow seconds, or
     * opens more than MaxSameIP connections at once.
   While banned its connections are dropped without a word.

 Blacklist (permanent)
   blacklist.txt holds one IP address per line, for example:

     45.155.205.12
     185.220.101.4

   Blacklisted callers get "Access Denied. -Click!-" and are dropped.
   With AutoBlacklistHits=3, an address temp-banned 3 times is added to the
   file automatically. RGTEL reads the file when it starts, so after editing
   it by hand press R (restart). Automatic additions restart RGTEL by
   themselves (AutoRestartOnBlacklist=1) as soon as no node is in use.

 Whitelist
   Addresses in Whitelist= are never banned, rate-limited or blacklisted.
   Put your own home/office address and any web-terminal proxy you trust
   here. With BypassGate=1 they skip the ESC ESC prompt too.

 Suggested starting values

   MaxSameIP=2  RateWindow=30  RateMaxConn=4  BanDuration=300
   AutoBlacklistHits=3  AutoRestartOnBlacklist=1


===============================================================================
 11. SSH
===============================================================================

 RGTEL can take SSH callers on a second port next to telnet. The BBS needs
 no changes: SSH callers go through the same bans, limits, BotGate and
 CONNECT.ANS, and get a node exactly like telnet callers.

   SSH        = 1
   SshPort    = 22          (Linux: 2222, or 22 with setcap / root)
   SshTimeout = 30
   SshNodeRaw = 1           (Renegade -H)   or 0 (RGFOSSIL / NetFoss)

 Needs OpenSSL 3's crypto library:
   Windows:  libcrypto-3.dll next to RGTEL.EXE (the 32-bit one)
   Linux:    libcrypto.so.3 (package libssl3 / openssl - normally there)
 If it can't be loaded, RGTEL says so in the log and runs telnet only.

 * Any user name and password are accepted - the BBS does the real login.
 * The host keys RGTEL_ED25519.KEY and RGTEL_RSA.KEY are made on the first
   run. Keep them: if they change, callers get a "host key changed"
   warning. Their fingerprints are in the log at start-up.
 * Works with OpenSSH, PuTTY, SyncTERM, NetRunner and other SSH clients.
   The caller's window size is passed on, and the terminal type is ANSI.

 Callers connect with, for example:   ssh -p 2222 anyname@your.bbs.host


===============================================================================
 12. THE RGTEL SCREEN AND KEYS
===============================================================================

 The screen shows a title line, then the log as it happens, in columns
 Date / Time / Activity. Long lines wrap at word boundaries. Colors:

   red       blocked, denied, banned, hung up, timed out, wrong key
   green     passed, node started
   yellow    shutdown
   cyan      RGTEL start-up and listening messages
   magenta   node being started
   white     everything else

 Keys
   ALT+X                   Shut down: hang up every node and exit
   R                       Restart: shut down, re-read RGTEL.INI and
                           blacklist.txt, and start again
   Up / Down               scroll the log one line
   PgUp / PgDn             scroll a page
   Home / End              top / bottom (End returns to live view)

 On Linux, Ctrl+C, SIGTERM and SIGHUP also shut down safely. A restart on
 Linux keeps the same terminal and process ID.

 Change RGTEL.INI while RGTEL is running, then press R to use it.


===============================================================================
 13. THE LOG
===============================================================================

 Every line on the screen is also written to the log file with its date and
 time. Lines to look for:

   BotGate: <ip> Passed (<ESC> x2)          caller got in
   BotGate: <ip> Wrong Key Pressed, Hung up.
   BotGate: <ip> Timed Out (0/2 <ESC> Counts)
   RATE-LIMIT: <ip> BLOCKED (4 Connects in 30(s))
   SAME-IP HAMMER: <ip> Hit MaxSameIP Cap, Issuing Temp Ban
   TEMP-BAN: <ip> BANNED for 300 Seconds
   BAN-HIT: <ip> Hit Count 2 / 3
   DENY: <ip> is Temp-Banned, Dropping Connection
   Node BUSY After Gate Pass for <ip>
   Spawning: <command line>                 (Debug=1 only)
   Spawn FAILED for Node <n> (err <code>)   Command= could not start

 LogMaxKB=1024 keeps the log at about 1 MB: when it is full it becomes
 telnet.log.bak (replacing the older one) and a new log starts.


===============================================================================
 14. RUNNING RGTEL AS A SERVICE / IN THE BACKGROUND
===============================================================================

 Windows
   * Put a shortcut to RGTEL.EXE in the Startup folder (shell:startup),
     with "Start in" set to the RGTEL folder.
   * CloseToTray=1 keeps it out of the taskbar; Nodeview=0 hides the node
     windows. (DOS BBSes under NTVDM need a logged-in desktop session, so
     run RGTEL as a normal program, not a Windows service.)

 Linux - systemd example (/etc/systemd/system/rgtel.service):

   [Unit]
   Description=RGTEL telnet/SSH gateway
   After=network.target

   [Service]
   User=bbs
   WorkingDirectory=/home/bbs/rgtel
   ExecStart=/home/bbs/rgtel/rgtel --headless
   Restart=on-failure

   [Install]
   WantedBy=multi-user.target

   then:  sudo systemctl enable --now rgtel
          journalctl -u rgtel -f        (watch the log)

 Or simply:   nohup ./rgtel --headless > /dev/null 2>&1 &


===============================================================================
 15. TROUBLESHOOTING
===============================================================================

 "RGTEL.INI not found"
   It must be in the same folder as RGTEL.EXE / rgtel.

 "Command= not defined"
   Add a Command= line under [Settings].

 "Bind FAILED ... Retry"
   Another program is using the port (an older RGTEL, a Windows telnet
   server, NetFoss's Net2BBS ...), or on Linux the port is below 1024 and
   setcap was not done. RGTEL keeps retrying. On Windows, running as
   Administrator can help.

 Callers connect but the BBS never starts / "Spawn FAILED" in the log
   The program in Command= was not found, or StartPath does not exist. Set
   Debug=1 to log the exact command line, then try that line by hand in a
   command prompt.

 Renegade -H: the caller sees double letters, or nothing they type
   Set NodeTelnet=1 (and SshNodeRaw=1 for SSH).

 RGFOSSIL / NetFoss: odd characters or line-mode typing
   Set NodeTelnet=0 (and SshNodeRaw=0).

 Callers get node 2 while node 1 looks free
   An fTelnet (web) caller probably holds node 1. Put the fTelnet proxy
   addresses in HighNodeIPs=.

 I banned myself
   Put your address in Whitelist= and press R. To lift a permanent ban,
   delete the line from blacklist.txt and press R.

 SSH: "SSH DISABLED" in the log
   libcrypto-3.dll (Windows) or libcrypto.so.3 (Linux) could not be
   loaded, SSH=0, or SshPort is the same as Port.

 SSH: "host key changed" warning for every caller
   RGTEL_ED25519.KEY / RGTEL_RSA.KEY were deleted or replaced. Restore the
   old ones from a backup, or tell callers to accept the new key.

===============================================================================
