From: "ralf_lici (Code Review)"
Date: Fri, 26 Jul 2024 13:27:26 +0000
In-Reply-To:
References:
Reply-To: ralf@...2726..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="g7GbJOBvs10="; charset=UTF-8
Subject: [Openvpn-devel] [L] Change in openvpn[master]: Add support for
HAProxy's PROXY protocol
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: plaisthos , flichtenheld , openvpn-devel
--g7GbJOBvs10=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
ralf_lici has posted comments on this change. ( http://gerrit.openvpn.net/c=
/openvpn/+/685?usp=3Demail )
Change subject: Add support for HAProxy's PROXY protocol
......................................................................
Patch Set 1:
(11 comments)
Patchset:
PS1:
> Only looked through it superficially. [=E2=80=A6]
Sure, I'm working on it
File CMakeLists.txt:
http://gerrit.openvpn.net/c/openvpn/+/685/comment/7290bcc7_a1b2bf59 :
PS1, Line 494: src/openvpn/proxy_protocol.h
> haproxy_protocol.c/haproxy_protol.h [=E2=80=A6]
Acknowledged
File doc/proxy-protocol.txt:
http://gerrit.openvpn.net/c/openvpn/+/685/comment/98eb2e63_aa08eed1 :
PS1, Line 8: https://www.haproxy.org/download/2.4/doc/proxy-protocol.txt
> Is this just a copy and paste of the document or is this addition to that=
document? It would be good [=E2=80=A6]
Acknowledged
http://gerrit.openvpn.net/c/openvpn/+/685/comment/7d238309_2cbc8ac3 :
PS1, Line 11: a binary version (v2).
> Is this protocol TCP only? I assume so, so would be good to mention this.
It also supports UDP but we only handle the TCP case so I will state it mor=
e clearly in the document.
http://gerrit.openvpn.net/c/openvpn/+/685/comment/83291020_4f4e27ad :
PS1, Line 26: ---------
> Why are supporting two new protocls? Is there a need to introduce an alre=
ady deprecated protocol to [=E2=80=A6]
Actually, as far as I have seen, currently some proxies only support v1 (eg=
. stunnel) so I don't think this version can be considered deprecated yet.
http://gerrit.openvpn.net/c/openvpn/+/685/comment/e62ae60e_87dd1528 :
PS1, Line 97: The v2 signature of the protocol: "\x0D\x0A\x0D\x0A\x00\x0D=
\x0A\x51\x55\x49\x54\x0A\x20".
> Really? The singnature is '\r\n\r\n\x00\r\nQUIT\n'?
Yes. Citing the specification (section 6):
This means that most protocols and implementations will not be confused by =
an incoming connection exhibiting the protocol signature, which avoids issu=
es when facing misconfigurations.
http://gerrit.openvpn.net/c/openvpn/+/685/comment/55c354bf_e38e4ac0 :
PS1, Line 108:
> What does this mean in the openvpn context?
Basically LOCAL commands are used when the proxy sends health-checks to the=
server and therefore I guess these should never arrive to an openvpn serve=
r and should be ignored. I will add this info to the document
http://gerrit.openvpn.net/c/openvpn/+/685/comment/a24cdcda_47d21b79 :
PS1, Line 115: DGRAM (0x2).
> if this is dgram, is the protocol still over tcp or does it use UDP then?
The PROXY protocol works both with TCP and with UDP but we support only TCP=
. I will write in the document that we support only TCP.
File src/openvpn/proxy_protocol.h:
http://gerrit.openvpn.net/c/openvpn/+/685/comment/9bd9130b_22b62cc0 :
PS1, Line 8: * Copyright (C) 2002-2024 OpenVPN Inc
> Wrong copyright
Acknowledged
File src/openvpn/proxy_protocol.c:
http://gerrit.openvpn.net/c/openvpn/+/685/comment/af015d00_a4fef0e9 :
PS1, Line 8: * Copyright (C) 2002-2024 OpenVPN Inc
> Wrong copyright
Acknowledged
File src/openvpn/socket.c:
http://gerrit.openvpn.net/c/openvpn/+/685/comment/a5c360d3_bd5f87ca :
PS1, Line 2684: /* check if it's a PROXY protocol header */
> I don't think this is the right place to add this. [=E2=80=A6]
It's true that it doesn't get executed only on the first packet. However, t=
here's a change in multi.c that checks if the header is present only once a=
t the beginning of a TCP connection and parses it. So, even if we were to d=
etect a proxy header later, we would not parse it. Additionally, we don't e=
xpect proxy headers after the connection has begun. Therefore, if we end up=
in this "if" condition, it will probably be due to a malformed packet, and=
the connection will be dropped.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/685?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9766c68feaba71279f26c3310eee4b5ca215e6ac
Gerrit-Change-Number: 685
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
Gerrit-Comment-Date: Fri, 26 Jul 2024 13:27:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos
Comment-In-Reply-To: flichtenheld
Gerrit-MessageType: comment
--g7GbJOBvs10=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
View C=
hange
11 comments:
Patchset:
Patch Set #1:
Only looked through =
it superficially. [=E2=80=A6]
Sure, I'm working on it
File CMakeLists.txt:
File d=
oc/proxy-protocol.txt:
<=
a href=3D"http://gerrit.openvpn.net/c/openvpn/+/685/comment/98eb2e63_aa08ee=
d1">Patch Set #1, Line 8: https://www.haproxy.org/download/2.4/doc/proxy-protocol.txt
Is this just a copy and paste of the document or is this addition=
to that document? It would be good [=E2=80=A6]
Acknowledged
Patch Set #1, Line 11: a binary version (v2).
Is this protocol TCP only? =
I assume so, so would be good to mention this.
It also supports UDP but we =
only handle the TCP case so I will state it more clearly in the document.=
p>
Patch Set #1, Line 26: ---------
Why are supporting two new =
protocls? Is there a need to introduce an already deprecated protocol to [=
=E2=80=A6]
Actually, as far as I have seen, currently some proxies only sup=
port v1 (eg. stunnel) so I don't think this version can be considered d=
eprecated yet.
Patch Set #1, Line 97: The v2 signature of the protocol: "\=
x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A\x20".
Really? The singnature is '\r\n\r\n\x00\r\nQUIT\n'?
Yes. Citi=
ng the specification (section 6):
This means that most protocols and imp=
lementations will not be confused by an incoming connection exhibiting the =
protocol signature, which avoids issues when facing misconfigurations.
<=
/li>Patch Set #1, Line 108:
What does this mean in the openvpn con=
text?
Basically LOCAL commands are used when the proxy sends health-checks =
to the server and therefore I guess these should never arrive to an openvpn=
server and should be ignored. I will add this info to the document
Patch Set #1, Line 115: DGRAM (0x2).
if this is dgram, is the =
protocol still over tcp or does it use UDP then?
The PROXY protocol works=
both with TCP and with UDP but we support only TCP. I will write in the do=
cument that we support only TCP.
File src/openvpn/proxy_protocol.h:
File src/openvpn/prox=
y_protocol.c:
File src/openvpn/socket.c:
Patch Set #1, Line 2684: /* check if it's a PROXY protoco=
l header */
I don't think this is the right place=
to add this. [=E2=80=A6]
It's true that it doesn't get executed on=
ly on the first packet. However, there's a change in multi.c that check=
s if the header is present only once at the beginning of a TCP connection a=
nd parses it. So, even if we were to detect a proxy header later, we would =
not parse it. Additionally, we don't expect proxy headers after the con=
nection has begun. Therefore, if we end up in this "if" condition=
, it will probably be due to a malformed packet, and the connection will be=
dropped.
To view, visit change 685. To unsubscribe, o=
r for help writing mail filters, visit settings.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9766c68feaba71279f26c3310ee=
e4b5ca215e6ac
Gerrit-Change-Number: 685
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>=
;
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
Gerrit-Comment-Date: Fri, 26 Jul 2024 13:27:26=
+0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <arne-openvp=
n@...1227...>
Comment-In-Reply-To: flichtenheld <frank@...1186...=
.2641...>
Gerrit-MessageType: comment
--g7GbJOBvs10=--