change defaults and introduce compat-mode
cover change defaults and introduce compat-mode
This patchset is basically Arne's patch
"Modernise OpenVPN defaults and introduce '--compat-mode'" divided in smaller patches in order to group relevant changes together, make review easier and allow potential reverting/bisecting in the future.
* Patch 1 is a restyling;
* Patch 2 introduces the knob to let users specify the version to be compatible with;
* Patch 3, 4, 5 and 6 change defaults and introduce related compat-mode values;
* Patch 7 adds a generic warning to let user know that default have changed and something may not behave as expected, unless compat-mode is used;
This change is an important milestone that will allow us to move our effort onto supporting ovpn-dco.
Cheers,
Antonio Quartulli (7):
simplify condition detecting pure P2P mode
compat-mode: allow user to specify version to be compatible with reject compression by default
do not include --cipher value in data-ciphers
compat-mode: add --data-cipher-fallback auomatically if requested set TLS 1.2 as minimum by default
add message about changing default values
Changes.rst | 23 ++++++ doc/man-sections/generic-options.rst | 21 +++++ src/openvpn/comp.h | 1 + src/openvpn/options.c | 117 +++++++++++++++++++++++---- src/openvpn/options.h | 4 + src/openvpn/ssl_ncp.c | 13 +++ src/openvpn/ssl_ncp.h | 8 ++ 7 files changed, 172 insertions(+), 15 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/7 simplify condition detecting pure P2P mode
The new condition is equivalent to the old one, but easier to grasp.
Also add message to inform uset that cipher negotiation, in this case, it indeed disabled.
--- src/openvpn/options.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
src/openvpn/options.c +5 -1
@@ -3076,8 +3076,12 @@ options_postprocess_verify(const struct options *o)static void options_postprocess_cipher (struct options *o) { -if (!o->pull && !(o->mode ==MODE_SERVER )) +if (!o->tls_server && !o->tls_client) { +/* we are in the classic P2P mode */ +msg (M_WARN ,"Cipher negotiation is disabled since TLS " +"mode is not enabled" ); +/* If the cipher is not set, use the old default of BF-CBC. We will * warn that this is deprecated on cipher initialisation, no need * to warn here as well */
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 1/7] simplify condition detecting pure P2P mode
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 20 lines
The new condition is equivalent to the old one, but easier to grasp.
Also add message to inform uset that cipher negotiation, in this case, it indeed disabled.
Signed-off-by Arne Schwabe <[email protected]...>Signed-off-by Antonio Quartulli <[email protected]...>--- src/openvpn/options.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)src/openvpn/options.c +0
-0@@ -3076,8 +3076,12 @@ options_postprocess_verify(const struct options *o)static void options_postprocess_cipher (struct options *o) {
src/openvpn/options.c options_postprocess_verify(const struct options *o) · line 3087
Quoted 10 lines
src/openvpn/options.c +5
-1-if (!o->pull && !(o->mode ==MODE_SERVER )) +if (!o->tls_server && !o->tls_client) { +/* we are in the classic P2P mode */ +msg (M_WARN ,"Cipher negotiation is disabled since TLS " +"mode is not enabled" ); +/* If the cipher is not set, use the old default of BF-CBC. We will * warn that this is deprecated on cipher initialisation, no need * to warn here as well */
Yes. Makes sense. The change makes it is a lot more clear. I think it is actually not equivalent but the new one is definitively the correct one.
Arne
Re: [Openvpn-devel] [PATCH 1/7] simplify condition detecting pure P2P mode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Quoted 6 lines · Arne Schwabe
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 4 lines
The new condition is equivalent to the old one, but easier to grasp.
Also add message to inform uset that cipher negotiation, in this case,
uset -> user
Quoted 2 lines
Quoted 2 lines
it indeed disabled.
it -> is
Quoted 51 lines
Quoted 34 lines
Signed-off-by Arne Schwabe [email protected]...Signed-off-by Antonio Quartulli [email protected]...--------------------------------------------------------------------------------------------
src/openvpn/options.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)src/openvpn/options.c +0
-0index
00ba6044..0d6b85cf100644---
a/src/openvpn/options.c+++
b/src/openvpn/options.csrc/openvpn/options.c +0
-0@@ -3076,8 +3076,12 @@ options_postprocess_verify(const struct options *o)static void
options_postprocess_cipher(struct options *o){
src/openvpn/options.c +0
-3-if (!o->pull && !(o->mode ==MODE_SERVER )) -if (!o->tls_server && !o->tls_client) { -/* we are in the classic P2P mode */ src/openvpn/options.c
Quoted 10 lines
src/openvpn/options.c +0
-3-msg (M_WARN ,"Cipher negotiation is disabled since TLS " -"mode is not enabled" ); -/* If the cipher is not set, use the old default of BF-CBC. We will * warn that this is deprecated on cipher initialisation, no need * to warn here as well */ Yes. Makes sense. The change makes it is a lot more clear. I think it is
actually not equivalent but the new one is definitively the correct one.
Acked-by Arne Schwabe [email protected]...
Quoted 7 lines
Arne
Openvpn-devel mailing list
-----BEGIN PGP SIGNATURE-----
Version: ProtonMail
wsBzBAEBCAAGBQJhNhflACEJEE+XnPZrkLidFiEECbw9RGejjXJ5xVVVT5ec 9muQuJ2H0wgAup4i4ArQzzTGnSsFtHYAjzeKiwIPemMiOw76gv64TqI7dRST 6SsSkpS4Xs10HQysdYzyoCW4Pju2u1zEn654UeonDa43HPYtrL0V3NDmtRYT 3+aJOtqkE74MAZXpMxh1zo1KVkP+UMtpJmFVngK9IvMnSMjBnEj/1np2aZeE KJSRKpskDgBXC5ISzo6JB3T48zbbl1+4zq8TOKrr9uvyXluw5Cme+YGL1yC5 l0ApubT29ANQMOIwBMwGaHm49sRZtkFod/hO630NNcjD/veksS2eyT0fo7oY P38ZVT0rbQWO06D1/0D4PGlXeukYHa0aVRqCR+nWm01dqa22gedDzg== =S+qj
-----END PGP SIGNATURE-----
Re: [Openvpn-devel] [PATCH 1/7] simplify condition detecting pure P2P mode
In reply to Arne SchwabeQuoted 5 lines
Yes. Makes sense. The change makes it is a lot more clear. I think it is actually not equivalent but the new one is definitively the correct one.
I looked at the code again and I have to actually retract my ACK.
The previous code means P2P mode with static key or P2P mode without --pull while the new condition means only P2P mode with static key.
The code that follows for that section should be better commented:
if (!o->ciphername)
{
o->ciphername = "BF-CBC";
}
else
{
o->enable_ncp_fallback = true;
}
return;It basically condeses to having always a valid string in o->ciphername, which is then used in static key code (which ignores data-ciphers) or allowing falling back to the cipher explicitly set via --cipher if we are in TLS mode (with NCP) but not to the implicit BF-CBC.
Arne
PATCH 2/7 compat-mode: allow user to specify version to be compatible with
In reply to Antonio QuartulliThis changes introduces the basic inbfrastructure required to allow the user to specify a specific OpenVPN version to be compatible with.
Following changes will modify defaults to more modern and safer values, while allowing backwards-compatible behaviour on demand.
The backwards-compatible behaviour is intructed via the config knob '--compat-mode' implemented in this patch.
--- Changes.rst | 6 +++++ doc/man-sections/generic-options.rst | 9 +++++++ src/openvpn/options.c | 37 ++++++++++++++++++++++++++++ src/openvpn/options.h | 4 +++ 4 files changed, 56 insertions(+)
Changes.rst +6 -0
@@ -45,6 +45,12 @@ Pending auth support for plugins and scripts See ``sample/sample-scripts/totpauth.py`` for an example. +Compatibility mode (``--compat-mode``) + The modernisation of defaults can impact the compatibility of OpenVPN 2.6.0 + with older peers. The options ``--compat-mode`` allows UIs to provide users + with an easy way to still connect to older servers. + + Deprecated features ------------------- ``inetd`` has been removed
doc/man-sections/generic-options.rst +9 -0
@@ -52,6 +52,15 @@ which mode OpenVPN is configured as. BSDs implement a getrandom() or getentropy() syscall that removes the need for /dev/urandom to be available. +--compat-mode version + This option provides a way to alter the default of OpenVPN to be more + compatible with the version ``version`` specified. All of the changes + this option does can also be achieved using individual configuration + options. + + Note: Using this option reverts defaults to no longer recommended + values and should be avoided if possible. + --config file Load additional config options from ``file`` where each line corresponds to one command line option, but with the leading '--' removed.
src/openvpn/options.c +37 -0
@@ -3125,6 +3125,29 @@ options_postprocess_cipher(struct options *o) } } +/** +* Returns if we want 'backwards-compatibility' up to (but not included) a +* certain version +* +* @param version the oldest version that does not compatibility +* e.g. 20400 for all versions < 2.4.0 +* @return whether compatibility should be enabled +*/ +static bool +need_compatibility_before (const struct options *o,int version) +{ +return o->backwards_compatible !=0 && o->backwards_compatible < version; +} + +/** +* Changes default values so that OpenVPN can be compatible with the user +* specified version +*/ +static void +options_set_backwards_compatible_options (struct options *o) +{ +} +static void options_postprocess_mutate (struct options *o) {
@@ -3137,6 +3160,8 @@ options_postprocess_mutate(struct options *o)helper_keepalive (o);helper_tcp_nodelay (o); +options_set_backwards_compatible_options (o); +options_postprocess_cipher (o);options_postprocess_mutate_invariant (o);
@@ -6698,6 +6723,18 @@ add_option(struct options *options,setenv_str (es, p[1 ], p[2 ] ? p[2 ] :"" ); } } +else if (streq (p[0 ],"compat-mode" ) && p[1 ] && !p[3 ]) + { +unsigned int major, minor, patch; +if (!(sscanf (p[1 ],"%u.%u.%u" , &major, &minor, &patch) ==3 )) + { +msg (msglevel,"cannot parse version number for --compat-mode: %s" , + p[1 ]); + goto err; + } + + options->backwards_compatible = major *10000 + minor *100 + patch; + }else if (streq (p[0 ],"setenv-safe" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_SETENV );
src/openvpn/options.h +4 -0
@@ -225,6 +225,10 @@ struct options/* enable forward compatibility for post-2.1 features */ bool forward_compatible; +/** What version we should try to be compatible with as major * 10000 + +* minor * 100 + patch, e.g. 2.4.7 => 20407 */ +unsigned int backwards_compatible; +/* list of options that should be ignored even if unknown */ const char **ignore_unknown_option;
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 2/7] compat-mode: allow user to specify version to be compatible with
Quoted 5 lines · Antonio Quartulli
src/openvpn/options.c +0
-0
src/openvpn/options.c options_postprocess_cipher(struct options *o) · line 3133
Quoted 9 lines
src/openvpn/options.c +5
-0@@ -3125,6 +3125,29 @@ options_postprocess_cipher(struct options *o) } } +/** +* Returns if we want 'backwards-compatibility' up to (but not included) a +* certain version +* +* @param version the oldest version that does not compatibility
I feel like you dropped a word in here ^^
src/openvpn/options.c options_postprocess_cipher(struct options *o)
Quoted 6 lines
src/openvpn/options.c +5
-0+* e.g. 20400 for all versions < 2.4.0 +* @return whether compatibility should be enabled +*/ +static bool +need_compatibility_before (const struct options *o,int version)
I feel like you want to do unsigned int on your version parameter here (why would a version go negative?) ...
Quoted 52 lines
src/openvpn/options.c +13
-0+{ +return o->backwards_compatible !=0 && o->backwards_compatible < version; +} + +/** +* Changes default values so that OpenVPN can be compatible with the user +* specified version +*/ +static void +options_set_backwards_compatible_options (struct options *o) +{ +} +static void
options_postprocess_mutate(struct options *o)
{src/openvpn/options.c +14
-0@@ -3137,6 +3160,8 @@ options_postprocess_mutate(struct options *o)helper_keepalive (o);helper_tcp_nodelay (o); +options_set_backwards_compatible_options (o); +options_postprocess_cipher (o);options_postprocess_mutate_invariant (o);@@ -6698,6 +6723,18 @@ add_option(struct options *options,setenv_str (es, p[1 ], p[2 ] ? p[2 ] :"" ); } } +else if (streq (p[0 ],"compat-mode" ) && p[1 ] && !p[3 ]) + { +unsigned int major, minor, patch; +if (!(sscanf (p[1 ],"%u.%u.%u" , &major, &minor, &patch) ==3 )) + { + msg(msglevel, "cannot parse version number for --compat-mode: %s", + p[1 ]); + goto err; + } + + options->backwards_compatible = major *10000 + minor *100 + patch; + }else if (streq (p[0 ],"setenv-safe" ) && p[1 ] && !p[3 ]){ VERIFY_PERMISSION(OPT_P_SETENV);src/openvpn/options.h +0
-0
src/openvpn/options.h struct options · line 232
Quoted 8 lines
src/openvpn/options.h +4
-0@@ -225,6 +225,10 @@ struct options/* enable forward compatibility for post-2.1 features */ bool forward_compatible; +/** What version we should try to be compatible with as major * 10000 + +* minor * 100 + patch, e.g. 2.4.7 => 20407 */ +unsigned int backwards_compatible;
... doubly so because you use unsigned int (imo rightly) here.
Quoted 14 lines
src/openvpn/options.h +1
-1+/* list of options that should be ignored even if unknown */ const char **ignore_unknown_option; --2.32.0
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH 2/7] compat-mode: allow user to specify version to be compatible with
In reply to Antonio QuartulliAm 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 1 line
This changes introduces the basic inbfrastructure required
typo
Quoted 122 lines
to allow the user to specify a specific OpenVPN version to be compatible with.
Following changes will modify defaults to more modern and safer values, while allowing backwards-compatible behaviour on demand.
The backwards-compatible behaviour is intructed via the config knob '--compat-mode' implemented in this patch.
Signed-off-by Arne Schwabe <[email protected]...>Signed-off-by Antonio Quartulli <[email protected]...>--- Changes.rst | 6 +++++ doc/man-sections/generic-options.rst | 9 +++++++ src/openvpn/options.c | 37 ++++++++++++++++++++++++++++ src/openvpn/options.h | 4 +++ 4 files changed, 56 insertions(+)Changes.rst +6
-0@@ -45,6 +45,12 @@ Pending auth support for plugins and scripts See ``sample/sample-scripts/totpauth.py`` for an example. +Compatibility mode (``--compat-mode``) + The modernisation of defaults can impact the compatibility of OpenVPN 2.6.0 + with older peers. The options ``--compat-mode`` allows UIs to provide users + with an easy way to still connect to older servers. + + Deprecated features ------------------- ``inetd`` has been removeddoc/man-sections/generic-options.rst +9
-0@@ -52,6 +52,15 @@ which mode OpenVPN is configured as. BSDs implement a getrandom() or getentropy() syscall that removes the need for /dev/urandom to be available. +--compat-mode version + This option provides a way to alter the default of OpenVPN to be more + compatible with the version ``version`` specified. All of the changes + this option does can also be achieved using individual configuration + options. + + Note: Using this option reverts defaults to no longer recommended + values and should be avoided if possible. + --config file Load additional config options from ``file`` where each line corresponds to one command line option, but with the leading '--' removed.src/openvpn/options.c +37
-0@@ -3125,6 +3125,29 @@ options_postprocess_cipher(struct options *o) } } +/** +* Returns if we want 'backwards-compatibility' up to (but not included) a +* certain version +* +* @param version the oldest version that does not compatibility +* e.g. 20400 for all versions < 2.4.0 +* @return whether compatibility should be enabled +*/ +static bool +need_compatibility_before (const struct options *o,int version) +{ +return o->backwards_compatible !=0 && o->backwards_compatible < version; +} + +/** +* Changes default values so that OpenVPN can be compatible with the user +* specified version +*/ +static void +options_set_backwards_compatible_options (struct options *o) +{ +} +static void options_postprocess_mutate (struct options *o) {@@ -3137,6 +3160,8 @@ options_postprocess_mutate(struct options *o)helper_keepalive (o);helper_tcp_nodelay (o); +options_set_backwards_compatible_options (o); +options_postprocess_cipher (o);options_postprocess_mutate_invariant (o);@@ -6698,6 +6723,18 @@ add_option(struct options *options,setenv_str (es, p[1 ], p[2 ] ? p[2 ] :"" ); } } +else if (streq (p[0 ],"compat-mode" ) && p[1 ] && !p[3 ]) + { +unsigned int major, minor, patch; +if (!(sscanf (p[1 ],"%u.%u.%u" , &major, &minor, &patch) ==3 )) + { +msg (msglevel,"cannot parse version number for --compat-mode: %s" , + p[1 ]); + goto err; + } + + options->backwards_compatible = major *10000 + minor *100 + patch; + }else if (streq (p[0 ],"setenv-safe" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_SETENV );src/openvpn/options.h +0
-0
src/openvpn/options.h struct options · line 233
Quoted 9 lines
src/openvpn/options.h +4
-0@@ -225,6 +225,10 @@ struct options/* enable forward compatibility for post-2.1 features */ bool forward_compatible; +/** What version we should try to be compatible with as major * 10000 + +* minor * 100 + patch, e.g. 2.4.7 => 20407 */ +unsigned int backwards_compatible; +/* list of options that should be ignored even if unknown */ const char **ignore_unknown_option;
Splitting this into its own patch makes sense.
PATCH v2 2/7 compat-mode: allow user to specify version to be compatible with
In reply to Antonio QuartulliThis changes introduces the basic inbfrastructure required to allow the user to specify a specific OpenVPN version to be compatible with.
Following changes will modify defaults to more modern and safer values, while allowing backwards-compatible behaviour on demand.
The backwards-compatible behaviour is intructed via the config knob '--compat-mode' implemented in this patch.
---
Changes from v1:
* fixed typ0 in comment
* changed argument type from int to unsigned int for
* need_compatibility_before() function
Changes.rst | 6 +++++ doc/man-sections/generic-options.rst | 9 +++++++ src/openvpn/options.c | 37 ++++++++++++++++++++++++++++ src/openvpn/options.h | 4 +++ 4 files changed, 56 insertions(+)
Changes.rst +6 -0
@@ -45,6 +45,12 @@ Pending auth support for plugins and scripts See ``sample/sample-scripts/totpauth.py`` for an example. +Compatibility mode (``--compat-mode``) + The modernisation of defaults can impact the compatibility of OpenVPN 2.6.0 + with older peers. The options ``--compat-mode`` allows UIs to provide users + with an easy way to still connect to older servers. + + Deprecated features ------------------- ``inetd`` has been removed
doc/man-sections/generic-options.rst +9 -0
@@ -52,6 +52,15 @@ which mode OpenVPN is configured as. BSDs implement a getrandom() or getentropy() syscall that removes the need for /dev/urandom to be available. +--compat-mode version + This option provides a way to alter the default of OpenVPN to be more + compatible with the version ``version`` specified. All of the changes + this option does can also be achieved using individual configuration + options. + + Note: Using this option reverts defaults to no longer recommended + values and should be avoided if possible. + --config file Load additional config options from ``file`` where each line corresponds to one command line option, but with the leading '--' removed.
src/openvpn/options.c +37 -0
@@ -3147,6 +3147,29 @@ options_postprocess_cipher(struct options *o) } } +/** +* Returns if we want 'backwards-compatibility' up to (but not included) a +* certain version +* +* @param version the oldest version that does not requires compatibility +* e.g. 20400 requires compatibility for all versions < 2.4.0 +* @return whether compatibility should be enabled +*/ +static bool +need_compatibility_before (const struct options *o,unsigned int version) +{ +return o->backwards_compatible !=0 && o->backwards_compatible < version; +} + +/** +* Changes default values so that OpenVPN can be compatible with the user +* specified version +*/ +static void +options_set_backwards_compatible_options (struct options *o) +{ +} +static void options_postprocess_mutate (struct options *o) {
@@ -3160,6 +3183,8 @@ options_postprocess_mutate(struct options *o)helper_tcp_nodelay (o);options_postprocess_setdefault_ncpciphers (o); +options_set_backwards_compatible_options (o); +options_postprocess_cipher (o);options_postprocess_mutate_invariant (o);
@@ -6721,6 +6746,18 @@ add_option(struct options *options,setenv_str (es, p[1 ], p[2 ] ? p[2 ] :"" ); } } +else if (streq (p[0 ],"compat-mode" ) && p[1 ] && !p[3 ]) + { +unsigned int major, minor, patch; +if (!(sscanf (p[1 ],"%u.%u.%u" , &major, &minor, &patch) ==3 )) + { +msg (msglevel,"cannot parse version number for --compat-mode: %s" , + p[1 ]); + goto err; + } + + options->backwards_compatible = major *10000 + minor *100 + patch; + }else if (streq (p[0 ],"setenv-safe" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_SETENV );
src/openvpn/options.h +4 -0
@@ -225,6 +225,10 @@ struct options/* enable forward compatibility for post-2.1 features */ bool forward_compatible; +/** What version we should try to be compatible with as major * 10000 + +* minor * 100 + patch, e.g. 2.4.7 => 20407 */ +unsigned int backwards_compatible; +/* list of options that should be ignored even if unknown */ const char **ignore_unknown_option;
Signature · 1 line
2.32.0
[Openvpn-devel] [PATCH applied] Re: compat-mode: allow user to specify version to be compatible with
v2 is, basically "rebase, comment fix, and unsigned int" - so taking plaisthos' ACK and adding my own. As discussed on IRC we have worked on the comments to make them more understandable.
I have not actually tested this, as there is nothing to test yet ("it compiles").
Your patch has been applied to the master branch.
commit 00a622f5656380b0e21a0583048aa57b35e78a19
Author: Antonio Quartulli Date: Wed Sep 8 09:26:06 2021 +0200
compat-mode: allow user to specify version to be compatible with
Signed-off-by: Arne Schwabe <[email protected]...>
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/search?l=mid&[email protected]...
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 3/7 reject compression by default
In reply to Antonio QuartulliWith 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 rend 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.
--- Changes.rst | 7 +++++++ doc/man-sections/generic-options.rst | 6 ++++++ src/openvpn/comp.h | 1 + src/openvpn/options.c | 11 +++++++++++ 4 files changed, 25 insertions(+)
Changes.rst +7 -0
@@ -71,6 +71,13 @@ 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. + + Overview of changes in 2.5 ==========================
doc/man-sections/generic-options.rst +6 -0
@@ -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.
src/openvpn/comp.h +1 -0
@@ -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 assymetric compression */ /*
src/openvpn/options.c +11 -0
@@ -3146,6 +3146,16 @@ need_compatibility_before(const struct options *o, 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
@@ -7732,6 +7742,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" )) {
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 3/7] reject compression by default
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 5 lines
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 rend of not recommending
I think rend should be trend
Quoted 24 lines
/*
src/openvpn/options.c +10
-0@@ -3146,6 +3146,16 @@ need_compatibility_before(const struct options *o, 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
src/openvpn/options.c add_option(struct options *options, · line 7748
Quoted 7 lines
src/openvpn/options.c +1
-0@@ -7732,6 +7742,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" )) {
[Openvpn-devel] [PATCH applied] Re: reject compression by default
In reply to Antonio QuartulliThis needed a bit of massaging for the Changes.rst hunk. The rest was straightforward.
The interaction of this with existing configs is interesting.
- if the local config has "comp-lzo" or "compress <something>" in it, this will still work(!) - because the "allow-compress no" changed default will only become active after the config is parsed (and the client will announce IV_LZO=1 to the server)
- if the local config has *no* "comp-lzo" or "compress" statements, "allow-compress no" becomes active, and no IV_LZO/IV_LZ4 is sent to the server
- if the local config has no compression setting but --compat-mode 2.3.0 is set, we also announce IV_LZO/IV_LZ4 to the server
So the compat bit and changed default works, it is only "not active yet" when reading the local config. OTOH, users are free to put stuff into their local config, including "allow-compression yes", to override the new defaults - so I think this is okay, if properly understood.
Making the (possibly) changed "allow-compression" setting active already when reading the config is a more intrusive change, as one would need to recalculate defaults right upon hitting the "compat-mode" statement (and the "compat-mode" statement would need to be *before* the "compress" statement otherwise disallowed) - we could do that, but I'm not sure it's worth it. Definitely worth discussing.
One interesting side effect of the current code is that none of the t_client buildslaves break - because they all have "comp-lzo" in the configs (for historic reasons, sorry...) and thus everything keeps working :-) - need to modify these cases a add variants.
Your patch has been applied to the master branch.
commit 79367a3fde433d0660cc7122aa21c3c76ee6b2da
Author: Antonio Quartulli Date: Sat Sep 4 11:56:25 2021 +0200
reject compression by default
Signed-off-by: Arne Schwabe <[email protected]...>
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22797.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 4/7 do not include --cipher value in data-ciphers
In reply to Antonio QuartulliThe --cipher option has been there since a while, but it became more and more confusing since the introduction of NCP (data cipher negotiation).
The fallback cipher can now be specified via --data-cipher-fallback, while the list of accepted ciphers is specified via --data-ciphers.
--cipher can still be used for compatibility reasons, but won't affect the cipher negotiation.
--- Changes.rst | 5 ++++ doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 38 ++++++++++++++++------------ src/openvpn/ssl_ncp.c | 13 ++++++++++ src/openvpn/ssl_ncp.h | 8 ++++++ 5 files changed, 50 insertions(+), 16 deletions(-)
Changes.rst +5 -0
@@ -71,6 +71,11 @@ Deprecated features This option mainly served a role as debug option when NCP was first introduced. It should now no longer be necessary. +``--cipher`` argument is no longer included in ``--data-ciphers`` by default + Data cipher negotiation has been introduced in 2.4.0 and been significantly + improved in 2.5.0. The implicit fallback to the cipher specified in + ``--cipher`` has been removed. + 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.
doc/man-sections/generic-options.rst +2 -0
@@ -66,6 +66,8 @@ which mode OpenVPN is configured as. - 2.5.x or lower: ``--allow-compression asym`` is automatically added to the configuration if no other compression options are present. + - 2.4.x or lower: The cipher in ``--cipher`` is appended to + ``--data-ciphers`` --config file Load additional config options from ``file`` where each line corresponds
src/openvpn/options.c +22 -16
@@ -3102,26 +3102,20 @@ options_postprocess_cipher(struct options *o)/* We still need to set the ciphername to BF-CBC since various other * parts of OpenVPN assert that the ciphername is set */ o->ciphername ="BF-CBC" ; + +msg (M_INFO ,"Note: --cipher is not set. OpenVPN versions before 2.6 " +"defaulted to BF-CBC as fallback when cipher negotiation " +"failed in this case. If you need this fallback please add " +"'--data-ciphers-fallback 'BF-CBC' to your configuration " +"and/or add BF-CBC to --data-ciphers." ); }else if (!o->enable_ncp_fallback && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers)) { -msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in" -" --data-ciphers (%s). Future OpenVPN version will " -"ignore --cipher for cipher negotiations. " -"Add '%s' to --data-ciphers or change --cipher '%s' to " -"--data-ciphers-fallback '%s' to silence this warning." , - o->ciphername, o->ncp_ciphers, o->ciphername, - o->ciphername, o->ciphername); - o->enable_ncp_fallback = true; - -/* Append the --cipher to ncp_ciphers to allow it in NCP */ -size_t newlen =strlen (o->ncp_ciphers) +1 +strlen (o->ciphername) +1 ; -char *ncp_ciphers =gc_malloc (newlen, false, &o->gc); - -ASSERT (openvpn_snprintf (ncp_ciphers, newlen,"%s:%s" , o->ncp_ciphers, - o->ciphername)); - o->ncp_ciphers = ncp_ciphers; +msg (M_WARN ,"DEPRECATED OPTION: --cipher set to '%s' but missing in " +"--data-ciphers (%s). OpenVPN ignores --cipher for cipher " +"negotiations. " , + o->ciphername, o->ncp_ciphers); } }
@@ -3146,6 +3140,18 @@ need_compatibility_before(const struct options *o, int version)static void options_set_backwards_compatible_options (struct options *o) { +/* Versions < 2.5.0 do need --cipher in the list of accepted ciphers. +* Version 2.4 might probably does not need it but NCP was not so +* good with 2.4 and ncp-disable might be more common on 2.4 peers. +* Only do this iif --cipher is not explicitly (BF-CBC). This is not +* 100% correct backwards compatible behaviour but 2.5 already behaved like +* this */ +if (o->ciphername &&need_compatibility_before (o,20500 ) + && !tls_item_in_cipher_list (o->ciphername, o->ncp_ciphers)) + { +append_cipher_to_ncp_list (o, o->ciphername); + } +/* Compression is deprecated and we do not want to announce support for it * by default anymore, additionally DCO breaks with compression. *
src/openvpn/ssl_ncp.c +13 -0
@@ -172,6 +172,19 @@ mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)return ret; } + +void +append_cipher_to_ncp_list (struct options *o,const char *ciphername) +{ +/* Append the --cipher to ncp_ciphers to allow it in NCP */ +size_t newlen =strlen (o->ncp_ciphers) +1 +strlen (ciphername) +1 ; +char *ncp_ciphers =gc_malloc (newlen, false, &o->gc); + +ASSERT (openvpn_snprintf (ncp_ciphers, newlen,"%s:%s" , o->ncp_ciphers, + ciphername)); + o->ncp_ciphers = ncp_ciphers; +} +bool tls_item_in_cipher_list (const char *item,const char *list) {
src/openvpn/ssl_ncp.h +8 -0
@@ -102,6 +102,14 @@ tls_peer_ncp_list(const char *peer_info, struct gc_arena *gc);char *mutate_ncp_cipher_list (const char *list,struct gc_arena *gc); +/** +* Appends the cipher specified by the ciphernamer parameter to to +* the o->ncp_ciphers list. +* @param o options struct to modify. Its gc is also used +* @param ciphername the ciphername to add +*/ +void append_cipher_to_ncp_list (struct options *o,const char *ciphername); +/** * Return true iff item is present in the colon-separated zero-terminated * cipher list.
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 4/7] do not include --cipher value in data-ciphers
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 9 lines
The --cipher option has been there since a while, but it became more and more confusing since the introduction of NCP (data cipher negotiation).
The fallback cipher can now be specified via --data-cipher-fallback, while the list of accepted ciphers is specified via --data-ciphers.
--cipher can still be used for compatibility reasons, but won't affect the cipher negotiation.
Re: [Openvpn-devel] [PATCH 4/7] do not include --cipher value in data-ciphers
In reply to Antonio QuartulliHi,
we discussed on IRC how to improve the Changes.rst and the manpage part about --cipher. Here is the result:
Changes.rst:
``--cipher`` argument is no longer appended to ``--data-ciphers`` by default. Data cipher negotiation has been introduced in 2.4.0 and been significantly improved in 2.5.0. The implicit fallback to the cipher specified in ``--cipher`` has been removed. Effectively, ``--cipher`` is a no-op in TLS mode now, and will only have an effect in pre-shared-key mode (``--secret``). From now on ``--cipher`` should not be used in new configurations for TLS mode.
Should backwards compatibility with older OpenVPN peers be required, please see the ``--compat-mode`` instead.
manpage:
--cipher alg
This option should not be used any longer in TLS mode and still exists for two reasons:
* compatibility with old configurations still carrying it around;
* allow users connecting to OpenVPN peers older than 2.6.0 to have ``--cipher`` configured the same way as the remote counterpart. This can avoid MTU/frame size warnings.
Before 2.4.0, this option was used to select the cipher to be configured on the data channel, however, later versions usually ignored this directive in favour of a negotiated cipher. Starting with 2.6.0, this option is always ignored in TLS mode when it comes to configuring the cipher and will only control the cipher for ``--secret`` pre-shared-key mode (note: this mode is deprecated strictly not recommended).
If you wish to specify the cipher to use on the data channel, please see ``--data-ciphers`` (for regular negotiation) and ``--data-ciphers-fallback`` (for a fallback option when the negotiation cannot take place because the other peer is old or has negotiation disabled).
I hope the formatting will not be messed up.
Gert offered to add this text to the patch while committing.
Regards,
Signature · 1 line
Antonio Quartulli
[Openvpn-devel] [PATCH applied] Re: do not include --cipher value in data-ciphers
In reply to Antonio QuartulliYour patch has been applied to the master branch.
As discussed on IRC, the Changes.rst entry was extended, and the --cipher entry in the manpage (doc/man-sections/protocol-options.rst) was replaced with the new text. I'm not sure if it is clear enough now, so I susggest we revisit the whole "document ciphers and NCP" topic in the "pre-release" phase for 2.6 - Richard's help would certainly be most welcome there.
The code itself looks reasonable. Some basic tests with my current t_client rig confirms that it broke all the "--cipher BF-CBC" tests (that had this explicitly added because NCP broke the frame stuff, thus "big packets"). Adding "--data-ciphers BF-CBC" fixed those tests, and so did "--compat-mode 2.4.0".
commit 65f6da8eeb84fbcea357765e13fa73d0169a143c
Author: Antonio Quartulli Date: Sat Sep 4 11:56:26 2021 +0200
do not include --cipher value in data-ciphers
Signed-off-by: Arne Schwabe <[email protected]...>
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22799.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 5/7 compat-mode: add --data-cipher-fallback auomatically if requested
In reply to Antonio QuartulliFor compatibility with OpenVPN older than 2.4.0, the '--data-cipher-fallback' argument is automatically added with the same value as specified by '--cipher'.
This happens only when the user specifies compat-mode with a version older than 2.4.0.
--- doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 7 +++++++ 2 files changed, 9 insertions(+)
doc/man-sections/generic-options.rst +2 -0
@@ -68,6 +68,8 @@ which mode OpenVPN is configured as. to the configuration if no other compression options are present. - 2.4.x or lower: The cipher in ``--cipher`` is appended to ``--data-ciphers`` + - 2.3.x or lower: ``--data-cipher-fallback`` is automatically added with + the same cipher as ``--cipher`` --config file Load additional config options from ``file`` where each line corresponds
src/openvpn/options.c +7 -0
@@ -3152,6 +3152,13 @@ options_set_backwards_compatible_options(struct options *o)append_cipher_to_ncp_list (o, o->ciphername); } +/* Versions < 2.4.0 additionally might be compiled with --enable-small and +* not have OCC strings required for "poor man's NCP" */ +if (o->ciphername &&need_compatibility_before (o,20400 )) + { + o->enable_ncp_fallback = true; + } +/* Compression is deprecated and we do not want to announce support for it * by default anymore, additionally DCO breaks with compression. *
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 5/7] compat-mode: add --data-cipher-fallback auomatically if requested
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 4 lines
For compatibility with OpenVPN older than 2.4.0, the '--data-cipher-fallback' argument is automatically added with the same value as specified by '--cipher'.
Quoted 10 lines
This happens only when the user specifies compat-mode with a version older than 2.4.0.
Signed-off-by Arne Schwabe <[email protected]...>Signed-off-by Antonio Quartulli <[email protected]...>--- doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 7 +++++++
[Openvpn-devel] [PATCH applied] Re: compat-mode: add --data-cipher-fallback auomatically if requested
In reply to Antonio QuartulliCode change looks reasonably simple :-) - not sure I understand all the intricacies, but at least it does not break anything in my test rigs. Which I wouldn't expect.
Your patch has been applied to the master branch.
commit cdef503b646087f9284b53e01c64988c98879c36
Author: Antonio Quartulli Date: Sat Sep 4 11:56:27 2021 +0200
compat-mode: add --data-cipher-fallback auomatically if requested
Signed-off-by: Arne Schwabe <[email protected]...>
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22798.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 6/7 set TLS 1.2 as minimum by default
In reply to Antonio QuartulliDo not accept handshakes with peers trying to negotiate TLS lower than 1.2. TLS 1.1 and 1.0 are not recommended and therefore will, by default, allow TLS 1.2 as minimum version.
The minimum allowed version can still be controlled via '--tls-version-min'.
At the same time automatically set '--tls-version-min' to 1.0 if the user requires compatibility with versions onlder than 2.3.7, as that was the only version supported back then.
--- Changes.rst | 5 +++++ doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 16 ++++++++++++++++ 3 files changed, 23 insertions(+)
Changes.rst +5 -0
@@ -71,6 +71,11 @@ Deprecated features This option mainly served a role as debug option when NCP was first introduced. It should now no longer be necessary. +TLS 1.0 and 1.1 are deprecated + ``tls-version-min`` is set to 1.2 by default. OpenVPN 2.6.0 defaults + to a minimum TLS version of 1.2 as TLS 1.0 and 1.1 should be generally + avoided. Note that OpenVPN versions older than 2.3.7 use TLS 1.0 only. + ``--cipher`` argument is no longer included in ``--data-ciphers`` by default Data cipher negotiation has been introduced in 2.4.0 and been significantly improved in 2.5.0. The implicit fallback to the cipher specified in
doc/man-sections/generic-options.rst +2 -0
@@ -70,6 +70,8 @@ which mode OpenVPN is configured as. ``--data-ciphers`` - 2.3.x or lower: ``--data-cipher-fallback`` is automatically added with the same cipher as ``--cipher`` + - 2.3.6 or lower: ``--tls-version-min 1.0`` is added to the configuration + when ``--tls-version-min`` is not explicitly set. --config file Load additional config options from ``file`` where each line corresponds
src/openvpn/options.c +16 -0
@@ -850,6 +850,7 @@ init_options(struct options *o, const bool init_gc) o->use_prediction_resistance = false;#endif o->tls_timeout =2 ; + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); o->renegotiate_bytes =-1 ; o->renegotiate_seconds =3600 ; o->renegotiate_seconds_min =-1 ;
@@ -3140,6 +3141,21 @@ need_compatibility_before(const struct options *o, int version)static void options_set_backwards_compatible_options (struct options *o) { +/* TLS min version is not set */ +if ((o->ssl_flags &SSLF_TLS_VERSION_MIN_MASK ) ==0 ) + { +if (need_compatibility_before (o,20307 )) + { +/* 2.3.6 and earlier have TLS 1.0 only, set minimum to TLS 1.0 */ + o->ssl_flags = (TLS_VER_1_0 <<SSLF_TLS_VERSION_MIN_SHIFT ); + } +else + { +/* Use TLS 1.2 as proper default */ + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); + } + } +/* Versions < 2.5.0 do need --cipher in the list of accepted ciphers. * Version 2.4 might probably does not need it but NCP was not so * good with 2.4 and ncp-disable might be more common on 2.4 peers.
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 6/7] set TLS 1.2 as minimum by default
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 73 lines
Do not accept handshakes with peers trying to negotiate TLS lower than 1.2. TLS 1.1 and 1.0 are not recommended and therefore will, by default, allow TLS 1.2 as minimum version.
The minimum allowed version can still be controlled via '--tls-version-min'.
At the same time automatically set '--tls-version-min' to 1.0 if the user requires compatibility with versions onlder than 2.3.7, as that was the only version supported back then.
Signed-off-by Arne Schwabe <[email protected]...>Signed-off-by Antonio Quartulli <[email protected]...>--- Changes.rst | 5 +++++ doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 16 ++++++++++++++++ 3 files changed, 23 insertions(+)Changes.rst +5
-0@@ -71,6 +71,11 @@ Deprecated features This option mainly served a role as debug option when NCP was first introduced. It should now no longer be necessary. +TLS 1.0 and 1.1 are deprecated + ``tls-version-min`` is set to 1.2 by default. OpenVPN 2.6.0 defaults + to a minimum TLS version of 1.2 as TLS 1.0 and 1.1 should be generally + avoided. Note that OpenVPN versions older than 2.3.7 use TLS 1.0 only. + ``--cipher`` argument is no longer included in ``--data-ciphers`` by default Data cipher negotiation has been introduced in 2.4.0 and been significantly improved in 2.5.0. The implicit fallback to the cipher specified indoc/man-sections/generic-options.rst +2
-0@@ -70,6 +70,8 @@ which mode OpenVPN is configured as. ``--data-ciphers`` - 2.3.x or lower: ``--data-cipher-fallback`` is automatically added with the same cipher as ``--cipher`` + - 2.3.6 or lower: ``--tls-version-min 1.0`` is added to the configuration + when ``--tls-version-min`` is not explicitly set. --config file Load additional config options from ``file`` where each line correspondssrc/openvpn/options.c +9
-0@@ -850,6 +850,7 @@ init_options(struct options *o, const bool init_gc) o->use_prediction_resistance = false;#endif o->tls_timeout =2 ; + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); o->renegotiate_bytes =-1 ; o->renegotiate_seconds =3600 ; o->renegotiate_seconds_min =-1 ;@@ -3140,6 +3141,21 @@ need_compatibility_before(const struct options *o, int version)static void options_set_backwards_compatible_options (struct options *o) { +/* TLS min version is not set */ +if ((o->ssl_flags &SSLF_TLS_VERSION_MIN_MASK ) ==0 ) + { +if (need_compatibility_before (o,20307 )) + { +/* 2.3.6 and earlier have TLS 1.0 only, set minimum to TLS 1.0 */ + o->ssl_flags = (TLS_VER_1_0 <<SSLF_TLS_VERSION_MIN_SHIFT ); + }
src/openvpn/options.c need_compatibility_before(const struct options *o, int version) · line 3161
Quoted 10 lines
src/openvpn/options.c +7
-0+else + { +/* Use TLS 1.2 as proper default */ + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); + } + } +/* Versions < 2.5.0 do need --cipher in the list of accepted ciphers. * Version 2.4 might probably does not need it but NCP was not so * good with 2.4 and ncp-disable might be more common on 2.4 peers.
Note that on newer Ubuntu versions, which their strangely patched OpenSSL, you are already getting this behaviour by default.
Arne
Re: [Openvpn-devel] [PATCH 6/7] set TLS 1.2 as minimum by default
In reply to Antonio QuartulliHi,
src/openvpn/options.c init_options(struct options *o, const bool init_gc) · line 856
Quoted 12 lines · Antonio Quartulli
src/openvpn/options.c +1
-0@@ -850,6 +850,7 @@ init_options(struct options *o, const bool init_gc) o->use_prediction_resistance = false;#endif o->tls_timeout =2 ; + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); o->renegotiate_bytes =-1 ; o->renegotiate_seconds =3600 ; o->renegotiate_seconds_min =-1 ;
This code confuses me. We now unconditionally initialize ssl_flags to "TLS_VER_1_2"...
src/openvpn/options.c need_compatibility_before(const struct options *o, int version) · line 3146
Quoted 7 lines
src/openvpn/options.c +3
-0@@ -3140,6 +3141,21 @@ need_compatibility_before(const struct options *o, int version)static void options_set_backwards_compatible_options (struct options *o) { +/* TLS min version is not set */ +if ((o->ssl_flags &SSLF_TLS_VERSION_MIN_MASK ) ==0 ) + {
... and then we check if that happens to be "0", so we can invoke the compat handler...
The first hunk looks wrong.
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Re: [Openvpn-devel] [PATCH 6/7] set TLS 1.2 as minimum by default
Hi,
Quoted 18 lines · Gert Doering
Hi,
src/openvpn/options.c init_options(struct options *o, const bool init_gc) · line 856
Quoted 12 lines · Antonio Quartulli
src/openvpn/options.c +1
-0@@ -850,6 +850,7 @@ init_options(struct options *o, const bool init_gc) o->use_prediction_resistance = false;#endif o->tls_timeout =2 ; + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); o->renegotiate_bytes =-1 ; o->renegotiate_seconds =3600 ; o->renegotiate_seconds_min =-1 ;This code confuses me. We now unconditionally initialize
ssl_flagsto "TLS_VER_1_2"...
Good catch!
I think this hunk should just go.
Quoted 12 lines
src/openvpn/options.c need_compatibility_before(const struct options *o, int version) · line 3146
Quoted 8 lines
src/openvpn/options.c +3
-0@@ -3140,6 +3141,21 @@ need_compatibility_before(const struct options *o, int version)static void options_set_backwards_compatible_options (struct options *o) { +/* TLS min version is not set */ +if ((o->ssl_flags &SSLF_TLS_VERSION_MIN_MASK ) ==0 ) + {... and then we check if that happens to be "0", so we can invoke the compat handler...
Quoted 1 line
The first hunk looks wrong.
It does. The "new default" is set in the else branch of this hunk. Therefore there is no need to "preset" a default value in init_options().
Cheers,
Signature · 1 line
Antonio Quartulli
PATCH v2 6/7 set TLS 1.2 as minimum by default
In reply to Antonio QuartulliDo not accept handshakes with peers trying to negotiate TLS lower than 1.2. TLS 1.1 and 1.0 are not recommended and therefore will, by default, allow TLS 1.2 as minimum version.
The minimum allowed version can still be controlled via '--tls-version-min'.
At the same time automatically set '--tls-version-min' to 1.0 if the user requires compatibility with versions onlder than 2.3.7, as that was the only version supported back then.
---
Changes from v1:
- remove bogus ssl_flags initialization in init_options()
Changes.rst | 5 +++++ doc/man-sections/generic-options.rst | 2 ++ src/openvpn/options.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+)
Changes.rst +5 -0
@@ -71,6 +71,11 @@ Deprecated features This option mainly served a role as debug option when NCP was first introduced. It should now no longer be necessary. +TLS 1.0 and 1.1 are deprecated + ``tls-version-min`` is set to 1.2 by default. OpenVPN 2.6.0 defaults + to a minimum TLS version of 1.2 as TLS 1.0 and 1.1 should be generally + avoided. Note that OpenVPN versions older than 2.3.7 use TLS 1.0 only. + ``--cipher`` argument is no longer included in ``--data-ciphers`` by default Data cipher negotiation has been introduced in 2.4.0 and been significantly improved in 2.5.0. The implicit fallback to the cipher specified in
doc/man-sections/generic-options.rst +2 -0
@@ -70,6 +70,8 @@ which mode OpenVPN is configured as. ``--data-ciphers`` - 2.3.x or lower: ``--data-cipher-fallback`` is automatically added with the same cipher as ``--cipher`` + - 2.3.6 or lower: ``--tls-version-min 1.0`` is added to the configuration + when ``--tls-version-min`` is not explicitly set. --config file Load additional config options from ``file`` where each line corresponds
src/openvpn/options.c +15 -0
@@ -3164,6 +3164,21 @@ need_compatibility_before(const struct options *o, unsigned int version)static void options_set_backwards_compatible_options (struct options *o) { +/* TLS min version is not set */ +if ((o->ssl_flags &SSLF_TLS_VERSION_MIN_MASK ) ==0 ) + { +if (need_compatibility_before (o,20307 )) + { +/* 2.3.6 and earlier have TLS 1.0 only, set minimum to TLS 1.0 */ + o->ssl_flags = (TLS_VER_1_0 <<SSLF_TLS_VERSION_MIN_SHIFT ); + } +else + { +/* Use TLS 1.2 as proper default */ + o->ssl_flags = (TLS_VER_1_2 <<SSLF_TLS_VERSION_MIN_SHIFT ); + } + } +/* Versions < 2.5.0 do need --cipher in the list of accepted ciphers. * Version 2.4 might probably does not need it but NCP was not so * good with 2.4 and ncp-disable might be more common on 2.4 peers.
Signature · 1 line
2.32.0
[Openvpn-devel] [PATCH applied] Re: set TLS 1.2 as minimum by default
Verified that v2 is indeed the same as v1, without the init options hunk. I have stared a the code a bit (looks reasonable) and run the client side tests (pass).
To test if the compat mode works, I've connected from a client that was forced with "--tls-version-max 1.0" to be incompatible with TLS 1.2
- connecting to "master with this patch", it fails ("TLS error:
Unsupported protocol"). Setting "--compat-mode 2.3.0" on the server makes it negotiate TLS 1.0 -> good, does what it says.
I have adjusted the manpage to document that "1.0" is no longer the default for --tls-version-min.
Your patch has been applied to the master branch.
commit 968569f83b1561ea4dff5b8b1f0d7768e2a18e69.
Author: Antonio Quartulli Date: Mon Sep 13 21:29:29 2021 +0200
set TLS 1.2 as minimum by default
Signed-off-by: Arne Schwabe <[email protected]...>
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22838.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 7/7 add message about changing default values
In reply to Antonio QuartulliWith OpenVPN 2.6 there are a number of default settings that are changing to more modern and safer values.
Some users may not be aware of that and may experience problematic behaviours, especially when connecting to older peers.
Add warning at startup to notify users about the change.
--- src/openvpn/options.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/openvpn/options.c +6 -0
@@ -3278,6 +3278,12 @@ options_postprocess_mutate(struct options *o)* when using --pull */ pre_connect_save (o); + +/* Give a general warning at the end of initialisation that defaults +* have changed */ +msg (M_WARN ,"Note that modernisation of defaults in OpenVPN 2.6 limits " +"compatibility with old versions. See Changes.rst and " +"--compat-mode in the manual for details." ); }/*
Signature · 1 line
2.32.0
Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
Am 04.09.21 um 11:56 schrieb Antonio Quartulli:
Quoted 22 lines
With OpenVPN 2.6 there are a number of default settings that are changing to more modern and safer values.
Some users may not be aware of that and may experience problematic behaviours, especially when connecting to older peers.
Add warning at startup to notify users about the change.
Signed-off-by Arne Schwabe <[email protected]...>Signed-off-by Antonio Quartulli <[email protected]...>--- src/openvpn/options.c | 6 ++++++ 1 file changed, 6 insertions(+)src/openvpn/options.c +0
-0@@ -3278,6 +3278,12 @@ options_postprocess_mutate(struct options *o)* when using --pull */
src/openvpn/options.c options_postprocess_mutate(struct options *o) · line 3289
Quoted 10 lines
src/openvpn/options.c +6
-0pre_connect_save (o); + +/* Give a general warning at the end of initialisation that defaults +* have changed */ +msg (M_WARN ,"Note that modernisation of defaults in OpenVPN 2.6 limits " +"compatibility with old versions. See Changes.rst and " +"--compat-mode in the manual for details." ); }/*
Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
In reply to Antonio QuartulliHi,
Quoted 1 line · Antonio Quartulli
Add warning at startup to notify users about the change.
[..]
src/openvpn/options.c options_postprocess_mutate(struct options *o) · line 3287
Quoted 6 lines
src/openvpn/options.c +5
-0+/* Give a general warning at the end of initialisation that defaults +* have changed */ +msg (M_WARN ,"Note that modernisation of defaults in OpenVPN 2.6 limits " +"compatibility with old versions. See Changes.rst and " +"--compat-mode in the manual for details." ); }
I have my doubts if this is a good way forward.
This warning will be printed on *every single startup* on OpenVPN now.
Is this useful? Or will people just ignore it. Like, "all of a sudden my Tunnelblick shows some giberrish in red at me, but the VPN is working, so let's just ignore all warnings now".
I can see that we want to tell users, but every single time, forever?
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
Hi,
Quoted 13 lines · Gert Doering
Hi,
Quoted 1 line · Antonio Quartulli
Add warning at startup to notify users about the change.
[..]
src/openvpn/options.c options_postprocess_mutate(struct options *o) · line 3287
Quoted 6 lines
src/openvpn/options.c +5
-0+/* Give a general warning at the end of initialisation that defaults +* have changed */ +msg (M_WARN ,"Note that modernisation of defaults in OpenVPN 2.6 limits " +"compatibility with old versions. See Changes.rst and " +"--compat-mode in the manual for details." ); }
Quoted 7 lines
I have my doubts if this is a good way forward.
This warning will be printed on *every single startup* on OpenVPN now.
Is this useful? Or will people just ignore it. Like, "all of a sudden my Tunnelblick shows some giberrish in red at me, but the VPN is working, so let's just ignore all warnings now".
( Actually, Tunnelblick will show it in **yellow** : )
I don't think the warning will be very useful. Most Tunnelblick users don't look at the log. Those who do usually ignore warnings. Those who look at the log and don't ignore warnings often focus on ones which sound scary but whose benefits usually outweigh the risks or ask why the VPN works even though there are warnings. (Maybe there's less of a distinction between warning and error in other languages than there is in English? Or our translations aren't as clear about the distinction?)
Tunnelblick warnings usually include a "do not warn about this again" option, which the OpenVPN log can't include.
Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
Hi
Quoted 29 lines · Jonathan K. Bullard
Hi,
Quoted 7 lines · Gert Doering
Hi,
Quoted 1 line · Antonio Quartulli
Add warning at startup to notify users about the change.
[..]
Quoted 1 line
+ /* Give a general warning at the end of initialisation that
defaults
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ * have changed */ + msg(M_WARN, "Note that modernisation of defaults in OpenVPN 2.6limits "
Quoted 1 line
Quoted 1 line
+ "compatibility with old versions. See
Changes.rstand"
Quoted 10 lines
Quoted 2 lines
+ "--compat-mode in the manual for details.");
}I have my doubts if this is a good way forward.
This warning will be printed on *every single startup* on OpenVPN now.
Is this useful? Or will people just ignore it. Like, "all of a sudden my Tunnelblick shows some giberrish in red at me, but the VPN is working, so let's just ignore all warnings now".
( Actually, Tunnelblick will show it in **yellow** : )
Quoted 9 lines
I don't think the warning will be very useful. Most Tunnelblick users don't look at the log. Those who do usually ignore warnings. Those who look at the log and don't ignore warnings often focus on ones which sound scary but whose benefits usually outweigh the risks or ask why the VPN works even though there are warnings. (Maybe there's less of a distinction between warning and error in other languages than there is in English? Or our translations aren't as clear about the distinction?)
+1
Quoted 4 lines
Tunnelblick warnings usually include a "do not warn about this again" option, which the OpenVPN log can't include.
OpenVPN-GUI for windows will show this in red (I find yellow too hard to read on light backgrounds). Looks like we also will have to implement this "do not show this again (or ever?)" feature.
Ideally, this warning should be targeted to cases like a mismatched option is detected. But that may be hard. What about printing this only when an "old" client connects (on server) or when an "old" server responds (on client)? Where "old" = 2.5 or older?
Selva
Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
Hi,
Quoted 59 lines · Selva Nair
Hi
On Mon, Sep 13, 2021 at 10:22 AM Jonathan K. Bullard <[email protected]... <mailto:[email protected]...>> wrote:
Hi,
On Mon, Sep 13, 2021 at 8:37 AM Gert Doering <[email protected]... <mailto:[email protected]...>> wrote:
>
> Hi,
>
> On Sat, Sep 04, 2021 at 11:56:29AM +0200, Antonio Quartulli wrote:
> > Add warning at startup to notify users about the change. > [..]
> > + /* Give a general warning at the end of initialisation that defaults
> > + * have changed */
> > + msg(M_WARN, "Note that modernisation of defaults in OpenVPN 2.6 limits "
> > + "compatibility with old versions. SeeChanges.rstand "
> > + "--compat-mode in the manual for details."); > > }
>
> I have my doubts if this is a good way forward.
>
> This warning will be printed on *every single startup* on OpenVPN now. >
> Is this useful? Or will people just ignore it. Like, "all of a sudden
> my Tunnelblick shows some giberrish in red at me, but the VPN is working,
> so let's just ignore all warnings now".( Actually, Tunnelblick will show it in **yellow** : )
I don't think the warning will be very useful. Most Tunnelblick users don't look at the log. Those who do usually ignore warnings. Those who look at the log and don't ignore warnings often focus on ones which sound scary but whose benefits usually outweigh the risks or ask why the VPN works even though there are warnings. (Maybe there's less of a distinction between warning and error in other languages than there is in English? Or our translations aren't as clear about the distinction?)
+1
Tunnelblick warnings usually include a "do not warn about this again" option, which the OpenVPN log can't include.
OpenVPN-GUI for windows will show this in red (I find yellow too hard to read on light backgrounds). Looks like we also will have to implement this "do not show this again (or ever?)" feature.
Quoted 5 lines
Ideally, this warning should be targeted to cases like a mismatched option is detected. But that may be hard. What about printing this only when an "old" client connects (on server) or when an "old" server responds (on client)? Where "old" = 2.5 or older?
IMHO this warning should just not be added.
It creates noise and confusion.
On top of that, we will need an even longer discussion to figure out when to remove it, even though we know it is not really benefiting users.
I vote for just dropping this patch.
If somebody feels we should find a smarter way to warn the user about possibly mismatching settings due to new default, then a new patch can be sent after this patchset is already in.
my 2 cents.
Cheers,
Signature · 1 line
Antonio Quartulli
Re: [Openvpn-devel] [PATCH 7/7] add message about changing default values
Hi
Quoted 72 lines · Antonio Quartulli
Hi,
Quoted 20 lines · Selva Nair
Hi
On Mon, Sep 13, 2021 at 10:22 AM Jonathan K. Bullard <[email protected]... <mailto:[email protected]...>> wrote:
Hi, On Mon, Sep 13, 2021 at 8:37 AM Gert Doering <[email protected]... <mailto:[email protected]...>> wrote: > > Hi, > > On Sat, Sep 04, 2021 at 11:56:29AM +0200, Antonio Quartulli wrote: > > Add warning at startup to notify users about the change. > [..] > > + /* Give a general warning at the end of initialisation that defaults > > + * have changed */ > > + msg(M_WARN, "Note that modernisation of defaults in OpenVPN 2.6 limits "Quoted 8 lines
> > + "compatibility with old versions. See Changes.rst and " > > + "--compat-mode in the manual for details."); > > } > > I have my doubts if this is a good way forward. > > This warning will be printed on *every single startup* on OpenVPNnow.
Quoted 11 lines
Quoted 2 lines
Is this useful? Or will people just ignore it. Like, "all of a
sudden
> my Tunnelblick shows some giberrish in red at me, but the VPN is working,
> so let's just ignore all warnings now".( Actually, Tunnelblick will show it in **yellow** : )
I don't think the warning will be very useful. Most Tunnelblick users don't look at the log. Those who do usually ignore warnings. Those
who
Quoted 3 lines
look at the log and don't ignore warnings often focus on ones which sound scary but whose benefits usually outweigh the risks or ask why the VPN works even though there are warnings. (Maybe there's less of
a
Quoted 1 line
distinction between warning and error in other languages than there
is
Quoted 12 lines
in English? Or our translations aren't as clear about the distinction?)
+1
Tunnelblick warnings usually include a "do not warn about this again" option, which the OpenVPN log can't include.
Quoted 9 lines
OpenVPN-GUI for windows will show this in red (I find yellow too hard to read on light backgrounds). Looks like we also will have to implement this "do not show this again (or ever?)" feature.
Ideally, this warning should be targeted to cases like a mismatched option is detected. But that may be hard. What about printing this only when an "old" client connects (on server) or when an "old" server responds (on client)? Where "old" = 2.5 or older?
Quoted 7 lines
IMHO this warning should just not be added.
It creates noise and confusion.On top of that, we will need an even longer discussion to figure out when to remove it, even though we know it is not really benefiting users.
I vote for just dropping this patch.
+1 to that. My "targeted warnings" comment was meant as a soft way of saying please drop this.. That said, had not Gert picked this up, I wouldn't have noticed until the GUI started showing red lines in the logs...
Cheers,
Selva