0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00
Commit Graph

59 Commits

Author SHA1 Message Date
Arne Schwabe
9c547ba3ff
Remove force_aes_cbc_ciphersuites option
This option has been very likely been to fix some incompatibilities
between some TLS libraries. But nobody really remember what it fixes
and its usage today is questionable. So remove the option instead
of supporting an option we cannot even test anymore.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-03-11 19:51:18 +01:00
Arne Schwabe
a1250b9bed Announce Chacha20-poly1305 in IV_CIPHER if supported
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Arne Schwabe
80399075d4 Implement CHACHA20-Poly1305 support for data channel
This also changes the mbed TLS implementation from using the AES GCM
specific API to the generic AEAD API in mbed TLS. As result we can
refactor the commonly used parts of AEAD and normal cipher into a
common class.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Arne Schwabe
424d9b34af Rename GCM classes and files to AEAD
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
David Sommerseth
d0ab53a5d5
Merge changes applied to coming Core release 2019-12-10 15:20:49 +01:00
Arne Schwabe
97881b5c4f Require internal json for sslctx json functions
These functions require methods that are not available if
jsoncp is used as json library

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-11-27 16:03:44 +01:00
David Sommerseth
7bd55e0a7b
mbedtls: Add support for --verify-x509-name
This is the mbed TLS counterpart of the OpenSSL change in
commit c069b7cf5fb9ba47.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-11-08 10:00:45 +01:00
David Sommerseth
fc060bd317
mbedtls: Move x509_get_subject() and x509_get_common_name() to an independent file
This is the mbed TLS counter part to the OpenSSL change in
commit e0fd92f30756.  These two methods are generic and not
tied to the MbedTLSContext in any particular way.

This is needed to be able to add a unit test for the x509_get_*()
functions.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-11-08 10:00:43 +01:00
David Sommerseth
7900c71f5c
mbedtls: Add missing include file in x509cert.hpp
This file uses BufferAllocated, which is defined in
openvpn/buffer/buffer.hpp

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-11-08 10:00:42 +01:00
Arne Schwabe
4d18aaeb88 Fix LLVM warnings reported during OS X build
const modifies on primitive return types (int, bool, etc.) do not
do anything and Clang complains about these.

Zero initialisation in C++ is done by = {} or class().

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-08-29 16:59:33 +02:00
Arne Schwabe
23959fa705 Add reporting of IV_SSL_VER
This information is only send if push-peer-info is enabled. It is meant
to have an easy way for centrally adminstrated to spot clients using
outdated SSL libraries.
2019-08-29 16:33:05 +02:00
James Yonan
84e78d8fed SNI: added OpenVPN client support for SNI (currently OpenSSL only)
For example, the following client directive will push the SNI name
"test@example.com" to the server:

  sni "test@example.com"

Signed-off-by: James Yonan <james@openvpn.net>
2019-07-17 10:53:46 -06:00
James Yonan
001b731fe2 SNI: create SNI namespace and rename SNIHandlerBase -> SNI::HandlerBase
Signed-off-by: James Yonan <james@openvpn.net>
2019-07-17 10:53:46 -06:00
Antonio Quartulli
b73d484950
mbedtls: throw exception on unsupported SSL:Const::PEER_CERT_OPTIONAL option
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-06-25 12:01:52 +02:00
James Yonan
6a4826965f
MbedTLS: update json_override() prototype
Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:02 +02:00
James Yonan
3b34449d0e
SSLAPI: auth_cert() can now be const
auth_cert() can now be const because OpenSSL rebuild_authcert()
is never called unless authcert has already been allocated,
making

  authcert.reset(new AuthCert());

redundant.  Once the above statement is removed,
rebuild_authcert() becomes const.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:02 +02:00
James Yonan
6e98b9aadc
SSLAPI: move PKType from SSLConfigAPI into standalone header to avoid dependency inversion
Attempting to build a standalone program that includes
openvpn/openssl/pki/pkey.hpp will fail because it depends
on the PKType enum in openvpn/ssl/sslapi.hpp which
is not explicitly included by pkey.hpp.

Rather than having pkey.hpp include sslapi.hpp (which
seems like a dependency inversion), put PKType into
its own header file.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:01 +02:00
James Yonan
bbae814864
OpenSSL: added SNI implementation
On the server side, we add the abstract base class
SNIHandlerBase to provide a hook (sni_hello) where
servers can inspect the SNI name given in the client
hello message and possibly return a different SSLFactoryAPI.

