A TCP tunnel with --allow rejects every client when the server sits behind a proxy that speaks
the PROXY protocol (Traefik proxyProtocol.version=2, HAProxy, nginx stream), even when the
client address matches the rule.
server/lib/proxy-front.js parses the PROXY header and stores the address on the socket as frislitIp. server/lib/proxy.js reads it, which is why HTTP tunnels and the visitor log show the
real address. server/controllers/control.js never looked at it:
With trustProxy off (the default, and correct here because TLS is passed through) forwarded is
null, so the join checked the allow list against the proxy container's address. registry.join()
then answered forbidden for everybody.
The control socket now derives the address the same way the HTTP path does, and the join log line
reports the same value instead of the raw peer address.
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have tested my changes locally
I have looked for similar pull requests in the repository and found none
Tested by reproducing the report: frislit tcp 22 --allow <client-ip>/32 behind Traefik with proxyProtocol.version=2 returns forbidden on frislit connect on 0.3.3. node --check on the
changed file passes; the server test suite runs in CI.
🔗 Related Issues
No issue: reported while setting up a TCP tunnel to a Windows machine.
## 📋 Description
A TCP tunnel with `--allow` rejects every client when the server sits behind a proxy that speaks
the PROXY protocol (Traefik `proxyProtocol.version=2`, HAProxy, nginx stream), even when the
client address matches the rule.
`server/lib/proxy-front.js` parses the PROXY header and stores the address on the socket as
`frislitIp`. `server/lib/proxy.js` reads it, which is why HTTP tunnels and the visitor log show the
real address. `server/controllers/control.js` never looked at it:
```js
session.client = { id: randomToken(12), ip: forwarded || req.socket.remoteAddress || "", … };
```
With `trustProxy` off (the default, and correct here because TLS is passed through) `forwarded` is
null, so the join checked the allow list against the proxy container's address. `registry.join()`
then answered `forbidden` for everybody.
The control socket now derives the address the same way the HTTP path does, and the join log line
reports the same value instead of the raw peer address.
```js
const clientIp = req.socket?.frislitIp || forwarded || req.socket.remoteAddress || "";
```
## 🚀 Changes made to ...
- [x] 🔧 Server
- [ ] 🖥️ Client
- [ ] ⌨️ CLI
- [ ] 📚 Documentation
- [ ] 🔄 Other: ___
## ✅ Checklist
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have tested my changes locally
- [x] I have looked for similar pull requests in the repository and found none
Tested by reproducing the report: `frislit tcp 22 --allow <client-ip>/32` behind Traefik with
`proxyProtocol.version=2` returns `forbidden` on `frislit connect` on 0.3.3. `node --check` on the
changed file passes; the server test suite runs in CI.
## 🔗 Related Issues
No issue: reported while setting up a TCP tunnel to a Windows machine.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Description
A TCP tunnel with
--allowrejects every client when the server sits behind a proxy that speaksthe PROXY protocol (Traefik
proxyProtocol.version=2, HAProxy, nginx stream), even when theclient address matches the rule.
server/lib/proxy-front.jsparses the PROXY header and stores the address on the socket asfrislitIp.server/lib/proxy.jsreads it, which is why HTTP tunnels and the visitor log show thereal address.
server/controllers/control.jsnever looked at it:With
trustProxyoff (the default, and correct here because TLS is passed through)forwardedisnull, so the join checked the allow list against the proxy container's address.
registry.join()then answered
forbiddenfor everybody.The control socket now derives the address the same way the HTTP path does, and the join log line
reports the same value instead of the raw peer address.
🚀 Changes made to ...
✅ Checklist
Tested by reproducing the report:
frislit tcp 22 --allow <client-ip>/32behind Traefik withproxyProtocol.version=2returnsforbiddenonfrislit connecton 0.3.3.node --checkon thechanged file passes; the server test suite runs in CI.
🔗 Related Issues
No issue: reported while setting up a TCP tunnel to a Windows machine.