]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
3 years agoRemove md_kt_t and change crypto API to use const char*
Arne Schwabe [Mon, 13 Dec 2021 15:06:54 +0000 (16:06 +0100)] 
Remove md_kt_t and change crypto API to use const char*

As with the removal of cipher_kt_t, this is allows better support of
OpenSSL 3.0 and mbed TLS 3.0

Patch v2: rebase

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213150654.3993358-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211213150654.3993358-2-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdjust cipher-negotiation.rst with compat-mode changes
Arne Schwabe [Mon, 13 Dec 2021 15:25:29 +0000 (16:25 +0100)] 
Adjust cipher-negotiation.rst with compat-mode changes

This explains that 2.6 will ignore --cipher without --compat-mode and
restructures the whole paragraph to better readable.

Patch V2: Adjust grammar, use consistently "and later"

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20211213152529.3995394-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23403.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMove deprecation of SWEET32/64bit block size ciphers to 2.7
Arne Schwabe [Mon, 13 Dec 2021 15:09:50 +0000 (16:09 +0100)] 
Move deprecation of SWEET32/64bit block size ciphers to 2.7

We originally wanted to deprecated these ciphers (especially BF-CBC) with
2.6 but currently these ciphers are still too widespread to make this
transition for 2.6.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213150950.3993881-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23402.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove cipher_kt_t and change type to const char* in API
Arne Schwabe [Mon, 13 Dec 2021 15:06:53 +0000 (16:06 +0100)] 
Remove cipher_kt_t and change type to const char* in API

Make the external crypto consumer oblivious to the internal cipher
type that both mbed TLS and OpenSSL use. This change is mainly done
so the cipher type that is used can be stay a const type but instead
of an SSL library type, we now use a simple string to identify a
cipher. This has the disadvantages that we do a cipher lookup every
time a function is called that needs to query properties of a cipher.
But none of these queries are in a critical path.

This patch also fixes the memory leaks introduced by the
EVP_fetch_cipher commit by always freeing the EVP_CIPHER.

This also changes kt->cipher to be always defined with the name of
the cipher. This only affects the "none" cipher cipher which was
previously represented by kt->cipher to be NULL.

Patch v2: rebase on master

Patch v3: fix errors with mbed TLS without having md_kt to const char *
          patch also applied, fix logic inversion in tls_crypt_tk

Patch v4: fix issue if cipher does not get changed by NCP that null cipher
          is then used

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213150654.3993358-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211213150654.3993358-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoconfig-msvc.h: indicate key material export support
Lev Stipakov [Mon, 13 Dec 2021 13:52:53 +0000 (15:52 +0200)] 
config-msvc.h: indicate key material export support

MSVC build uses OpenSSL from vcpkg, which at the moment
is 1.1.1l. Key material export was added to 1.1.1, so it is safe
to indicate its support unconditionally.

This enables Windows releases to benefit from tls-ekm
data channel keys derivation.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211213135253.212-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23394.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoadd test case(s) to notice 'openvpn --show-cipher' crashing
Gert Doering [Fri, 10 Dec 2021 16:55:43 +0000 (17:55 +0100)] 
add test case(s) to notice 'openvpn --show-cipher' crashing

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211210165543.77587-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23381.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMove '--push-peer-info' documentation from 'server' to 'client options'
Gert Doering [Tue, 7 Dec 2021 13:04:36 +0000 (14:04 +0100)] 
Move '--push-peer-info' documentation from 'server' to 'client options'

While --push-peer-info can be configured on the server, it's not really
intended for that, and it ended in the "SERVER OPTIONS" section by
mishap.  Fix that.

Reported-by: Stella Ashburne <rewefie@gmx.com>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20211207130436.22187-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23325.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd argv_insert_head__empty_argv__head_only to argv tests
Arne Schwabe [Wed, 8 Dec 2021 17:06:14 +0000 (18:06 +0100)] 
Add argv_insert_head__empty_argv__head_only to argv tests

The unit test argv_insert_head__empty_argv__head_only was defined
but never used. Add it to the array of unit tests.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211208170614.3404821-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23359.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDon't use BF-CBC in unit tests if we don't have it
Max Fillinger [Wed, 8 Dec 2021 13:46:55 +0000 (14:46 +0100)] 
Don't use BF-CBC in unit tests if we don't have it

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211208134655.28905-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23354.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove max_size from buffer_list_new
Arne Schwabe [Tue, 7 Dec 2021 17:01:51 +0000 (18:01 +0100)] 
Remove max_size from buffer_list_new

This argument is never used apart from a unit test. Remove this
argument as a small cleanup.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211207170211.3275837-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23329.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove ENABLE_CRYPTO_OPENSSL ifdef inside ENABLE_CRYPTO_OPENSSL ifdef
Arne Schwabe [Tue, 7 Dec 2021 16:50:35 +0000 (17:50 +0100)] 
Remove ENABLE_CRYPTO_OPENSSL ifdef inside ENABLE_CRYPTO_OPENSSL ifdef

This ifdef is redundant.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211207165035.3274728-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23326.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMake --nobind default for --pull
Arne Schwabe [Mon, 6 Dec 2021 01:00:07 +0000 (02:00 +0100)] 
Make --nobind default for --pull

Currently we default to local binding with udp. But the majority of
configuration files actually uses --nobind in the configuration to
change the default for --client. And client protocols should normally
use a random source port. This changes the default. Local binding with
--client can still be done using --bind.

This commit refactors the current code to be more easy to add to understand
and adds the the o->pull condition as additional option to opt into setting
local binding to false.

Patch v2: add more commments

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20211206010007.3072528-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23303.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix handling an optional invalid cipher at the end of data-ciphers
Arne Schwabe [Mon, 6 Dec 2021 15:08:52 +0000 (16:08 +0100)] 
Fix handling an optional invalid cipher at the end of data-ciphers

If an optional cipher was found at the end of --data-cipher that was
not available, it would reset the error and allow non optional ciphers
to be ignored.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211206150852.3142891-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211206150852.3142891-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove key_type->hmac_length
Arne Schwabe [Wed, 1 Dec 2021 18:07:24 +0000 (19:07 +0100)] 
Remove key_type->hmac_length

