Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sydent does not log IP addresses when X-Forwarded-For header exists and obey_x_forwarded_for = True #299

Open
michaelkaye opened this issue May 29, 2020 · 2 comments
Labels

Comments

@michaelkaye
Copy link
Contributor

Config file contains:

[http]
obey_x_forwarded_for = True

A sample request like so:

GET /_matrix/identity/api/v1 HTTP/1.1
Host: vector.im
Accept-Encoding: gzip
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0
accept: */*
accept-language: en-US,en;q=0.5
origin: https://origin-server.com
dnt: 1
X-Forwarded-For: 1.2.3.4
X-Forwarded-Proto: https
X-Forwarded-For: 1.2.3.4

Logs only the raw load balancer IP in the sydent log files. It might be that there's two headers, but given they're identical, we should at least get one of them in the logs - neither is the one that is logged.

It looks like the logic is wrapped up in ip_from_request, but nothing actually seems to call this and/or twisted's http logging doesn't do the right thing with this.

https://github.com/matrix-org/sydent/blob/master/sydent/sydent.py#L274

@erikjohnston
Copy link
Member

There seems to be three sets of HTTP servers, do we expect this option to apply to all of them or just the client API one?

@richvdh
Copy link
Member

richvdh commented Jun 4, 2020

As per #300: it certainly doesn't want to be applied blindly to all three servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants