From: "flichtenheld (Code Review)" Date: Sun, 22 Sep 2024 14:21:47 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="20t0wE609dU="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Automatically enable --compress migrate on the server List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --20t0wE609dU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/756?usp=3Demail to look at the new patch set (#2). Change subject: Automatically enable --compress migrate on the server ...................................................................... Automatically enable --compress migrate on the server If we enable LZO compression, automatically switch to migrate mode. Change-Id: I00209b880cfcedd93e28f97fc3941d8b85e095f3 Signed-off-by: Frank Lichtenheld --- M doc/man-sections/protocol-options.rst M src/openvpn/comp.h M src/openvpn/options.c 3 files changed, 31 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/756/2 diff --git a/doc/man-sections/protocol-options.rst b/doc/man-sections/proto= col-options.rst index 37e2240..b2a23fa 100644 --- a/doc/man-sections/protocol-options.rst +++ b/doc/man-sections/protocol-options.rst @@ -127,6 +127,12 @@ configuration if supported by the client and otherwise switch to ``comp-= lzo no`` and add ``--push comp-lzo`` to the client specific configuration. + If used in a server configuration :code:`lzo` is an alias for :code:`mig= rate` in + current versions of OpenVPN. Compression will only be enabled if there i= s no + other choice. Note that these versions of OpenVPN also never actually co= mpress + any packets. But they still will decompress packets received from the ot= her side + of the connection if required. + ***Security Considerations*** Compression and encryption is a tricky combination. If an attacker knows @@ -153,6 +159,11 @@ ``mode`` may be :code:`yes`, :code:`no`, or :code:`adaptive` but there is no actual change in behavior anymore. + In server mode we convert this setting to ``--compress migrate`` to + automatically disable it when the client doesn't need it. If you want + to remove this setting from your server config you might need to add + an explicit ``--compress migrate`` instead if some clients still have + any variant of ``--comp-lzo`` in their config. --comp-noadapt **DEPRECATED** This option does not have any effect anymore since current diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index ed6a563..1bc4648 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -49,6 +49,7 @@ #define COMP_ALG_LZO 2 /* LZO algorithm */ #define COMP_ALG_SNAPPY 3 /* Snappy algorithm (no longer supported) */ #define COMP_ALG_LZ4 4 /* LZ4 algorithm */ +#define COMP_ALG_LZO_NO 5 /* --comp-lzo no which is similar to COMP_ALG_ST= UB, but no SWAP */ /* algorithm v2 */ diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 4fee671..f8688d4 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3448,6 +3448,24 @@ } #endif /* ifdef _WIN32 */ + if (options->mode =3D=3D MODE_SERVER) + { + /* + * Enable comp migrate automatically on server + */ + if (options->comp.alg =3D=3D COMP_ALG_LZO || options->comp.alg =3D= =3D COMP_ALG_LZO_NO) + { + msg(M_INFO, "DEPRECATED OPTION: LZO compression enabled on the= server side. " + "We will enable --compress migrate instead."); + options->comp.alg =3D COMP_ALG_UNDEF; + options->comp.flags =3D COMP_F_MIGRATE; + } + } + else if (options->comp.alg =3D=3D COMP_ALG_LZO_NO) + { + options->comp.alg =3D COMP_ALG_STUB; + } + #ifdef DEFAULT_PKCS11_MODULE /* If p11-kit is present on the system then load its p11-kit-proxy.so * by default if the user asks for PKCS#11 without otherwise specifying @@ -8456,7 +8474,7 @@ { if (streq(p[1], "no")) { - options->comp.alg =3D COMP_ALG_STUB; + options->comp.alg =3D COMP_ALG_LZO_NO; } /* There is no actual difference anymore between these variant= s. * We never compress. On the server side we replace this with -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/756?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: I00209b880cfcedd93e28f97fc3941d8b85e095f3 Gerrit-Change-Number: 756 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newpatchset --20t0wE609dU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld uploaded patch set #2 to this change.

<= p>View Ch= ange

Automatically enable --compress migrate on the server

If we= enable LZO compression, automatically switch to
migrate mode.

Ch= ange-Id: I00209b880cfcedd93e28f97fc3941d8b85e095f3
Signed-off-by: Frank = Lichtenheld <frank@...2641...>
---
M doc/man-sections/protocol-= options.rst
M src/openvpn/comp.h
M src/openvpn/options.c
3 files c= hanged, 31 insertions(+), 1 deletion(-)

git pull ssh://gerrit.ope=
nvpn.net:29418/openvpn refs/changes/56/756/2
diff --git a/doc/man-s=
ections/protocol-options.rst b/doc/man-sections/protocol-options.rst=

index 37e2240..b2a23fa 100644
--- a/doc/man-secti= ons/protocol-options.rst
+++ b/doc/man-sections/protocol-op= tions.rst
@@ -127,6 +127,12 @@
configura= tion if supported by the client and otherwise switch to ``comp-lzo no``
and add ``--push comp-lzo`` to the client specific configur= ation.

+ If used in a server configuration :code:`lzo` is an alias for :code:= `migrate` in
+ curre= nt versions of OpenVPN. Compression will only be enabled if there is no
+ other choice. Note th= at these versions of OpenVPN also never actually compress
+ any packets. But they still will de= compress packets received from the other side
+ of the connection if required.
+
***Security Cons= iderations***

Compression and encrypti= on is a tricky combination. If an attacker knows
@@ -153,6 = +159,11 @@
``mode`` may be :code:`yes`, :code:`no`, or := code:`adaptive`
but there is no actual change in behavio= r anymore.

+ In server mode we convert this setting to ``--compress migrate``= to
+ automatically = disable it when the client doesn't need it. If you want
+ to remove this setting from your = server config you might need to add

+ an explicit ``--compress migrate`` instead if some client= s still have
+ any v= ariant of ``--comp-lzo`` in their config.

--comp-noadapt

**DEPRECATED** This option does not hav= e any effect anymore since current
diff --git a/src/openvpn= /comp.h b/src/openvpn/comp.h
index ed6a563..1bc4648 100644<= /span>
--- a/src/openvpn/comp.h
+++ b/src/openvpn/= comp.h
@@ -49,6 +49,7 @@
#define COMP_ALG_= LZO 2 /* LZO algorithm */
#define COMP_ALG_SNAPPY 3 /* = Snappy algorithm (no longer supported) */
#define COMP_ALG= _LZ4 4 /* LZ4 algorithm */
+#define COMP_ALG_LZO_NO 5 /* --comp-lzo no which is similar to CO= MP_ALG_STUB, but no SWAP */


<= span> /* algorithm v2 */

diff --git a/src/openvpn/options.c= b/src/openvpn/options.c
index 4fee671..f8688d4 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/o= ptions.c
@@ -3448,6 +3448,24 @@
}
#endif /* ifdef _WIN32 */

