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

80 Commits

Author SHA1 Message Date
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
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
a2e2bf626e Increase frame size in proto test to 378
The added IV_CIPHER string that we send, brought the Frame used in
the proto test client over the 256 byte limit. Change the proto test
to use a larger test frame of 378 byte.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Antonio Quartulli
9814079944
tls-crypt-v2: implement abstract metadata parser
The metadata that may be possibly be contained in the WKc has to be
verified by means of a user implemented behaviour.

Implement an abstract class that exports a verify() method to be
used for this purpose.

Users can extend this class and override the verify() method with
their own.

A basic implementation is also provided: it will just ignore the
metadata (if any) and report success to the core.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-12-06 09:19:22 +10:00
Antonio Quartulli
be38bbeb84
tls-crypt-v2: test/ssl/proto.cpp - extend protocol test
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-12-06 09:19:22 +10: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
f33e7c2968 [OVPN3-5] tls-crypt: add tls-crypt support in proto.hpp test unit
By default tls-crypt is now enabled instead of tls-auth.
It can be easily changed by editing the define at the top
of test/ssl/proto.hpp

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
389353c243 proto.cpp: uninit process at the end of the execution
Not really important, but worth fixing to avoid polluting
any memchecker output with unreleased (leaked) resources.

Release process resources before exiting the main function.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
b2cd82a5bf copyright: updated to 2017.
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 13:11:09 -06:00
James Yonan
fc85b371ab logging: removed #ifdef OPENVPN_INSTRUMENTATION, and made
the previously conditional code always included.
2017-03-18 12:24:54 -06:00
James Yonan
050e8717f1 mbedTLS: Port from polarssl-1.3 to mbedtls-2.3 (symbol renames)
This patch renames internal OpenVPN 3 symbols
from polarssl -> mbedtls.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 12:24:54 -06:00
James Yonan
a6b7cf458f mbedTLS: Port from polarssl-1.3 to mbedtls-2.3 (functional)
This patch builds on work by David Sommerseth <davids@openvpn.net>
to move the PolarSSL API from polarssl-1.3 to mbedtls-2.3, which
has significant differences in some areas.

- Strings containing keys, certificates, CRLs, and DH parameters
  need to be NULL-terminated and the length argument provided to
  the corresponding mbedtls parse function must be able to read
  the NULL-terminator.  These places have been modified with a
  '+1' to the length argument (x509cert.hpp, x509crl.hpp, dh.hpp,
  pkctx.hpp).

- The SSL context object has been split up in mbedtls-2.3
  Now many of the SSL configurations are done in a separate
  SSL config object, which is added to the SSL context once
  configured.  In addition private/public keys are now stored
  in a separate pk_context, which is later on attached to the
  SSL context.  Due to this, many of the calls setting either
  SSL configuration parameters or working with pk_contexts have
  been refactored.  (sslctx.hpp)

- The older API loading the CA chain took a hostname argument.
  The new API requires mbedtls_ssl_set_hostname() explicitly to
  be called setting hostname.  Some refactoring was needed here
  too (sslctx.hpp).

- x509_oid_get_description() is now replaced by
  mbedtls_oid_get_extended_key_usage().

- when mbedTLS renamed OID_CMP to MBEDTLS_OID_CMP, the return
  value was changed so that a return value of 0 now means equal
  rather than not-equal.

- mbedtls/platform.h must be loaded before any other mbedtls
  include files (sslchoose.hpp).

- All functions and macros related to mbedTLS are now prefixed
  with mbedtls_/MBEDTLS_

- Refactored External PKI and added some options to cli.cpp
  to make it easier to test that the feature still works
  correctly.  This included removing the sig_type var and
  standardizing on a PKCS#1 digest prefix per RFC 3447.

- Updated test keys to 2048 bits.

- Updated dependency build scripts to build mbedTLS.

- Enable MD4 in mbedTLS build script (needed for NTLM auth).

- Use an allow-all X509 cert profile to preserve compatibility
  with older configs.  Going forward, we will implement new
  options to increase strictness on minimum RSA key size and
  required cert signing algs.

- Added human-readable reason strings that explain why
  a given cert in the chain wasn't accepted.

- This patch doesn't rename any files or rename internal
  OpenVPN 3 symbols such as PolarSSLContext.  This will
  be done in a separate commit.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 12:24:54 -06:00
Samuli Seppänen
04b2a3c9b7 Switch from AGPLv3 to GPLv3
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2017-03-16 14:43:55 +02:00
James Yonan
971abda88f copyright : updated to 2016 2016-09-03 23:29:23 -06:00
James Yonan
662bf7833e ovpn3 core : Added automatic data limits for Blowfish,
Triple DES, and other 64-bit block-size ciphers vulnerable
to "Sweet32" birthday attack (CVE-2016-6329).  Limit such
cipher keys to no more than 64 MB of data
encrypted/decrypted.  While our overall goal is to limit
data-limited keys to 64 MB, we trigger a renegotiation
at 48 MB to compensate for possible delays in renegotiation
and rollover to the new key.

This client-side implementation extends data limit
protection to the entire session, even when the server
doesn't implement data limits.

