https://gitlab.synchro.net/main/sbbs/-/commit/03be043f226cebb6feb33535
Modified Files:
ctrl/sbbs.ini docs/v322_new.md src/sbbs3/main.cpp sbbs_ini.c src/sbbs3/scfg/scfgindex.h scfgsrvr.c src/sbbs3/startup.h websrvr.cpp websrvr.h src/xpdev/multisock.c multisock.h
Log Message:
PROXY protocol: believe the header only from TrustedProxies
With HAPROXY_PROTO (Web and Terminal Servers), xpms_accept() read a
PROXY protocol header from every connection and used the address it
gave, whoever sent it: a client that could reach the port directly
could claim any address, evading ip.can, the rate limiters and login
bans, posing as an exempt address, or getting another address filtered
(#1391).
The proxies are now listed in a TrustedProxies setting, in [BBS] and
[Web]. In [Web] it replaces RemoteIPHeaderTrust, added hours earlier
for #1283 and never in a release, so it also decides whose
RemoteIPHeader is believed.
xpms_set gained a proxy_trusted() callback, which each server sets: a
peer it does not trust is an ordinary direct connection, with no header expected or read, so direct and proxied clients can share a port; a
trusted peer must still send the header. A blank list keeps the
previous behavior (every peer must send a header, and it is believed),
with a warning logged at startup.
SCFG: the Reverse Proxy sub-menu is now shared, as a view, by the Web
Server (Client IP Header, PROXY Protocol, Trusted Proxies) and the
Terminal Server (PROXY Protocol, Trusted Proxies; #1392); the PROXY
Protocol toggle (HAPROXY_PROTO, until now set only in sbbs.ini) is in
both. Trusted Proxies is editable when either method is in use.
bbs_startup_t gained a member, so sbbsctrl.exe must be rebuilt.
Tested on Linux against isolated Web and Terminal Servers with
HAPROXY_PROTO and TrustedProxies: with the peer trusted, a v1 header's
address was used and a connection without one was dropped; with the
peer not trusted, a connection without a header was served under its
own address, and a header it sent anyway was not believed (the Web
Server read it as the request); with a blank list, the warning was
logged and the header honored. RemoteIPHeader was ignored from a peer
not in TrustedProxies and honored from one in it. The SCFG menus were
built, not exercised.
Fixes #1391
Fixes #1392
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net