This field is only set once with md_kt_size and then only read. Remove this
field and replace the read accesses with md_kt_size.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-6-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23274.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove key_type->cipher_length field
Arne Schwabe [Mon, 6 Dec 2021 01:01:51 +0000 (02:01 +0100)] 
Remove key_type->cipher_length field

This field is only set once to cipher_kt_key_size(kt.cipher) at the same
time that kt.cipher is set and therefore completely redundant.

This field was useful in the past when we supported cipher with variable
key length as this field would then store the key length that we would use.
Now that we do not support this anymore, we can simplify the code.

Patch v2: correct print message that would print bytes instead bits.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211206010151.3072787-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23304.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove cipher_ctx_get_cipher_kt and replace with direct context calls
Arne Schwabe [Wed, 1 Dec 2021 18:07:21 +0000 (19:07 +0100)] 
Remove cipher_ctx_get_cipher_kt and replace with direct context calls

We currently have a number of calls that fetch the cipher_kt from a
cipher_ctx to then do a query on the cipher_kt. Directly fetching the
desired property from the context is cleaner and helps for using the
proper APIs with OpenSSL 3.0 and mbed TLS 3.0

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23278.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agovcpkg/pkcs11-helper: compatibility with latest vcpkg
Lev Stipakov [Wed, 24 Nov 2021 10:08:38 +0000 (12:08 +0200)] 
vcpkg/pkcs11-helper: compatibility with latest vcpkg

Starting from commit 21b2dbd3 "[scripts-audit] nmake buildsystem"
vcpkg has removed NO_DEBUG support from nmake buildsystem
and now builds debug variant unconditionally. Debug flags contradict
build options hardcoded in pkcs11 nmake script (like /O2).

Remove hardcoded release options and other options which
are (also) set by vcpkg nmake buildsystem.

Bump vcpkg commit in GitHub actions.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211124100838.861-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23253.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agodoc/protocol-options.rst: Correct default for --allow-compression
Richard T Bonhomme [Mon, 29 Nov 2021 16:55:38 +0000 (16:55 +0000)] 
doc/protocol-options.rst: Correct default for --allow-compression

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211129165538.2948077-1-tincantech@protonmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23268.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove cipher_kt_var_key_size and remaining --keysize documentation
Arne Schwabe [Wed, 1 Dec 2021 18:07:22 +0000 (19:07 +0100)] 
Remove cipher_kt_var_key_size and remaining --keysize documentation

Remove --keysize from the manual page and also remove mentioning
variable key size in output of ciphers as there is no longer a way to
change the keysize.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-4-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23275.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDirectly use hardcoed OPENVPN_AEAD_TAG_LENGTH instead lookup
Arne Schwabe [Wed, 1 Dec 2021 18:07:20 +0000 (19:07 +0100)] 
Directly use hardcoed OPENVPN_AEAD_TAG_LENGTH instead lookup

We always use the same tag size for all AEAD cipher, so instead
of doing a lookup, use the tag size directly.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23273.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoImplement optional cipher in --data-ciphers prefixed with ?
Arne Schwabe [Wed, 1 Dec 2021 18:07:19 +0000 (19:07 +0100)] 
Implement optional cipher in --data-ciphers prefixed with ?

This allows to use the same configuration multiple platforms/ssl libraries
and include optional algorithms that are not available on all platforms

For example "AES-256-GCM:AES-128-GCM:?CHACHA20-POLY1305" can be used to
emulate the default behaviour of OpenVPN 2.6.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23279.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agossh_openssl.h: remove unused declaration
Lev Stipakov [Wed, 1 Dec 2021 09:20:02 +0000 (11:20 +0200)] 
ssh_openssl.h: remove unused declaration

Commit 95993a1df3 ("Refactored SSL initialisation functions")
has declared openssl_set_mydata_index(void) function but
hasn't added definition.

There hasn't been need in this function for 10 years,
so it can be safely removed.

Found by MSVC.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201092002.162-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23269.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoring_buffer.h: fix GCC warning about unused function
Lev Stipakov [Wed, 24 Nov 2021 16:03:47 +0000 (18:03 +0200)] 
ring_buffer.h: fix GCC warning about unused function

With register_ring_buffers() being declared as "static" in header file,
all translation units, which include that header, got a copy of that
function.
This causes GCC warning

  warning: "register_ring_buffers" defined but not used [-Wunused-function]

when compiling C files which include header, but don't use function.

Add "inline" keyword to silence this warning.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211124160347.1245-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23260.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoLoad OpenSSL config on Windows from trusted location
Lev Stipakov [Fri, 19 Nov 2021 01:55:48 +0000 (03:55 +0200)] 
Load OpenSSL config on Windows from trusted location