This capability is advertised to servers via the a
peer info setting:

  IV_BS64DL=1

meaning "Block-Size 64-bit Data Limit".  The "1" indicates
the implementation version.

The implementation currently has some limitations:

* Keys are renegotiated at a maximum rate of once per
  5 seconds to reduce the likelihood of loss of
  synchronization between peers.

* The maximum renegotiation rate may be further extended
  if the peer delays rollover from the old to new key
  after renegotiation.

Added N_KEY_LIMIT_RENEG stats counter to count the number
of data-limit-triggered renegotiations.

Added new stats counter KEY_STATE_ERROR which roughly
corresponds to the OpenVPN 2.x error "TLS Error:
local/remote TLS keys are out of sync".

Prevously, the TLS ack/retransmit timeout was hardcoded to
2 seconds.  Now we lower the default to 1 second and make
it variable using the (pushable) "tls-timeout" directive.
Additionally, the tls-timeout directive can be specified
in milliseconds instead of seconds by using the
"tls-timeout-ms" form of the directive.

Made the "become primary" time duration configurable via
the (pushable) "become-primary" directive which accepts
a number-of-seconds parameter.  become-primary indicates
the time delay between renegotiation and rollover to the
new key for encryption/transmission.  become-primary
defaults to the handshake-window which in turn defaults
to 60 seconds.

Incremented core version to 3.0.20.
2016-09-01 15:19:00 -06:00
James Yonan
ca5205b4f3 random : consolidate random functionality in RandomAPI. 2016-06-28 22:31:17 -06:00
James Yonan
74d89fab7c OpenVPN protocol core : when passing objects to methods that
may assert ownership over them, use C++11 rvalue/move
semantics.
2016-05-10 13:02:11 -06:00
James Yonan
2255bab03a OpenVPN protocol core : added logic to control channel
receive path to reassemble messages fragmented by the
SSL layer up to a max message size of 64 KB.

Ramifications:

* Peer info data and pushed options can be significantly
  larger (i.e. approaching 64 KB).

* Less need for the options continuation feature.

Limitations:

* While this patch doesn't change the underlying OpenVPN
  protocol, it can result in messages being sent that are
  fragmented by the receiving SSL implementation into
  multiple buffers.  Implementations that lack reassembly
  capabilities (such as OpenVPN 2.x at this point in time)
  would see each buffer fragment as a separate message.

* This patch running on the server will break negotiation
  with pre-peer-info clients.  Basically this means it will
  interoperate with any OpenVPN 3 version or OpenVPN 2.x
  version that includes the June 2010 commit "Implemented a
  key/value auth channel from client to server.
  Version 2.1.1i".
2016-05-09 21:39:04 -06:00
James Yonan
c033a93aa7 proto test : offset client/server reneg-sec to avoid
renegotiation collisions, and add note about new OpenSSL
error that can be triggered by such collisions.
2016-05-06 14:13:09 -06:00
James Yonan
0bac5d8990 Core: revamped packet ID code to use a much larger window size,
allowing backtracks of up to 2048 (previous limit was 64).
In addition, we now maintain the packet ID window as a bit
array (previously a byte array was used).
2015-06-18 01:55:52 -06:00
James Yonan
c4a9cea3e1 Updated Windows client for VS 2015. 2015-06-09 11:21:41 -06:00
James Yonan
b75c780cab Renamed boost::intrusive_ptr<T> usage to RCPtr<T>. 2015-05-17 21:26:53 -06:00
James Yonan
e494846f7d Moved count_t to its own header file. 2015-05-17 13:17:24 -06:00
James Yonan
fe6fcefa61 C++11 : rename NULL to nullptr 2015-05-17 02:53:37 -06:00
James Yonan
3bcf8743c1 More conversions of threads/mutexes from boost to C++11 std.
As part of this work, removed openvpn/common/thread.hpp
2015-05-10 20:04:22 -06:00
James Yonan
2144a08c69 Converted test/ssl/proto.cpp from boost::thread to std::thread. 2015-04-23 17:17:40 -06:00
James Yonan
73672d1884 Added SSLConfigAPI abstract base for configuring SSL properties
independently of SSL implementation.
2015-01-31 21:51:25 -07:00
James Yonan
c2c7292a70 Updated copyright to 2015. 2015-01-06 12:56:21 -07:00
James Yonan
3fe1a359c0 Added OpenSSL GCM support. 2014-12-31 00:24:54 -07:00
James Yonan
3115ad5cfe test/ssl/proto.cpp changes:
1. work with latest proto.hpp API changes.
2. NOERR -- if defined, turn off simulated errors
3. FORCE_AES_CBC -- set force_aes_cbc_ciphersuites SSL flag
4. if VERBOSE, enable SSL debugging output
2014-12-30 18:15:05 -07:00
James Yonan
7e1d159cee Major protocol upgrades:
* peer_id/DATA_V2/op32
  client -> server:
    IV_PROTO=2
  server -> client :
    push "peer-id 1234"
    push "peer-id -1"

* AEAD/GCM support
  client -> server:
    IV_NCP=2
  server -> client:
    push "cipher AES-256-GCM"