+ if (options->mode =3D=3D MODE_S= ERVER)
+ {<= br>+ /*
+ * Enable comp migrate autom= atically on server
+ = */
+ i= f (options->comp.alg =3D=3D COMP_ALG_LZO || options->comp.alg =3D=3D = COMP_ALG_LZO_NO)
+ = {
+ m= sg(M_INFO, "DEPRECATED OPTION: LZO compression enabled on the server s= ide. "
+ = "We will enable --compress migrate instead.");
= + options->comp.a= lg =3D COMP_ALG_UNDEF;
+ }
+ }
+ else if (options->comp.alg =3D=3D COMP_ALG_LZO_NO)
+ {
+ options->comp.alg =3D COMP= _ALG_STUB;
+ }
+
#ifde= f DEFAULT_PKCS11_MODULE
/* If p11-kit is present on th= e system then load its p11-kit-proxy.so
* by default = if the user asks for PKCS#11 without otherwise specifying
@= @ -8456,7 +8474,7 @@
{
= if (streq(p[1], "no"))
{- options->com= p.alg =3D COMP_ALG_STUB;
+ options->comp.alg =3D COMP_ALG_LZO_NO;
}

/* There is no actual diffe= rence anymore between these variants.
* We ne= ver compress. On the server side we replace this with

To view, visit change 756. To unsubscribe, or for help writing ma= il filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I00209b880cfcedd93e28f97fc39= 41d8b85e095f3
Gerrit-Change-Number: 756
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
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-MessageType: newpatchset
--20t0wE609dU=--