https://gitlab.synchro.net/main/sbbs/-/commit/3a6d09be2d9d277644fe4bb3
Modified Files:
docs/v322_new.md exec/load/ftelnethelper.js exec/websocketservice.js Log Message:
websocketservice.js: send a well-formed PROXY header, from a trusted source
With HAPROXY_PROTO in the Terminal Server's [BBS] Options, the relay sends
a PROXY protocol v2 header, and that header was malformed:
- The ports were appended as hex text instead of 2-byte binary, so the
Terminal Server read part of the client port as both ports and took the
target port's hex digits as the user's first input. Over Telnet that
input was flushed unseen; over RLogin it took the place of the leading
NUL, so the handshake was skipped ("No user name received") and
auto-login was lost.
- The address family was taken from the relay's own client socket, not
the addresses sent, so an IPv6 X-Forwarded-For behind an IPv4 proxy was
read as a bogus IPv4 address (2001:db8::1 logged as 32.1.13.184).
- The source address was X-Forwarded-For whoever sent it, so a client
could claim any address to a Terminal Server that must trust the relay;
a list of addresses, or a bad one, was sent as the text "false".
The source is now X-Forwarded-For (its right-most entry) only from a peer
in [BBS] TrustedProxies, the list the Terminal Server believes PROXY
headers from (an empty list trusting every peer, as there), and otherwise
the peer's own address and port. A connection without X-Forwarded-For is relayed with the peer's address instead of refused. The header's family
follows the source address, an address that will not parse refuses the connection, and inet_pton() rejects IPv4 octets over 255.
ftelnethelper.js gains GetTrustedProxies().
Fixes #1439
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net