* Compression V2
  client -> server:
    IV_LZ4v2=1
    IV_COMP_STUBv2=1
  server -> client:
    push "compress stub-v2"
    push "compress lz4-v2"

* TCP non-linear packet ID
  client -> server:
    IV_TCPNL=1
  server -> client:
    [always enabled]
2014-12-21 10:32:37 -07:00
James Yonan
255b71958f Reversed polymorphic ProtoContext performance degradation.
* Performance degradation from recent commit was occurring
  in PRNG.

* Allow RNG to be used in place of PRNG.  For PolarSSL
  at least, this change completely reverses the
  polymorphic ProtoContext performance degradation
  and turns it into a net performance gain.

* Added bool prng to RNG constructors to allow
  the implementation to optimize for PRNG
  (only PolarSSL currently supports this).

Documented different use-cases for RNG vs. PRNG
in ProtoContext:

  RNG -- Random number generator.
  Use-cases demand highest cryptographic strength
  such as key generation.

  PRNG -- Pseudo-random number generator.
  Use-cases demand cryptographic strength
  combined with high performance.  Used for
  IV and ProtoSessionID generation.
2014-10-21 16:45:20 -06:00
James Yonan
c7983ffef3 Allow HYBRID=1 builds of proto.cpp. 2014-10-21 16:41:05 -06:00
James Yonan
243fd3feaa Updated test/ssl/proto.cpp to work with new dynamically
polymorphic ProtoContext.

Benchmarks show that polymorphic changes to ProtoContext
have produced a slowdown of 1.64%.
2014-10-20 20:30:13 -06:00
James Yonan
9145145b64 Checkpoint toward fully polymorphic data channel API. Added a
three-level factory model:

CryptoDCFactory   -- builds CryptoDCContext objects for a given
                     cipher/digest
CryptoDCContext   -- builds CryptoDCBase objects for a given key ID
CryptoDCBase      -- encrypt/decrypt data channel
2014-10-17 15:52:29 -06:00
James Yonan
f47ce33c48 Renamed CryptoContextBase to CryptoDCBase to emphasize
that this is the Data Channel crypto API.  Related factories,
derived classes, and typedefs also renamed.
2014-10-16 10:10:42 -06:00
James Yonan
12e3f20e92 Converted SSL_API from static to dynamic polymorphism
(using SSLFactoryAPI and SSLAPI as base classes).
2014-10-15 18:12:38 -06:00
James Yonan
8b71fa9800 Converted RAND_API from static to dynamic polymorphism
(using RandomAPI as base class).
2014-10-15 12:53:18 -06:00
James Yonan
ab7dfe6f05 Added CryptoContextBase abstraction to allow use of new
data channel modes and non-CBC ciphers such as AES-GCM.
2014-10-08 13:43:40 -06:00
James Yonan
55d6eff7ef Added AGPL copyrights to some misc source files. 2014-08-25 01:02:40 -06:00
James Yonan
074dbafa27 Ported minicrypto lib to OS X for PolarSSL optimization.
These scripts

  scripts/mac/build-minicrypto
  scripts/mac/build-polarssl

will now build PolarSSL (on OSX) with libminicrypto linkage.
Currently, only SHA1/256/512 implementations from OpenSSL are
built in libminicrypto.  We leave the current PolarSSL AES
implementation as-is since it now implements AES-NI.

Also added portable openssl/build-openssl script.
2014-03-04 17:42:00 -07:00
James Yonan
ebd47cb635 Updated PolarSSL crypto self-test in the core for PolarSSL 1.3.x
using new shaX method names.  Also updated proto.cpp test suite
to run SelfTest::crypto_self_test on startup.
2014-03-04 10:42:07 -07:00
James Yonan
48fd793c4e Minor changes to test suite test/ssl/proto.cpp:
* On Windows, allow build parameters to be specified in
  protowin.h.

* For client and server, initialize tls_version_min to
  TLSVersion::UNDEF.
2014-03-03 18:43:13 -07:00
James Yonan
bd02377947 Changes to core self test test/ssl/proto.cpp :
* Fixed compile issue due to need to replace cc.enable_debug()
  with cc.ssl_debug_level = 1.

* Added RENEG var to control number of "virtual seconds" between
  SSL renegotiations.

* Doc changes in README.txt.
2014-03-03 14:43:38 -07:00
James Yonan
82be8b0107 packet_id.hpp now logs errors to a SessionStats objects,
like the rest of the core.

Added verbose() method to class SessionStats so that clients can
know whether to pass extra text data to error() virtual method.
2013-05-22 05:13:11 +00:00
James Yonan
0ba6e76170 Added copyright to some straggler files. 2013-01-31 15:00:45 +00:00
James Yonan
77bd160a51 Updated proto unit test with fresh certs/keys. 2013-01-30 21:08:55 +00:00
James Yonan
0387c23486 Minor edits & file reorg to protocol unit test. 2013-01-30 16:24:37 +00:00
James Yonan
cf70bee986 In proto.cpp test code, default to OpenSSL server. 2012-09-26 01:33:41 +00:00