• exec/websocketservice.js

    From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:31 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/c1bebfc1dd74a83e527b4acd
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Case-insensitive search for headers in ShakeHands. Some proxies
    like to mangle these unless you tell them not to.

    Capture the value of the X-Forwarded-For header, if present, and
    stash it in FWebSocketHeader['X-Forwarded-For'].

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:31 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/820b805eeefd3b59621e8aff
    Modified Files:
    exec/websocketservice.js
    Log Message:
    If BBS is using HAProxy ([BBS] Options line has HAPROXY_PROTO)
    then throw an error if X-Forwarded-For header was not received,
    or otherwise do the HAProxy thing upon connecting.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:31 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/fa3e7132c14916aede750ba9
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Avoid spurious connections to the terminal server - and some
    other unnecessary work - if the BBS is using HAProxy but we can't
    do the thing with the stuff because we don't have the things.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:31 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/a6cb6cc4907fd4116cee1921
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Added inet_pton function borrowed from the internet.
    Added incomplete send of haproxy protocol header. Need to sort
    out lookup of target (BBS) IP address.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:31 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/2225ced74c74259ba11937b8
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Hurr.

    But also, this needs some revision since I'm supposed to send
    the header all at once and probably shouldn't be doing a bunch
    of individual sendBin calls.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:32 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/282d9bfc5cce8ead3fd456ec
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Build protocol header as string and send all in one big barforama.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:32 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/32238a33cd8b5fd8e951abb0
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Use client address from header

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 19:55:32 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/6bfa4b0b14e08557b2bcd4c9
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Address family must occupy bytes 15 & 16

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Sat Nov 27 20:06:52 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/1f52abed6eaf9767813c7e4e
    Modified Files:
    exec/websocketservice.js
    Log Message:
    FWebSocketHeader should just be a bare object.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Thu Feb 23 19:57:49 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/e6021f4ec5f722b67156e3d8
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Write websocket client IP address to temp file.

    Scripts running on upstream (terminal) server can find actual
    client IP in:

    system.temp_path + 'sbbs-ws-' + client.socket.remote_port + '.ip'

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Thu Feb 23 20:43:37 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/26df9c31e4397cf536c2192e
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Better cleanup of ipFile

    Changed scope of ipFile variable so we can access it in the
    finally{} block. Should prevent stale files hanging around if
    the service encounters an error.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From echicken@VERT to Git commit to main/sbbs/master on Fri Feb 24 10:31:47 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/f7cd4ef3e7a6524a300b772c
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Create ip temp file immediately on connect.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rick Parrish@VERT to Git commit to main/sbbs/master on Mon Sep 4 14:56:38 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/bc915feefb6032f1ab18b9b4
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Speed up file transfers.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Sep 4 14:56:38 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/540f76d9615bb287ac428ed5
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Merge branch 'Ree/websocketservice-speedup' into 'master'

    Speed up file transfers.

    See merge request main/sbbs!327

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rick Parrish@VERT to Git commit to main/sbbs/master on Sat Sep 9 10:27:11 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/639fad65bad024219a54c84e
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Add support for binary frames to websocket service

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Sat Sep 9 10:27:11 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/c9e643727d8b91b3f18cc8a5
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Merge branch 'Ree/websocketservice-support-binary' into 'master'

    Add support for binary frames to websocket service

    See merge request main/sbbs!330

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Mon Sep 25 00:09:04 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/e77d0fe73f3d4ec01e8bc1ba
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Use system.temp_dir (configurable by sysop) instead of system.temp_path

    Fixes issue #648

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rick Parrish@VERT to Git commit to main/sbbs/master on Thu Sep 12 13:58:23 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/93434d072a7ea9696187a879
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Fix #782 - websocketservice.js garbles input on Banana Pi running Armbian

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Thu Sep 12 13:58:23 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/72f27c93963230f9cdedf82f
    Modified Files:
    exec/websocketservice.js
    Log Message:
    Merge branch 'ree/websocketservice-debug' into 'master'

    Fix #782 - websocketservice.js garbles input on Banana Pi running Armbian

    Closes #782

    See merge request main/sbbs!458

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Sat Jul 25 17:53:21 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/12951b03152f018744441521
    Modified Files:
    exec/websocketservice.js
    Log Message:
    websocketservice.js: a client disconnect isn't an error

    A short write means the peer went away, which is the normal way a
    WebSocket proxy session ends - not an exception. SendToServer() and SendToWebSocketClient() now return false in that case and the proxy loop breaks, matching how the existing null returns from GetFromServer() / GetFromWebSocketClient() are already handled. The failure is logged at LOG_DEBUG instead of surfacing in data/error.log:

    srvc 3408 WSS Error: SendToWebSocketClientVersion7 only sent 0 of
    138 bytes

    The throws were added in 1f087a43ce9 (rejected-29-rule).

    The literal "0" in that message is specific to a TLS (WSS) session: js_socket_sendsocket() returns -1 on a plaintext socket error but a byte
    count for every TLS outcome, so JS can't tell a closed connection from a
    short write. Tracked separately as GitLab #1199.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Sun Aug 16 22:55:13 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/d9f3abd619d4bdd8e0a6b8de
    Modified Files:
    exec/websocketservice.js
    Log Message:
    websocketservice.js: name the authenticated web session in the sidecar

    The relay already drops a sidecar file beside each connection so the
    target service can learn the client's real IP, which a service reading
    a proxied socket cannot see for itself. It said where a client came
    from and nothing about who they were, so every browser arrived at the
    far end anonymous, and a service had no way to tell an authenticated
    visitor from a passer-by.

    The Cookie header is captured during the handshake, the session
    resolved against data/user/####.web, and the user number written as a
    second line of the sidecar. A dead or absent session is user zero,
    which is the truthful answer rather than a refusal: what a service does
    with an anonymous client is the service's decision, not the relay's.

    THE ORDERING IS THE GUARANTEE, and it is why this is worth stating in
    the code as well as here. The sidecar is written and closed before a
    single byte is forwarded. So a target service that has been spoken to
    and still finds no sidecar knows it is not talking to the relay at all,
    and can treat that connection as a direct local one. Written after the
    first byte, that inference would be a race, and the fallback for a
    missing sidecar is exactly the trusting one.

    An over-long handshake header line is now refused rather than
    truncated. A line cut at the buffer size leaves its tail to be parsed
    as the NEXT header, which in this file's case can walk a value into the
    slot the user number is read from. Refusing is the only safe reading of
    a line that did not fit.

    -auth is new, and refuses any connection whose sidecar cannot be
    written. Without it a failed write degrades to a connection with no
    sidecar, which is precisely the shape the fallback above treats as
    trusted and local -- a write error turning into an unauthenticated
    client wearing a local client's clothes.

    Backward compatible: without -auth the file keeps its old single-line
    meaning to anything that only reads the first line, and the behaviour
    of every existing caller is unchanged.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net