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

1801 Commits

Author SHA1 Message Date
Antonio Quartulli
a3210f0bb9 SSLAPI: add private_key_type/length() getter methods
These new API functions allow the user to retrieve the
type and the length of the private key.

An helper function to convert the type to a human readable
string is also provided.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
8ffe8889cd OpenSSL: implement stub methods for new extract_* SSLAPIs
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
fe3d519145 SSLAPI: extend API with methods to extract key material
Users may want to print already parsed key material.
Extend the SSLAPI to accommodate methods for extracting
CA, CRL, CERT, KEY and DH data.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
2b4c85091d Debugging: added header and build flag for valgrind run-time
extensions.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
b948cde4c3 ManClientInstance::Factory: added virtual stop() method.
Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
121e9752e7 client API: added portOverride
portOverride, like serverOverride, will override the port used
in the remote directive of the profile.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
106981c3e2 JSON: allow alternative JSON library implementations
Allow source files that require JSON library functionality
to include a single file (openvpn/common/jsonlib.hpp) which
will then draw in the appropriate JSON library header based
on configuration #defines.

Code can #ifdef on HAVE_JSON to test whether or not JSON
functionality is available (previously, HAVE_JSONCPP
was used).

Currently supports JsonCpp and an OpenVPN-internal JSON
implementation.

This model assumes that alternative JSON implementations
are API-compatible with JsonCpp.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
f206ae2647 logging: added logdatetime.hpp which prepends date/time to log lines
logdatetime.hpp is a drop-in replacement for logsimple.hpp, which
implements the OPENVPN_LOG() macro and variants using trivial
output to std::cout.  This version will prepend the date/time
to each log line.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
49e933d275 Time: added to_double, delta_float, and delta_str methods
Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
569b1da08e daemon.hpp: added class WritePid for managing pid files
Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
63e9e046f8 ClientProto: reset CoarseTime object when AsioTimer is canceled
CoarseTime objects that track an AsioTimer must always be
reset when the AsioTimer is cancelled.  Not doing so can
cause a bug if the AsioTimer is reused after cancellation.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
f64b501295 Cleanup: allow functor to be passed by value.
Previously Cleanup only allowed its functor argument to
be passed by rvalue reference.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
ebe256068b RunContext: add configurable exit via EXIT_IN env var for debugging
Change the OPENVPN_EXIT_IN compile-time flag to be
a run-time option instead, controllable via the
EXIT_IN env var.  Set EXIT_IN to the number of
seconds to run before exiting.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
1fbff4fed1 tls-crypt: revised server-side validate_initial_packet()
methods to use a BufferAllocated rather than a Buffer.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
0090c51978 SSLConst: added new ssl_flags() method which filters out
non-ssl flags from given argument.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
8379b0a319 CryptoDCInstance: added new RekeyType PRIMARY_SECONDARY_SWAP
and use it in ProtoContext::promote_secondary_to_primary()
since it more accurately reflects the underlying
implementation.

Note that this only affects DCO (data channel offload)
implementations.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
18f45c244e ManClientInstance::Send: added AuthStatus::Type parameter
to disconnect_user() method.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
4bba803f33 Listen::List: added expand_ports() method.
Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
5122e7dc0f Listen::List: in port_offset(), set n_threads to 0 since
number-of-threads data for port_offset items isn't really
relevant.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
4e11a6c89c StaticKey: added render_to_base64() and init_from_rng()
methods.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
190ece92d4 CryptoAlgs: added mode() method.
Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
76e65cf4c9 CryptoAlgs: added AEAD_NONCE_TAIL_SIZE constant (set to 8
bytes) to represent the size in bytes of AEAD "nonce tail"
normally taken from the HMAC key material.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
27387181a8 compress: added method_to_string() method, i.e. the
inverse of parse_method().

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
7b47f998ad compress: since parse_method() performs a linear search
on method, reorder so that more frequently used methods
appear at the top of the list.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
b428f742d1 library: added integer is_pow2() and log2() methods based on
efficient __builtin_ffs and __builtin_clz intrinsics.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
4926011513 Android: adapt toolchain scripts to new SDK and move to API 26
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
908c611139 transport: use socket_protect to communicate socket handle on UWP
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
92a62169d4 build win: read certain params from env
Required for Jenkins multibrach pipeline build.

OVPN3-99

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
8166ea8b3b common: define uwp platform macro
OVPN3-95

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
0186bf62c7 common: report platform name as "uwp"
OVPN3-94

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
3f291b0ddb netconf: disable getting hwaddr for UWP
OVPN3-93

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
6365d26b31 transport: external factory
Provide ExternalTransport::Factory interface to enable client instantiate transport factory.

OVPN3-92

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
2ffa0c9e36 transport: synchronous DNS lookup
Add config option to enable synchronous DNS lookup.

OVPN3-76

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
2c09c7c0b8 cliconnect.hpp: support for AsioWork always on
OVPN3-85

Signed-off-by: Lev Stipakov <lev@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
Lev Stipakov
b19c5da828 time.hpp: use GetTickCount64 on Vista and newer
OVPN3-87

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
712ccfc7dc android: export DEP_DIR via vars files only if not already defined
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
1b5a78439e asio: make sure to switch to DEP_DIR before building
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
David Nimon
4302651dd8 changes to support android building 2017-12-22 17:59:38 +08:00
Samuli Seppänen
6f56b2b5a1 Merge pull request #21 from OpenVPN/make_test_proto_deterministic
travis-ci: make testing binary deterministic
2017-09-27 21:18:36 +03:00
Antonio Quartulli
3a5ef2be76 travis-ci: make testing binary deterministic
Travis-ci is used only for static analysis, therefore
when building the testing protocol we should avoid
non-deterministic behaviour which could lead to failures.

Tell the testing binary to work with lossless links.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:49:02 +08:00
Antonio Quartulli
b76882ddc9 mbedtls: fix typ0 in exception message
The md setup function has been substituted with a new one,
but the exception message was not updated.

Update it now to report the correct function name.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
40065a66e2 avoid "uninitialized variable warning"
the compiler is not smart enough to understand that under
the expected conditions http(s)_port will always be initialized.

Initialize variables upon declaration to avoid warning.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +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
74c5f4f38f [OVPN3-5] tls-crypt: introduce tls-crypt support
backported from OpenVPN 2.4.x

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
Antonio Quartulli
56a831f92a [OVPN3-5] crypto/ssl: add support for AES-256-CTR
Add support for AES-256-CTR (used by tls-crypt) in the crypto
layer and make sure that each SSL library plugin is aware of it.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
7cbf539222 [OVPN3-5] build script: allow user to specify its own mbedTLS folder and LDFLAGS
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00