It would be nice to have haproxy PROXY protocol support, so that znc gets real client IP addresses if haproxy is used to forward client connections to znc instance.
It would be nice to have haproxy [PROXY protocol](http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt) support, so that znc gets real client IP addresses if haproxy is used to forward client connections to znc instance.
##
<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9167249-add-support-for-haproxy-proxy-protocol?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).
</bountysource-plugin>
<!-- github-sync-id:59708014 -->
I thought ZNC modules have no API to intercept the prologue from incoming TCP socket, no? Haproxy basically prepends client connection details when it connects to ZNC, so this must be handled even earlier than TLS.
I thought ZNC modules have no API to intercept the prologue from incoming TCP socket, no? Haproxy basically prepends client connection details when it connects to ZNC, so this must be handled even earlier than TLS.
<!-- github-comment-id:77046830 -->
I presume @DarthGandalf that X-Forwarded-For is currently implemented then, and works for the web interface - but does it work for IRC connections as well?
I imagine if not, then PROXY protocol as mentioned above would be useful for providing the real IP in the actual TCP connection (similar to what happens with Dovecot).
I presume @DarthGandalf that X-Forwarded-For is currently implemented then, and works for the web interface - but does it work for IRC connections as well?
I imagine if not, then PROXY protocol as mentioned above would be useful for providing the real IP in the actual TCP connection (similar to what happens with Dovecot).
<!-- github-comment-id:288057374 -->
I believe support for X-Forwarded-For header was implemented in #349.
but does it work for IRC connections as well?
X-Forwarded-For is a HTTP header, could you please elaborate how this would apply to the IRC protocol?
I believe support for `X-Forwarded-For` header was implemented in #349.
> but does it work for IRC connections as well?
`X-Forwarded-For` is a HTTP header, could you please elaborate how this would apply to the IRC protocol?
<!-- github-comment-id:288144702 -->
>This would most likely need to be supported by the upstream CSocket library.
I have opened jimloco/Csocket#74 to track this.
<!-- github-comment-id:401907861 -->
This could be nice for people exposing their ZNC instance as an onion service, because Tor supports exporting the circuit ID as IPv6 address using haproxy's proxy protocol, which may be a bit more useful than 127.0.0.1.
HiddenServiceExportCircuitID protocol
The onion service will use the given protocol to expose the global circuit identifier of each inbound client circuit via the selected protocol.
The only protocol supported right now 'haproxy'. This option is only for v3 services. (Default: none)
The haproxy option works in the following way: when the feature is enabled, the Tor process will write a header line when a client is
connecting to the onion service. The header will look like this:
"PROXY TCP6 fc00:dead:beef:4dad::ffff:ffff ::1 65535 42\r\n"
We encode the "global circuit identifier" as the last 32-bits of the first IPv6 address. All other values in the header can safely be ignored.
You can compute the global circuit identifier using the following formula given the IPv6 address "fc00:dead:beef:4dad::AABB:CCDD":
global_circuit_id = (0xAA << 24) + (0xBB << 16) + (0xCC << 8) + 0xDD;
In the case above, where the last 32-bit is 0xffffffff, the global circuit identifier would be 4294967295. You can use this value together with
Tor’s control port where it is possible to terminate a circuit given the global circuit identifier. For more information about this see
controls-spec.txt.
The HAProxy version 1 proxy protocol is described in detail at https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
This could be nice for people exposing their ZNC instance as an onion service, because Tor supports exporting the circuit ID as IPv6 address using haproxy's proxy protocol, which may be *a bit* more useful than `127.0.0.1`.
HiddenServiceExportCircuitID protocol
The onion service will use the given protocol to expose the global circuit identifier of each inbound client circuit via the selected protocol.
The only protocol supported right now 'haproxy'. This option is only for v3 services. (Default: none)
The haproxy option works in the following way: when the feature is enabled, the Tor process will write a header line when a client is
connecting to the onion service. The header will look like this:
"PROXY TCP6 fc00:dead:beef:4dad::ffff:ffff ::1 65535 42\r\n"
We encode the "global circuit identifier" as the last 32-bits of the first IPv6 address. All other values in the header can safely be ignored.
You can compute the global circuit identifier using the following formula given the IPv6 address "fc00:dead:beef:4dad::AABB:CCDD":
global_circuit_id = (0xAA << 24) + (0xBB << 16) + (0xCC << 8) + 0xDD;
In the case above, where the last 32-bit is 0xffffffff, the global circuit identifier would be 4294967295. You can use this value together with
Tor’s control port where it is possible to terminate a circuit given the global circuit identifier. For more information about this see
controls-spec.txt.
The HAProxy version 1 proxy protocol is described in detail at https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
<!-- github-comment-id:490125676 -->
Any update on this? I've had to reorganize my personal infrastructure onto a cloud provider who doesn't allow for multiple IPs on a single machine so I'm feeling this pain every day :).
Any update on this? I've had to reorganize my personal infrastructure onto a cloud provider who doesn't allow for multiple IPs on a single machine so I'm feeling this pain every day :).
<!-- github-comment-id:518028872 -->
If possible it'd also be a good idea to allow this to work with certauth, which I guess it would anyways?
If possible it'd also be a good idea to allow this to work with [certauth](https://wiki.znc.in/Certauth), which I guess it would anyways?
<!-- github-comment-id:2016571861 -->
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.
It would be nice to have haproxy PROXY protocol support, so that znc gets real client IP addresses if haproxy is used to forward client connections to znc instance.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9167249-add-support-for-haproxy-proxy-protocol?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).Do you mean, as an alternative to X-Forwarded-For?
I mean, for IRC client connections.
I feel this is outside of the scope of ZNC and is better suited as a module for ZNC.
I thought ZNC modules have no API to intercept the prologue from incoming TCP socket, no? Haproxy basically prepends client connection details when it connects to ZNC, so this must be handled even earlier than TLS.
I presume @DarthGandalf that X-Forwarded-For is currently implemented then, and works for the web interface - but does it work for IRC connections as well?
I imagine if not, then PROXY protocol as mentioned above would be useful for providing the real IP in the actual TCP connection (similar to what happens with Dovecot).
I believe support for
X-Forwarded-Forheader was implemented in #349.X-Forwarded-Foris a HTTP header, could you please elaborate how this would apply to the IRC protocol?@kylef This is about analog of
X-Forwarded-Forfor any TCP connection, not just HTTP.This would most likely need to be supported by the upstream CSocket library.
I have opened jimloco/Csocket#74 to track this.
This could be nice for people exposing their ZNC instance as an onion service, because Tor supports exporting the circuit ID as IPv6 address using haproxy's proxy protocol, which may be a bit more useful than
127.0.0.1.This will be easier to implement after #1639 is finished
Any update on this? I've had to reorganize my personal infrastructure onto a cloud provider who doesn't allow for multiple IPs on a single machine so I'm feeling this pain every day :).
If possible it'd also be a good idea to allow this to work with certauth, which I guess it would anyways?