In other changes, we rename the ENABLE_SNI flag to
ENABLE_CLIENT_SNI to be clear that this flag only affects
the client-side SNI implementation.

We also add the NO_VERIFY_HOSTNAME flag on the client side
to allow the SNI name to be transmitted to the server
without requiring a match between the SNI name and the
common name or subject alternative name in the server
certificate.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:00 +02:00
David Sommerseth
025c7bad88
mbedtls/sslctx: Fix missing override in virtual methods
The Clang++ compiler is not happy about this missing declaration on
virtual methods, which is a fair complaint.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-05-16 15:12:47 +02:00
James Yonan
6cb3243681
mbedTLS: ssl() method accepting hostname should check if it is null
Signed-off-by: James Yonan <james@openvpn.net>
2019-05-16 14:50:06 +02:00
James Yonan
964d2cd428
SSL layer: added did_full_handshake() method and implemented for OpenSSL
Returns true if we did a full SSL handshake/negotiation.
or false for cached, reused, or persisted sessions.

Signed-off-by: James Yonan <james@openvpn.net>
2019-05-16 14:50:06 +02:00
James Yonan
162eeaa485
SSL layer: added RFC 5077 TLS session resumption ticket support
This is an initial client and server-side implementation
for OpenSSL 1.0.2.

Note that this functionality is intended for use with
HTTP sessions, and should not be used with the OpenVPN
protocol.

Signed-off-by: James Yonan <james@openvpn.net>
2019-05-16 14:50:06 +02:00
James Yonan
18f5f4d1b5
SSLConfigAPI: remove set_enable_renegotiation()
Removed set_enable_renegotiation from SSLConfigAPI and underlying
SSL implementations (OpenSSL, MbedTLS) since we are not currently
using it and TLS 1.3 standardizes on a session ticket model rather
than server-side session caching.

Signed-off-by: James Yonan <james@openvpn.net>
2019-05-15 18:56:48 +02:00
Arne Schwabe
9768562a01 OpenSSL 1.1: Add argument to external sign to specify algorithm
In TLS 1.3 the RSA-PSS padding is required in addition to the
traditional PKCS1 padding used in TLS 1.2 and below. Add an
argument to the external sign function to signal what padding
is required. As quirkyness OpenSSL calls out requesting a NONE
padding instead of RSA-PASS.

We might need to move from RSA_method to EVP_PKEY_method in the
future.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-04-15 15:47:22 +02:00
Arne Schwabe
073b3993f4 Fix commit 8b22a7b2 (mbed TLS compatibility)
The commit 8b22a7b2 had two mistakes:

Accidentally moving the #endif to the wrong line during reformat.
Forgetting to include mbedtls/version.h so the version check was always
false.
2019-02-12 14:04:40 +01:00
Arne Schwabe
8b22a7b209 Fix compatibility with mbed TLS < 2.7.0 2019-02-11 11:18:58 +01:00
Antonio Quartulli
54a97b3814
ssl: add support for encoding/decoding PEM format
Add PEMAPI to allow OpenVPN core to encode/decode PEM
format using {mbed,Open}SSL API.

Needed to decode tls-crypt-v2 keys.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-12-06 09:19:21 +10:00
Arne Schwabe
a7b923e1ef Fix logic inversion from commit 2de9aebc
In commit 2de9aebc74 the commit introduced
checking the return value of mbetls_sha1_ret. Unfortenately, I got the
condition flipped.
2018-11-26 10:30:59 +00:00
Arne Schwabe
2de9aebc74
Replace deprecated mbedtls_sha1 with mbedtls_sha1_ret
This is super unlikely to fail but be better safe than sorry.

The function needs mbed TLS 2.7.0 which should be fine for every
still supported platform of us.
2018-11-07 20:56:34 +01:00
Arne Schwabe
6d12c9cc29 Refuse external pki with non RSA keys
Without this patch you get still specify a client EC certificate and
connect to a RSA server. The connection will be established until the
external pki sign will fail in "interesting" ways.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
2018-11-07 18:32:36 +01:00
Arne Schwabe
02d2a7975e Fix multiple inclusion of OpenVPN3 header with OPENPVN_EXTERN
To bundle ptcore and openvpncli into the same shared library for
OpenVPN Connect, the two libraries need both to include OpenVPN (or
parts of it).