Commits

 - 92535b6 ("contrib/vcpkg-ports: add openssl port with
             --no-autoload-config option set (CVE-2121-3606)")
 - 447cfb4 ("crypto_openssl.c: disable explicit initialization on Windows
             (CVE-2121-3606)")

disabled OpenSSL config loading functionality, which could be
exploited by loading config from untrusted locations.

This feature might be useful for some users. This brings it back
and sets OpenSSL enviroment variables

 OPENSSL_CONF, OPENSSL_ENGINES, OPENSSL_MODULES

which are used to load config, engines and modules, to a trusted location.
The location is constructed based on installation path, read from registry
on startup.
If installation path cannot be read, Windows\System32 is used as a
fallback.

While on it, remove unused "bool impersonate_as_system();" declaration.

Trac: #1296

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20211119015548.687-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23248.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agodoc/man (vpn-network-options): fix foreign_option_{n} typo
Todd Zullinger [Mon, 22 Nov 2021 11:41:04 +0000 (12:41 +0100)] 
doc/man (vpn-network-options): fix foreign_option_{n} typo

In 2da29362 (Improve the documentation for --dhcp-option, 2020-08-16),
`foreign_option_{n}` became plural between the first and second versions
of the patch.  Correct it.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211122114104.4814-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23217.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUpdate IRC information in CONTRIBUTING.rst
Todd Zullinger [Mon, 22 Nov 2021 11:40:18 +0000 (12:40 +0100)] 
Update IRC information in CONTRIBUTING.rst

The developer IRC channel is now on libera.chat.  Update
CONTRIBUTING.rst to match the wiki.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211122114018.4708-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23218.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agodoc link-options.rst: Use free open-source dynamic-DNS provider URL
Richard T Bonhomme [Wed, 3 Nov 2021 20:20:14 +0000 (20:20 +0000)] 
doc link-options.rst: Use free open-source dynamic-DNS provider URL

Trac: #1417

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211103202014.1121244-2-tincantech@protonmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23095.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoInclude --push-remove in the output of --help.
Gert Doering [Wed, 17 Nov 2021 06:44:42 +0000 (07:44 +0100)] 
Include --push-remove in the output of --help.

"push-remove" has been in OpenVPN since 2.4, but managed to stay hidden
from the "--help" output.  Add.

Reported-by: mike tancsa <mike@sentex.net>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20211117064442.15899-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23194.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoLog messages: Replace NCP with --data-ciphers (NFC)
Richard T Bonhomme [Tue, 16 Nov 2021 15:08:23 +0000 (15:08 +0000)] 
Log messages: Replace NCP with --data-ciphers (NFC)

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211116150823.631970-1-tincantech@protonmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23191.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMove IV_TCPNL from comp_generate_peer_info_string to push_peer_info
Arne Schwabe [Sun, 14 Nov 2021 13:03:11 +0000 (14:03 +0100)] 
Move IV_TCPNL from comp_generate_peer_info_string to push_peer_info

This IV variable has nothing to do with compression and should not
depend if OpenVPN is compiled with USE_COMP. So move it to the
other generic IV variables.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211114130311.4043536-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23182.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse network address for emulated DHCP server as a default
Lev Stipakov [Tue, 9 Nov 2021 01:59:27 +0000 (03:59 +0200)] 
Use network address for emulated DHCP server as a default

This is the rebase of original Selva Nair's patch
which hasn't been merged:

  https://sourceforge.net/p/openvpn/mailman/message/34674818/

and documentation change to reflect code changes, which
is basically a revert of another Selva's patch (which got merged):

https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13387.h
tml

For subnet topology use "offset 0" as default for
calculating DHCP server address, which makes it equal
to the network address.

There is no know reason why non-zero default offset
is needed. Besides, offset -1 breaks subnet /30 case,
which in some cases is pushed by OpenVPN Cloud product.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211109015927.311-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23156.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAllow loading of non default providers
Arne Schwabe [Fri, 12 Nov 2021 13:02:31 +0000 (14:02 +0100)] 
Allow loading of non default providers

This allows OpenVPN to load non-default providers. This is mainly
useful for loading the legacy provider with --providers legacy default

Patch v4: use spaces to seperate providers, unload providers.
Patch v5: General cleanup, rename option to --providers, add
          option to usage() and add an entry to Changes.rst
Patch v6: allow --providers also to be used (and be ignored) with mbed TLS

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211112130231.3799480-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211112130231.3799480-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd macos OpenSSL 3.0 and ASAN builds
Arne Schwabe [Tue, 19 Oct 2021 18:31:26 +0000 (20:31 +0200)] 
Add macos OpenSSL 3.0 and ASAN builds

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-21-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23018.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse TYPE_do_all_provided function for listing cipher/digest
Arne Schwabe [Tue, 9 Nov 2021 14:48:11 +0000 (15:48 +0100)] 
Use TYPE_do_all_provided function for listing cipher/digest

With OpenSSL 3.0 the use of nid values is deprecated and new algorithms
do not even have NID values anymore.

This also works nicely with providers now:

   openvpn --provider legacy:default --show-ciphers

shows more ciphers (e.g. BF-CBC) than just

   openvpn --show-ciphers

when compiled with OpenSSL 3.0

Patch v4: Use SIZE instead size(x)/sizeof(*x)

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211109144811.3426928-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23142.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix error in example firewall.sh script
Adrian [Sun, 7 Nov 2021 17:40:00 +0000 (18:40 +0100)] 
Fix error in example firewall.sh script

The man page says:
[!] -s, --source address[/mask][,...]

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20211107174000.16210-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23128.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoREADME.down-root: Fix plugin module name
Ville Skyttä [Sun, 7 Nov 2021 18:38:05 +0000 (19:38 +0100)] 
README.down-root: Fix plugin module name

The module name is openvpn-plugin-down-root.so, not openvpn-down-root.so.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20211107183805.8357-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23130.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove unused havege.h header
Max Fillinger [Sun, 7 Nov 2021 16:05:08 +0000 (17:05 +0100)] 
Remove unused havege.h header

This header was removed in mbedtls 3. Luckily, we weren't actually
using it, it seems.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211107160508.3935-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23126.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRefactor early initialisation and uninitialisation into methods
Arne Schwabe [Sat, 6 Nov 2021 18:00:55 +0000 (19:00 +0100)] 
Refactor early initialisation and uninitialisation into methods

This put the early initialisation and uninitialisation that needs to
happen between option parsing and post processing into small methods.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20211106180055.3073072-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23110.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoCompletely remove DES checks
Arne Schwabe [Sun, 7 Nov 2021 09:01:38 +0000 (10:01 +0100)] 
Completely remove DES checks

We already removed the check in d67658fee for OpenSSL 3.0. This removes the
checks entirely for all crypto libraries.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211107090138.3150187-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23115.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove custom PRNG function
Arne Schwabe [Sun, 7 Nov 2021 09:01:47 +0000 (10:01 +0100)] 
Remove custom PRNG function

Remove the custom PRNG from OpenVPN and instead rely always on the random
number generator from the SSL library. The only place that this is in a
performance critical place is the CBC IV generation. Even with that in mind
a micro benchmark shows no significant enough change with OpenSSL 3.0:

------------------------------------------------------------------------
Benchmark                              Time             CPU   Iterations
------------------------------------------------------------------------
BM_OpenSSL_RAND                      842 ns          842 ns       753401
BM_OpenVPN_RAND                      743 ns          743 ns       826690
BM_Encrypt_AES_CBC_dummy            1044 ns         1044 ns       631530
BM_Encrypt_AES_CBC_RAND_bytes       1892 ns         1891 ns       346566
BM_Encrypt_AES_CBC_prng_bytes       1818 ns         1817 ns       373970

(source https://gist.github.com/schwabe/029dc5e5a690df8e2e3f774a13ec7bce)

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <20211107090147.3150261-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23116.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoresolvconf fails with -p
Sergio E. Nemirowski [Sat, 29 May 2021 01:35:16 +0000 (04:35 +0300)] 
resolvconf fails with -p

resolvconf -p
resolvconf: Error: Command not recognized

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20210529013516.767555-1-sergio@outerface.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22467.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix tls-version-min default once again
Selva Nair [Tue, 2 Nov 2021 04:23:14 +0000 (00:23 -0400)] 
Fix tls-version-min default once again

commit 51be733ba236610dff6a1c361cf59172db97473a
claimed to correct this but did not do it properly.
(my fault). The check whether tls-version-min is set
by the user or not was still wrong.

Hope this fixes it for good.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211102042314.19113-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23091.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd insecure tls-cert-profile options
Arne Schwabe [Fri, 29 Oct 2021 11:24:07 +0000 (13:24 +0200)] 
Add insecure tls-cert-profile options

The recent deprecation of SHA1 certificates in OpenSSL 3.0 makes it
necessary to reallow them in certain deployments. Currently this works
by using the hack of using tls-cipher "DEFAULT:@SECLEVEL=0".

Add "insecure" as option to tls-cert-profile to allow setting a seclevel of 0.

Patch v4: fix default accidentially changed to insecure

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211029112407.2004234-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23076.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAvoid memory leak in hmac_ctx_new (OpenSSL 3.0 only)
Selva Nair [Sat, 30 Oct 2021 18:57:56 +0000 (14:57 -0400)] 
Avoid memory leak in hmac_ctx_new (OpenSSL 3.0 only)

In OpenSSL 3.0, fetched algorithms must be freed
(down referenced). In this case, though EVP_MAC_CTX_new()
keeps a reference to 'hmac', it up-refs it. So we have to free
it here before return.

(Tested using an enable-asan build).

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211030185756.1831-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23080.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix function name in DH error message
Arne Schwabe [Fri, 5 Nov 2021 14:50:56 +0000 (15:50 +0100)] 
Fix function name in DH error message

This was noticed by Steffan.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211105145056.2907568-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23097.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix error when BF-CBC is not available
Arne Schwabe [Tue, 19 Oct 2021 18:31:24 +0000 (20:31 +0200)] 
Fix error when BF-CBC is not available

Through the multiple iteration of allowing OpenVPN to run without
BF-CBC we accidentially made a regression and still required BF-CBC.

This patch fixes the code path and restores its intended function.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-19-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23010.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoImplement DES ECB encrypt via EVP_CIPHER api
Arne Schwabe [Fri, 29 Oct 2021 11:11:08 +0000 (13:11 +0200)] 
Implement DES ECB encrypt via EVP_CIPHER api

Even though DES is super outdated and also NTLM is super outdated,
eliminating the warnings for OpenSSL 3.0 is still a step in the right
direction and using the correct APIs. We cheat a bit by using 3DES instead
of DES to avoid needing legacy provider for DES encryption for now.

Patch v4: add unit test, use 3DES to avoid legacy provider for now

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211029111109.2003101-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23078.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove dependency on BF-CBC existance from test_ncp
Arne Schwabe [Tue, 19 Oct 2021 18:31:19 +0000 (20:31 +0200)] 
Remove dependency on BF-CBC existance from test_ncp

The test_check_ncp_ciphers_list test assumed that BF-CBC is always
available, which is no longer the case with OpenSSL 3.0. Rewrite the
test to not rely on BF-CBC to be available.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-14-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23003.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse EVP_MD_get0_name instead EV_MD_name
Arne Schwabe [Tue, 19 Oct 2021 18:31:17 +0000 (20:31 +0200)] 
Use EVP_MD_get0_name instead EV_MD_name

Use the new name for the function as it indicates with
get0 the ownership of the returned value

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-12-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23016.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoReplace EVP_get_cipherbyname with EVP_CIPHER_fetch
Arne Schwabe [Tue, 19 Oct 2021 18:31:16 +0000 (20:31 +0200)] 
Replace EVP_get_cipherbyname with EVP_CIPHER_fetch

In OpenSSL 3.0 EVP_get_cipherbyname return a non NULL algorithm
even if the algorithm is not available with the currently available
provider. Luckily EVP_get_cipherbyname can be used here as drop
in replacement and returns only non NULL if the algorithm is actually
currently supported.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-11-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23005.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse EVP_PKEY_get_group_name to query group name
Arne Schwabe [Fri, 29 Oct 2021 11:11:09 +0000 (13:11 +0200)] 
Use EVP_PKEY_get_group_name to query group name

EC_Key methods are deprecated in OpenSSL 3.0. Use
EVP_PKEY_get_group_name instead to query the EC group name from an
EVP_PKEY and add a compatibility function for older OpenSSL versions.

Patch v4: adjust compatibility function and remove accidently included
fragment of unrelated patch.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20211029111109.2003101-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23077.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd --with-openssl-engine autoconf option (auto|yes|no)
Arne Schwabe [Tue, 19 Oct 2021 18:31:08 +0000 (20:31 +0200)] 
Add --with-openssl-engine autoconf option (auto|yes|no)

This allows to select engine support at configure time. For OpenSSL 1.1 the
default is not changed and we detect if engine support is available.

Engine support is deprecated in OpenSSL 3.0 and for OpenSSL 3.0 the default
is to disable engine support as engine support is deprecated and generates
compiler warnings which in turn also break -Werror.

By using --with-openssl-engine=no or --with-openssl-engine=yes engine
support can be forced on or off. If it is enabled but not detected an
error will be thown.

This commit cleans up the configure logic a bit and removes the
ENGINE_cleanup checks as we can just assume that it will be also
available as macro or function if the other engine functions are
available. Before the cleanup we would only check for the existance
of engine.h if ENGINE_cleanup was not found.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23000.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse new EVP_MAC API for HMAC implementation
Arne Schwabe [Tue, 19 Oct 2021 18:31:07 +0000 (20:31 +0200)] 
Use new EVP_MAC API for HMAC implementation

The old API is deprecated in OpenSSL 3.0 and the new API does not yet
exist in OpenSSL 1.1. Emulating the new API would be more complex than
just having two implementations. So this switches to a new hmac
implementation for OpenSSL 3.0.

Unfortunately the new API does not have an easy to reset an HMAC,
so we need to keep the key around to emulate a reset functionality.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23013.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDo not allow CTS ciphers
Arne Schwabe [Tue, 19 Oct 2021 18:31:21 +0000 (20:31 +0200)] 
Do not allow CTS ciphers

We do not support CTS algorithms (cipher text stealing) algorithms.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-16-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23002.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDon't manually free DH params in OpenSSL 3
Max Fillinger [Mon, 25 Oct 2021 14:53:14 +0000 (16:53 +0200)] 
Don't manually free DH params in OpenSSL 3

When the EVP_PKEY object with the Diffie-Hellman parameters is passed
to SSL_CTX_set0_tmp_dh_pkey, it does not create a copy but stores the
pointer in the SSL_CTX. Therefore, we should not free it.

The EVP_PKEY will be freed automatically when we free the SSL_CTX.

Trac: #1436

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by:
Message-Id: <20211025145314.23009-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/search?l=mid&q=20211025145314.23009-1-maximilian.fillinger@foxcrypto.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoEnsure the current common_name is in the environment for scripts
Selva Nair [Sat, 23 Oct 2021 00:07:05 +0000 (20:07 -0400)] 
Ensure the current common_name is in the environment for scripts

When username-as-common-name is in effect, the common_name
is "CN" from the certificate for auth-user-pass-verify. It gets
changed to "username" after successful authentication. This
changed value gets into the env when client-connect script is
called.

However, "common_name" goes through the cycle of being
"CN", then "username" during every reauth (renegotiation).
As the client-connect script is not called during reneg, the changed
value never gets back into the env. The end result is that the
disconnect script gets "common_name=<CN>" instead of the username.
Unless no reneg steps have happened before disconnect.
(For a more detailed analysis see
https://community.openvpn.net/openvpn/ticket/1434#comment:12)

Fix by adding common_name to env whenever it changes.

Trac: #1434
Very likely applies to #160 as well, but that's too old and
some of the relevant code path has evolved since then.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211023000706.25016-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23051.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove DES key fixup code
Arne Schwabe [Tue, 19 Oct 2021 18:31:13 +0000 (20:31 +0200)] 
Remove DES key fixup code

This code mainly sets the parity bits in the DES keys. As mbed TLS and
OpenSSL already ignore these bits in the DES key and since DES is
deprecated, remove this special DES code that is not even needed by
the libraries.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-8-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23014.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix build with compression disabled
Max Fillinger [Thu, 21 Oct 2021 11:50:37 +0000 (13:50 +0200)] 
Fix build with compression disabled

When building with both --disable-lz4 and --disable-lzo, the function
comp_non_stub_enabled and various flags are not defined. One of the
places where it is used in options.c was not put behind an #ifdef, which
caused compilation to fail.

Trac: #1435
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211021115037.27056-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23035.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove DES check with OpenSSL 3.0
Arne Schwabe [Tue, 19 Oct 2021 18:31:10 +0000 (20:31 +0200)] 
Remove DES check with OpenSSL 3.0

DES is very deprecated and accidently getting on the of the 16 insecure
keys that OpenSSL checks is extremely unlikely so we no longer use the
deprecated functions without replacement in OpenSSL 3.0.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-5-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23004.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse EVP_PKEY based API for loading DH keys
Arne Schwabe [Tue, 19 Oct 2021 18:31:11 +0000 (20:31 +0200)] 
Use EVP_PKEY based API for loading DH keys

OpenSSL 3.0 replaces the DH API with a generic EVP_KEY based API to
load DH parameters.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-6-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23015.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDeprecate --ecdh-curve with OpenSSL 3.0 and adjust mbed TLS message
Arne Schwabe [Tue, 19 Oct 2021 18:31:12 +0000 (20:31 +0200)] 
Deprecate --ecdh-curve with OpenSSL 3.0 and adjust mbed TLS message

OpenSSL 3.0 deprecates SSL_CTX_set_tmp_ecdh() in favour of
SSL_CTX_set1_groups(3). We already support the SSL_CTX_set1_groups
using the --tls-groups. Adjust both mbed TLS and OpenSSL 3.0 to
say that --ecdh-curve is ingored and --tls-groups should be used.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-7-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22999.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd small unit test for testing HMAC
Arne Schwabe [Tue, 19 Oct 2021 18:31:23 +0000 (20:31 +0200)] 
Add small unit test for testing HMAC

This just adds a very simple unit test to check that the HMAC
implementation produces a well known hash.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-18-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23012.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd message when decoding PKCS12 file fails.
Arne Schwabe [Tue, 19 Oct 2021 18:31:22 +0000 (20:31 +0200)] 
Add message when decoding PKCS12 file fails.

Currently we never display the OpenSSL error stack when decoding a
PCKS12 file fails. With LibreSSL defaulting to RC2-40-CBC, the failure
might not be a wrong password but can actually be an unsupported encoding,
seeing the error stack is really helpful (example from OpenSSL 3.0):

error:0308010C:digital envelope routines:inner_evp_generic_fetch:
  unsupported:crypto/evp/evp_fetch.c:346:Global default library
  context, Algorithm (RC2-40-CBC : 0), Properties ()

to pinpoint the issue

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-17-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23017.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRequire EC key support in Windows builds
Selva Nair [Tue, 19 Oct 2021 03:41:18 +0000 (23:41 -0400)] 
Require EC key support in Windows builds

Do not support the use of OPENSSL_NO_EC on Windows.

We build Windows releases with EC key support enabled in
OpenSSL and there is no reason to disable it in OpenVPN.

TODO: If there are no platforms of interest where EC support
cannot be enabled in OpenSSL, we should make !defined(OPENSSL_NO_EC)
a general requirement.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019034118.28987-3-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22952.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove error injection into OpenSSL from cryptoapi.c
Selva Nair [Tue, 19 Oct 2021 03:41:17 +0000 (23:41 -0400)] 
Remove error injection into OpenSSL from cryptoapi.c

There is no advantage in injecting/redirecting errors into OpenSSL
as we can, and we do, report these directly using our own logging
functions. This code probably originated from CAPI engine where
such usage made sense.

And, in cases when the error is within OpenSSL, guessing a
reason (like out of memory) and inserting it into the
OpenSSL error stack looks pointless.

As a bonus, the code gets leaner and a lot less cruft.

Some error messages are slightly edited and all near-fatal
errors are logged with M_NONFATAL and "Error in cryptoapicert:"
prefix.

Also remove some defines for mingw that we do not need.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211019034118.28987-2-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22951.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRequire Windows CNG keys for cryptoapicert
Selva Nair [Tue, 19 Oct 2021 03:41:16 +0000 (23:41 -0400)] 
Require Windows CNG keys for cryptoapicert

Some legacy tokens do not have drivers compatible with
Windows Cryptography Next generation API (CNG) and require
the old CAPI interface. These also do not support anything
but RSA_PKCS1 signatures with MD5+SHA1 digests, and can only
handle TLS 1.1 and older. Continuing to support these add
too much maintenance burden especially with newer version of
OpenSSL and has very little benefit.

- Remove support for non CNG interface which also removes
  support for such legacy tokens. Keys uploaded to Windows
  certificate stores are not affected.

- Remove support for OpenSSL versions < 1.1.1 in Windows
  builds

Note: TLS 1.0 and 1.1 is still supported. Only signing with legacy
tokens that have drivers incompatible with CNG is affected. These
can still be used with pkcs11-helper.

Tested on Windows 10 with RSA and EC keys in store

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211019034118.28987-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22953.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoGitHub Actions: use latest working lukka/run-vcpkg
Lev Stipakov [Fri, 15 Oct 2021 21:31:15 +0000 (00:31 +0300)] 
GitHub Actions: use latest working lukka/run-vcpkg

Latest lukka/run-vcpkg@v10 seem to break non-manifest
mode with custom triplets, so revert to latest working version.

While on it, bump vcpkg commit.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211015213115.516-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=20211015213115.516-1-lstipakov@gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix some more wrong defines in config-msvc.h
Selva Nair [Fri, 15 Oct 2021 17:53:30 +0000 (13:53 -0400)] 
Fix some more wrong defines in config-msvc.h

Not sure where these came from, but here goes:

S_IRUSR = 0 --> _S_IREAD
S_IWUSR = 0 --> _S_IWRITE

ENABLE_DEBUG is on, but I do not think we want it in production build
(removed).

S_IRGRP is not defined but seems to be used. I have added it, remove if
not required.
This define is based on mingw and matches MS docs on <filesystem>
(https://docs.microsoft.com/en-us/cpp/standard-library/filesystem-enumerati
ons?view=msvc-160)

Trac: #1430
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20211015175330.15760-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22942.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix the "default" tls-version-min setting
Selva Nair [Fri, 15 Oct 2021 04:32:27 +0000 (00:32 -0400)] 
Fix the "default" tls-version-min setting

commit 968569f83b1561ea4dff5b8b1f0d7768e2a18e69
defined TLS 1.2 as the minimum version if not set
by user. But the patch introduced two errors:

(i) ssl_flags is overwritten without regard to other
    options set in the flags
(ii) Any tls-version-max set by the user is not taken into
     account.
Makes it impossible to set tls-version-max without also setting
tls-version-min along with loss of other bits set in ssl_flags.

Fix it.

The fix retains the original intent when possible, and tries to
use the maximum possible value when it cannot be set to TLS 1.2
without conflicting with user-specified tls-version-max, if any.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211015043227.10679-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22939.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoconfig-msvc.h: fix OpenSSL-related defines
Lev Stipakov [Thu, 14 Oct 2021 01:04:36 +0000 (04:04 +0300)] 
config-msvc.h: fix OpenSSL-related defines

Commit 2778443 ("msvc: OpenSSL 1.1.x support") added OpenSSL-related
defines to config-msvc.h, which in Linux/MinGW are set during configure
step.

Turns out that OPENSSL_NO_EC was added by mistake - it breaks loading EC
keys.

Commit bc36d9d ("Remove OpenSSL configure checks") removed
abovementioned defines. Adjust config-msvc.h accordingly.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211014010436.359-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22934.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agomsvc: fix product version display
Lev Stipakov [Wed, 13 Oct 2021 23:02:27 +0000 (02:02 +0300)] 
msvc: fix product version display

PRODUCT_VERSION_PATCH, defined in version.m4, already includes dot (like
".4"),
so no need to include it here.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211013230227.199-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22931.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoconfigure: remove useless -Wno-* from default CFLAGS
Antonio Quartulli [Tue, 5 Oct 2021 12:27:36 +0000 (14:27 +0200)] 
configure: remove useless -Wno-* from default CFLAGS

Historically we always had -Wno-unused-parameter and
-Wno-unused-function enabled along with -Wall.

When we made -Wall a default option, we carried the other two along and
made them default too (in 2018).

Now the code is much cleaner compared to the past and we do not really
require -Wno-unused-parameter and -Wno-unused-function anymore.

Actually they may hide really unused functions that we'd need to
cleanup.

For this reason remove -Wno-unused-parameter and -Wno-unused-function
for good from the default CFLAGS.

Any new warning should rather be fixed than hidden.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211005122736.4060-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22917.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix loading PKCS12 files on Windows
Lev Stipakov [Wed, 6 Oct 2021 09:07:09 +0000 (12:07 +0300)] 
Fix loading PKCS12 files on Windows

Starting from 2.5.4 we have switched to MSVC builds,
including dependencies such as OpenSSL.

When we link with natively-built OpenSSL .DLLs
(not cross compiled with MinGW), we are expected to include
applink.c, which provides glue between OpenSSL BIO layer
and compiler run-time. This doesn't apply to ARM64.

Failure to do that results in "no OPENSSL_Applink" fatal error
when calling, for example, d2i_PKCS12_fp(), which we do when
loading PKCS12 files.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211006090709.200-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22920.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoset_lladdr: use networking API net_addr_ll_set() on Linux
Antonio Quartulli [Fri, 3 Sep 2021 16:11:13 +0000 (18:11 +0200)] 
set_lladdr: use networking API net_addr_ll_set() on Linux

Make sure that set_addr() uses the proper networking backend when
setting the LL address of a TAP interface.

This operation was overlooked while implementing the networking APIs on
the Linux platform.

Reported-by: Jan Hugo Prins <jprins@betterbe.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Tested-by: Jan Hugo Prins <jprins@betterbe.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210903161113.30498-2-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22791.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agonetworking: add missing brackets
Antonio Quartulli [Wed, 29 Sep 2021 11:59:05 +0000 (13:59 +0200)] 
networking: add missing brackets

Our codestyle demands having brackets also around if-blocks made up
by one line only.

In patch "networking: add and implement net_addr_ll_set() API" this
rule was not respected and a new one-line-if-block was added with no
brackets.

Fix this by adding the related brackets as needed.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210929115905.1281-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22908.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agonetworking: add and implement net_addr_ll_set() API
Antonio Quartulli [Fri, 3 Sep 2021 16:11:12 +0000 (18:11 +0200)] 
networking: add and implement net_addr_ll_set() API

When running in TAP mode we may need to set the LL address of the
interface, if requested by the user.

This operation was overlooked when implementing the networking API and
it still relies on iproute/net-tools being installed.

Basically this means that when compiling OpenVPN on a system without
iproute2/net-tools and the user uses the "lladdr" config directive,
OpenVPN will fail to se the LL address of the interface.

With this patch a new API is introduced and it is implemented for both
SITNL and iproute2 backends.

Reported-by: Jan Hugo Prins <jprins@betterbe.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210903161113.30498-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22792.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoGitHub Actions: remove Ubuntu 16.04 environment
Lev Stipakov [Sun, 26 Sep 2021 06:10:46 +0000 (09:10 +0300)] 
GitHub Actions: remove Ubuntu 16.04 environment

Starting from 20th of September, GitHub has removed Ubuntu 16.04
environment from Actions. Safely remove it from our build script
where we already have Ubuntu 18.04 and 20.04.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210926061046.212-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22904.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoBUILD: enable CFG and Spectre mitigation for MSVC
Ilya Shipitsin [Wed, 22 Sep 2021 09:57:55 +0000 (14:57 +0500)] 
BUILD: enable CFG and Spectre mitigation for MSVC

found by BinSkim

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210922095756.1929-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22870.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agodoc: fix indentation in protocol-options.rst
Antonio Quartulli [Tue, 21 Sep 2021 12:15:19 +0000 (14:15 +0200)] 
doc: fix indentation in protocol-options.rst

The bullet points are not proeprly indented and they trigger
the following error/warning:

rst2man.py openvpn.8.rst > openvpn.8
man-sections/protocol-options.rst:62: (ERROR/3) Unexpected indentation.
man-sections/protocol-options.rst:67: (WARNING/2) Block quote ends without
a blank line; unexpected unindent.
rst2man.py openvpn-examples.5.rst > openvpn-examples.5
rst2html.py openvpn.8.rst > openvpn.8.html
man-sections/protocol-options.rst:62: (ERROR/3) Unexpected indentation.
man-sections/protocol-options.rst:67: (WARNING/2) Block quote ends without
a blank line; unexpected unindent.

Fix indentation and add white lines as expected.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210921121519.18912-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22867.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoSet TLS 1.2 as minimum by default
Antonio Quartulli [Mon, 13 Sep 2021 19:29:29 +0000 (21:29 +0200)] 
Set TLS 1.2 as minimum by default

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 we 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 <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210913192929.26391-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22838.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agocompat-mode: add --data-cipher-fallback auomatically if requested
Antonio Quartulli [Sat, 4 Sep 2021 09:56:27 +0000 (11:56 +0200)] 
compat-mode: add --data-cipher-fallback auomatically if requested

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'.

This happens only when the user specifies compat-mode with a version
older than 2.4.0.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210904095629.6273-6-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22798.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agodo not include --cipher value in data-ciphers
Antonio Quartulli [Sat, 4 Sep 2021 09:56:26 +0000 (11:56 +0200)] 
do not include --cipher value in data-ciphers

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.

Adjust manpage to make clear that using --cipher in today's config really
is a thing from the past, and --data-ciphers should be used instead.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210904095629.6273-5-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22799.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agomulti: remove extra brackets in multi_process_incoming_link()
Antonio Quartulli [Mon, 13 Sep 2021 14:45:31 +0000 (16:45 +0200)] 
multi: remove extra brackets in multi_process_incoming_link()

After getting rid of all PF related ifdef blocks, a pair of
useless brackets has remained in multi_process_incoming_link().
These brackets do nothing at the moment and can be just removed.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210913144531.8889-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22834.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoconfigure: search also for rst2{man, html}.py
Antonio Quartulli [Fri, 27 Aug 2021 14:48:07 +0000 (16:48 +0200)] 
configure: search also for rst2{man, html}.py

On some systems the rst2{man,html} executables may have a slightly
different name, like rst2{man,html}.py.

Add this name variation to the Generic Programs check.

This specific variation is found on Gentoo Linux.

Cc: David Sommerseth <davids@openvpn.net>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210827144807.27004-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22777.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd building man page on Windows
Lev Stipakov [Wed, 25 Aug 2021 16:47:52 +0000 (19:47 +0300)] 
Add building man page on Windows

Use rst2html to build html from rst. Ignore errors,
this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html
and add html man page to artifacts.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Message-Id: <20210825164752.808-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22771.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove support for PF (Packet Filter)
Antonio Quartulli [Fri, 27 Aug 2021 19:00:14 +0000 (21:00 +0200)] 
Remove support for PF (Packet Filter)

OpenVPN shipped a small packet filtering tool called PF. It has never
been straightforward as it required a plugin to work. On top of that,
keeping PF support, makes the code more complicated and increases the
maintenance cost of OpenVPN.

PF itself is not actually maintained at all and there is little
motivation in keeping it alive.

Some years ago an IPv6 extension for PF was proposed, but it was never
picked up for the reasons above.

External (and more appropriate) tools can still be used to implement
packet filtering on the OpenVPN interface.

Drop PF support for good.

Note that IDs used for external communication (i.e. to the plugin
or management interface) have been commented out, but not removed, as
they should not be used in the future.

v2:
* changed // to /* */
* changed "NOT IMPLEMENTED" to "REMOVED FEATURE"
* removed extra empty lines after removing ifdef blocks
* clarified on IRC that tls_final has to be removed and therefore that
  hunk is correct
* removed mi_prefix() function as it is now unused

Cc: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210827190014.12640-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22780.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoCI: github actions: keep "pdb" in artifacts
Ilya Shipitsin [Thu, 26 Aug 2021 10:02:21 +0000 (15:02 +0500)] 
CI: github actions: keep "pdb" in artifacts

"pdb" files are important for example, for BinSkim analysis. Let us
keep them

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210826100221.1378-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22769.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix Ubuntu spelling and duplicate run in Github Actions
Arne Schwabe [Wed, 8 Sep 2021 14:27:24 +0000 (16:27 +0200)] 
Fix Ubuntu spelling and duplicate run in Github Actions

Ubuntu spelling was wrong and the matrix for operating system
does not do anything but run the same build twice.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210908142724.3391935-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22822.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDetect unusable ciphers on patched OpenSSL of RHEL/Centos
Arne Schwabe [Wed, 18 Aug 2021 21:33:53 +0000 (23:33 +0200)] 
Detect unusable ciphers on patched OpenSSL of RHEL/Centos

OpenSSL on RHEL 8 and CentOS 8 system when these system are put into
FIPS mode need extra code to figure out if a specific cipher algorithm
is usable on these system. This is particularly problem in data-ciphers
as the errors might occur much later when a client connects and as these
cipher are not caught during config initialisation.

This also prepares for adding Chacha20-Poly1305 when available to
data-ciphers by making the detection logic used to check if
cipher_kt_get returns non-NULL work on these systems.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20210818213354.687736-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22746.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoreject compression by default
Antonio Quartulli [Sat, 4 Sep 2021 09:56:25 +0000 (11:56 +0200)] 
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 <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
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 <gert@greenie.muc.de>
3 years agocompat-mode: allow user to specify version to be compatible with
Antonio Quartulli [Wed, 8 Sep 2021 07:26:06 +0000 (09:26 +0200)] 
compat-mode: allow user to specify version to be compatible with

This changes introduces the basic infrastructure required
to allow the user to specify a specific OpenVPN version to be
compatible with.

The next commits 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 <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by:
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210908072606.5863-1-a@unstable.cc>
URL: https://www.mail-archive.com/search?l=mid&q=20210908072606.5863-1-a@unstable.cc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoInclude Chacha20-Poly1305 into default --data-ciphers when available
Arne Schwabe [Wed, 18 Aug 2021 21:33:54 +0000 (23:33 +0200)] 
Include Chacha20-Poly1305 into default --data-ciphers when available

Most TLS 1.3 libraries inlcude the Chacha20-Poly1305 based cipher suite
beside the AES-GCM based ones int he list of default ciphers suites.
Chacha20-Poly1305 is accepted as good alternative AEAD algorithm to the
AES-GCM algorithm by crypto community.

Follow this and include Chacha20-Poly1305 by default in data-ciphers
when available. This makes picking Chacha20-Poly1305 easier as it only
requires to change server (by changing priority) or client side (removing
AES-GCM from data-ciphers) to change to Chacha20-Poly1305.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210818213354.687736-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22745.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoman/protocol-options: add missing ending metachar
Antonio Quartulli [Fri, 27 Aug 2021 14:56:56 +0000 (16:56 +0200)] 
man/protocol-options: add missing ending metachar

A code string terminating character (`) is missing, thus leading to the
following warning:

man-sections/protocol-options.rst:99: (WARNING/2) Inline interpreted text
or phrase reference start-string without end-string.

Add missing char at the end of the code word.

Cc: David Sommerseth <davids@openvpn.net>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210827145656.21646-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22779.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoroute.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED
Antonio Quartulli [Thu, 26 Aug 2021 06:17:25 +0000 (08:17 +0200)] 
route.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED

IN6_IS_ADDR_UNSPECIFIED on most systems is defined as a macro that
expects a struct in6_addr* argument.

In one instance we are passing the right address but using a wrong type.
Fix this invocation by properly passing the right pointer.

This issue might become more critical on systems implementing
IN6_IS_ADDR_UNSPECIFIED as a function rather than a macro.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by:
Message-Id: <20210826061725.22169-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22767.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMinor doc correction: tls-crypt-v2 key generation
Selva Nair [Sun, 22 Aug 2021 15:28:20 +0000 (11:28 -0400)] 
Minor doc correction: tls-crypt-v2 key generation

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210822152820.7072-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22747.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoIntroduce webauth auth pending method and deprecate openurl
Arne Schwabe [Fri, 13 Aug 2021 11:55:42 +0000 (13:55 +0200)] 
Introduce webauth auth pending method and deprecate openurl

The experience with openurl/OPEN_URL has shown that just sending
a URL to a client is not enough and we often need different
behaviour of the client depending on circumstances. Replace
OPEN_URL with a more flexible WEB_AUTH pending auth method.

Patch v2: use WEB_AUTH instead WEBAUTH
Patch v3: incooperate other comments from Selva

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20210813115542.2794-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22737.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix client-pending-auth help message in management interface
Selva Nair [Sat, 14 Aug 2021 04:48:34 +0000 (00:48 -0400)] 
Fix client-pending-auth help message in management interface

- Add the missing timeout value that is required (not optional)
- Split the long line
- Also make the AUTH_PENDING state message format in
  management-notes.txt more precise.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by:
Message-Id: <20210814044834.2236-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22739.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agombedtls: do not define mbedtls_ctr_drbg_update_ret when not needed
Antonio Quartulli [Thu, 12 Aug 2021 08:53:00 +0000 (10:53 +0200)] 
mbedtls: do not define mbedtls_ctr_drbg_update_ret when not needed

The mbedtls_ctr_drbg_update_ret() function was backported to various
older branches, including 2.14 and 2.7.
To avoid making the #if guard too complex, let's detect if this function
exist at configure time.
All versions not having this function, will use our compat code.

Cc: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20210812085300.4738-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22734.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoReplace deprecated mbedtls DRBG update function
Max Fillinger [Tue, 10 Aug 2021 06:16:44 +0000 (08:16 +0200)] 
Replace deprecated mbedtls DRBG update function

The function mbedtls_ctr_drbg_update is deprecated as of mbedtls 2.16
and is superseded by mbedtls_ctr_drbg_update_ret, which returns an error
code. This commit replaces the call to the deprecated function with the
new one and logs a warning in case of an error.

For older versions of mbedtls, we add a compatibility function that runs
mbedtls_ctr_drbg_update and returns 0.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210810061644.20353-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22711.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoUse more C99 initialization in add_route/add_route_ipv6().
Gert Doering [Mon, 2 Aug 2021 15:26:19 +0000 (17:26 +0200)] 
Use more C99 initialization in add_route/add_route_ipv6().

This gets rid of a few #ifdef and also removes the need for
commit a11bea18b1c93 (argv is only initialized after the
early exit check on RT_DEFINED).

v2:
  use gc_new(), group gc and argv init in both add_route*() functions

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210802152619.30754-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22694.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>