From: Antonio Quartulli Date: Sat, 4 Sep 2021 09:56:25 +0000 (+0200) Subject: reject compression by default X-Git-Tag: v2.6_beta1~441 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79367a3fde433d0660cc7122aa21c3c76ee6b2da;p=thirdparty%2Fopenvpn.git reject compression by default With this change the value of '--allow-compression' is set to 'no'. Therefore compression is not enabled by default and cannot be enabled by the server either. This change is in line with the current trend of not recommending compression over VPN tunnels for security reasons (check Voracle). Of top of that compression is mostly useless nowadays, therefore there is not real reason to enable it. Signed-off-by: Arne Schwabe Signed-off-by: Antonio Quartulli Acked-by: Arne Schwabe Message-Id: <20210904095629.6273-4-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22797.html Signed-off-by: Gert Doering --- diff --git a/Changes.rst b/Changes.rst index 7efb34934..eeceefb6b 100644 --- a/Changes.rst +++ b/Changes.rst @@ -71,6 +71,12 @@ Deprecated features This option mainly served a role as debug option when NCP was first introduced. It should now no longer be necessary. +Compression no longer enabled by default + Unless an explicit compression option is specified in the configuration, + ``--allow-compression`` defaults to ``no`` in OpeNVPN 2.6.0. + By default, OpenVPN 2.5 still allowed a server to enable compression by + pushing compression related options. + User-visible Changes -------------------- diff --git a/doc/man-sections/generic-options.rst b/doc/man-sections/generic-options.rst index c746e2323..114faa4bc 100644 --- a/doc/man-sections/generic-options.rst +++ b/doc/man-sections/generic-options.rst @@ -61,6 +61,12 @@ which mode OpenVPN is configured as. Note: Using this option reverts defaults to no longer recommended values and should be avoided if possible. + The following table details what defaults are changed depending on the + version specified. + + - 2.5.x or lower: ``--allow-compression asym`` is automatically added + to the configuration if no other compression options are present. + --config file Load additional config options from ``file`` where each line corresponds to one command line option, but with the leading '--' removed. diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index cd4f0e1a2..0d284e274 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -59,6 +59,7 @@ #define COMP_F_ALLOW_STUB_ONLY (1<<4) /* Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY * we still accept other compressions to be pushed */ #define COMP_F_MIGRATE (1<<5) /* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ +#define COMP_F_ALLOW_ASYM (1<<6) /* Compression was explicitly set to allow asymetric compression */ /* diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 1f0f87839..21979785c 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3174,6 +3174,16 @@ need_compatibility_before(const struct options *o, unsigned int version) static void options_set_backwards_compatible_options(struct options *o) { + /* Compression is deprecated and we do not want to announce support for it + * by default anymore, additionally DCO breaks with compression. + * + * Disable compression by default starting with 2.6.0 if no other + * compression related option has been explicitly set */ + if (!comp_non_stub_enabled(&o->comp) && !need_compatibility_before(o, 20600) + && (o->comp.flags == 0)) + { + o->comp.flags = COMP_F_ALLOW_STUB_ONLY|COMP_F_ADVERTISE_STUBS_ONLY; + } } static void @@ -7768,6 +7778,7 @@ add_option(struct options *options, else if (streq(p[1], "asym")) { options->comp.flags &= ~COMP_F_ALLOW_COMPRESS; + options->comp.flags |= COMP_F_ALLOW_ASYM; } else if (streq(p[1], "yes")) {