Ptcore defines OPENVPN_EXTERN as extern to define the symbols as extern
in that library but a few places are missing proper weak symbol (inline)
or extern declaration.
2018-07-05 15:38:48 +02:00
Antonio Quartulli
f1ef079f0d
[OVPN3-237] SSLAPI: simplify PK types
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-06-29 17:04:47 +08:00
Lev Stipakov
35bbca799d Merged in OVPN3-184-generate-warning (pull request #1)
OVPN3-184 Name Constraints

Approved-by: Antonio Quartulli <antonio@openvpn.net>
Approved-by: James Yonan <james@openvpn.net>
2018-04-25 18:10:21 +00:00
Lev Stipakov
08d72bd76d [OVPN3-184] mbedtls: handle Name Constraints
Introduce profile flag "allow-name-constraints".

mbedTLS doesn't support x509v3 'Name Constrains'
extension. To allow client to connect, make mbedTLS
not to fail on this extension and drop a warning to UI.

This depends on "Enable allowing unsupported critical extensions in runtime"
patch to mbedTLS.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-04-19 11:11:39 +03:00
Antonio Quartulli
37dc863783
[OVPN3-169] mbedTLS: implement write_ciphertext_unbuffered() function
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-04-19 12:10:00 +08:00
James Yonan
37d848ca20
Log lines from C++ exceptions should contain the text "exception"
This makes it easier to scan log files for exceptions.

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-26 23:58:35 +08:00
Antonio Quartulli
c5bc3859e6
mbedTLS: don't set endpoint twice in conf object
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-03-26 23:58:32 +08:00
Antonio Quartulli
d0532df666
mbedTLS: add support for ECDSA
Whitelist TLS ciphersuites that include the ECDSA algorithm.
This way EC certificates can be finally used.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-02-04 16:55:12 +08:00
David Sommerseth
16b10559f2 [OVPN3-140] Update company names in copyrights
OpenVPN Technologies, Inc. change their name to OpenVPN Inc. during the
autumn of 2017.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
David Sommerseth
6caca2c313 [OVPN3-140] Relicense back to AGPLv3
This is essentially a revert of commit 04b2a3c9b7 and commit
ef42e59e05.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
Antonio Quartulli
7cbaa26b90 SSLAPI: add tls_warning attribute
The SSLAPI instance should use this new attribute to
report potential issues detected during the tls handshake.

Upper layers will process this attribute when needed.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:39 +08:00
Lev Stipakov
97d9c28eff [OU-15] mbedtls: remove duplicated code
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:39 +08:00
Lev Stipakov
95aec32854 [OU-15] mbedtls: refactor X509Cert to allow reuse der2pem
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:39 +08:00
Antonio Quartulli
3928069caa [OVPN3-119] mbedTLS: create INSECURE profile including MD5
Following an high number of users complaints, it was suggested
to re-enable MD5 and to give our users a notice period of some
months before dropping its support entirely.

With this patch we add a new certificate profile called "insecure"
which is equal to "legacy" with the addition of MD5.

By default OpenVPN3 still use legacy and the insecure profile
must be enabled explicitly by the client app.

The new profile is also enveloped in an ifdef so that
such support is not introduced, unless who builds the core
knows about it.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:39 +08:00
Antonio Quartulli
b91d8418ed self-test: add missing includes
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:39 +08:00
Antonio Quartulli
f3cf64516f [OVPN3-116] disable SSL_CBC_RECORD_SPLITTING
SSL_CBC_RECORD_SPLITTING is not enabled in OpenVPN-2.x
therefore we have to disable it by defaultin OpenVPN-3 as well
to keep wire compatibility.

This feature can cause nasty behaviours when communicating over
TLS-1.0. Crashes of servers running openvpn < 2.3.7 have also
been witnessed due to an assert on the packet size (assert has been
removed in 2.3.7).

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
3d5770820b mbedTLS: implement private_key_type/length() API
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
16e9160d89 mbedTLS: implement extended API for key material extraction
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
ad4e995fae mbedTLS: use mbedtls API to initialize cert object
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
4f5a04db4e rand.hpp: allow external entropy source
OVPN3-84

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00