Skip to content

Conversation

@junderw
Copy link
Member

@junderw junderw commented Sep 30, 2023

This PR adds the ability to log client IPs proxied through nginx during the REST and RPC logs.

  • For RPC, we use the PROXY protocol. (nginx only supports v1, but electrum RPC supports parsing (and discarding) v1 and v2 PROXY headers.
  • For REST, we use X-Forwarded-For request header that is added by nginx. Following the spec, it joins together all instances of the header values with a comma, then splits all the entries by commas, and returns the first valid IP address. (I think nginx should put its header first, so there should be no problem with clients adding dishonest XFF headers.

There are also some minor bug fixes related to dead locks in the RPC logic.

@junderw junderw force-pushed the junderw/log-client-ip branch 7 times, most recently from 904419c to 6855c56 Compare October 7, 2023 08:21
@junderw junderw marked this pull request as draft October 7, 2023 08:37
@junderw junderw marked this pull request as ready for review October 7, 2023 23:45
@junderw junderw force-pushed the junderw/log-client-ip branch from f4f6509 to a34e353 Compare October 8, 2023 07:34
@junderw junderw requested review from mononaut, softsimon and wiz October 8, 2023 07:39
@junderw junderw force-pushed the junderw/log-client-ip branch 3 times, most recently from 255767b to 353cb93 Compare October 9, 2023 01:36
@junderw junderw force-pushed the junderw/log-client-ip branch from 26290a8 to 9f65065 Compare July 27, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants