fix(control): read the PROXY protocol address for the join check
CI / CLI (pull_request) Successful in 20s
CI / Server (pull_request) Successful in 26s
CI / Docker image (pull_request) Successful in 31s
CI / CLI (linux-arm64, static) (pull_request) Successful in 50s
CI / CLI (windows) (pull_request) Successful in 52s
CI / CLI (linux-x86-64, static) (pull_request) Successful in 1m1s
CI / CLI (pull_request) Successful in 20s
CI / Server (pull_request) Successful in 26s
CI / Docker image (pull_request) Successful in 31s
CI / CLI (linux-arm64, static) (pull_request) Successful in 50s
CI / CLI (windows) (pull_request) Successful in 52s
CI / CLI (linux-x86-64, static) (pull_request) Successful in 1m1s
HTTP requests already prefer socket.frislitIp, which the TLS front fills from the PROXY protocol. The control socket ignored it, so the TCP join check compared the allow list against the proxy address and rejected every client.
This commit is contained in:
2 files changed
+10
-3
No files matched your search
@@ -22,8 +22,9 @@ const createControlServer = ({ config, auth, registry, connections, intel, visit
|
||||
const forwarded = config.trustProxy && req.headers["x-forwarded-for"]
|
||||
? String(req.headers["x-forwarded-for"]).split(",")[0].trim()
|
||||
: null;
|
||||
const session = new MuxSession(ws, { parity: 0, name: `cli ${req.socket.remoteAddress}` });
|
||||
session.client = { id: randomToken(12), ip: forwarded || req.socket.remoteAddress || "", connectedAt: Date.now() };
|
||||
const clientIp = req.socket?.frislitIp || forwarded || req.socket.remoteAddress || "";
|
||||
const session = new MuxSession(ws, { parity: 0, name: `cli ${clientIp}` });
|
||||
session.client = { id: randomToken(12), ip: clientIp, connectedAt: Date.now() };
|
||||
const headerToken = auth.bearerFromHeaders(req.headers);
|
||||
let state = "hello";
|
||||
let role = null;
|
||||
@@ -84,7 +85,7 @@ const createControlServer = ({ config, auth, registry, connections, intel, visit
|
||||
state = "ready";
|
||||
attachJoiner(tunnel, session, { connections, intel, visitors });
|
||||
session.sendControl({ type: "joined", id: tunnel.id, port: tunnel.target.port, online: tunnel.online });
|
||||
logger.info(`Joiner attached to ${tunnel.id}`, { from: req.socket.remoteAddress });
|
||||
logger.info(`Joiner attached to ${tunnel.id}`, { from: session.client.ip });
|
||||
}
|
||||
} catch (err) {
|
||||
fail(session, err.code || "bad_request", err.message);
|
||||
|
||||
Reference in new issue
Block a user