mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 09:46:00 +03:00
[GH-ISSUE #1417] Actual client ip for websocket connections not showing up in logs #948
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#948
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mustaphazorgati on GitHub (Feb 20, 2021).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1417
Subject of the issue
Your environment
Steps to reproduce
start bitwarden normally and enable websocket.
docker-compose file:
forward X-Real-IP from caddy to bitwardenrs
caddy config:
Expected behaviour
The real client ip should show up in bitwardenrs log for websocket and regular logs.
Actual behaviour
The real client ip only shows up for regular logs, not for websocket logs. There the ip
172.19.0.1shows up. (see below)Relevant logs
@BlackDex commented on GitHub (Feb 20, 2021):
Not sure if we can fix this. This is a message from a third party library.
They do not use these headers. Also not sure if they are willing to accept PR's for this, since they created this as a short term fix waiting for its upstream source to merge a PR.
@stefan0xC commented on GitHub (Mar 13, 2021):
According to docs.rs/parity_ws the client_addr function looks for the
X-Forwarded-Forheader to look up the IP of a client. So probably caddy does not implicitly set the right address.172.19.0.1looks like a docker address. Are you running caddy inside a container? Can you set this header manually?@mustaphazorgati commented on GitHub (Mar 13, 2021):
Hey @stefan0xC,
thanks for your short reply. According to caddy's documentation the
X-Forwarded-Forheader is set. I've tried to set that header manually, but that won't work.Regarding the IP address: No, I am using bitwarden_rs with docker, not caddy.
@stefan0xC commented on GitHub (Mar 13, 2021):
@mustaphazorgati You are right. Sorry, I should have checked my own logs. (Because I have the same problem with nginx on host and bitwarden_rs.)
@ak2k commented on GitHub (Mar 15, 2021):
Does anyone with a better understanding of how this function is used in bitwarden_rs have a theory about why this isn't working as expected, given that the function is indeed documented to (and the source seems consistent with the documentation) pass the X-Forwarded-For header, yet doesn't seem to be doing so as used in bitwarden_rs?
@Masgalor commented on GitHub (Jun 7, 2021):
I do not know much about caddy, but would not the optimal solution be to add support for the (HA)proxy-protocol?
Link for reference Link
@BlackDex commented on GitHub (Jun 7, 2021):
If you want to to be fixed, make sure that you add
x-forwarded-forheader at the reverse proxy.The websocket library only supports that specific header.
@mustaphazorgati commented on GitHub (Jun 8, 2021):
@BlackDex: Caddy already sets that header automatically. See: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#headers
@BlackDex commented on GitHub (Jun 21, 2021):
Ok, i have checked the source code a bit better now, and that part of the code is not even used at all where i saw the
x-fowarded-forheader, it even has#[allow(dead_code)]defined there 🙄.So, this is really not something we can fix, as this is all inside the provided library.
I have created a FAQ item at the WIKI. https://github.com/dani-garcia/vaultwarden/wiki/FAQs