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

3107 Commits

Author SHA1 Message Date
Dmitriy Dudnik
042502c932
Additional mappings for OpenSSL errors to OpenVPN error codes
OpenVPNClient::connect method doesn't communicate common OpenSSL errors
through it's return value due to lack of mappings of OpenSSL errors
to OpenVPN error codes in OpenSSLException implementation.

This commit fixes the issue by introducing new error codes:
 - SSL_CA_MD_TOO_WEAK
 - SSL_CA_KEY_TOO_SMALL
 - SSL_DH_KEY_TOO_SMALL

These error codes are mapped to corresponding OpenSSL errors:
 - SSL_R_CA_MD_TOO_WEAK
 - SSL_R_CA_KEY_TOO_SMALL
 - SSL_R_DH_KEY_TOO_SMALL

Signed-off-by: Dmitriy Dudnik <dmitro.dudnik@openvpn.net>
2020-03-03 14:49:09 +01:00
Arne Schwabe
ac25908d25 [JSON] Implement get_int64_optional and get_integer_optional
The get_integer_optional select the type to get from the JSON
dependent on the default_value parameter, making it simple to ensure
that the returned value will fit the requested type and range.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
c7972b0532 WS::Client: reworked SIMULATE_HTTPCLI_FAILURES to more closely hew to asio error throw points
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
93f6ed83c5 system_cmd_async: added optional sigset_t* parameter to configure signals in child
This is useful for running a command from a worker thread
where signals have been blocked, but we want the child
process to run with the original pre-blocked signal configuration.

Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
f004e09ae1 json: fixed get_string_ref() to properly return a string reference
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
84ef4533c6 WS::Client: implemented simulated network fault injection
Enable with SIMULATE_HTTPCLI_FAILURES

Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
05b51a9ec0 KoTun::API: added set_simulate_mesh_keepalive_failures() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
021e10b5b1 openssl/compat.hpp: added missing #include
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:03 -07:00
David Sommerseth
c824c032b1
deps: Update to mbedtls-2.7.13
This release contains several critical security fixes.

URL: https://tls.mbed.org/tech-updates/releases/mbedtls-2.16.4-and-2.7.13-released
URL: https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2019-12
CVE: CVE-2019-18222
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-27 14:19:51 +01:00
Arne Schwabe
f014afdf5c Fix potential double free reported by Coverity
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 17:04:26 +01:00
Arne Schwabe
4330c67a46 OpenSSL: Use ctx != nullptr to infer if initialised
Before the OpenSSL 1.1 changes ctx was a struct and not a pointer, so
the extra variable was necessary
This also solves a defect reported by Coverity of ctx not always
initialised.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 17:04:26 +01:00
Arne Schwabe
bade36f2ad Add missing openssl/dh.h include in dh.hpp
This is needed when compiling without OPENSSL_API_COMPAT

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 12:45:59 +01:00
David Sommerseth
6969264a94
Merge changes applied to coming Core release
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-19 18:24:49 +01:00
David Sommerseth
1f92c424e1
Finalizing OpenVPN 3 Core library release v3.5.4
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-19 18:06:17 +01:00
Lev Stipakov
2fbea7bebe
mingw/build: add build options
ARCH enables to build certain architecture only.

NO_DEPS disables downloading and building dependencies.

NO_OPENSSL disables downloading and building OpenSSL.

OPENSSL_ROOT_DIR allows to specify location for OpenSSL root

Example:

    ARCH=x86_64 NO_OPENSSL=1 ./build

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-19 17:57:42 +01:00
Lev Stipakov
ad5f819ea3
win/tunutil.hpp: read adapter name as Unicode
Adapter name can contain non-ascii chars. Read it as unicode
and convert to utf-8.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-19 17:56:34 +01:00
Antonio Quartulli
16db74d10a
async_resolve: detach resolve thread when resolution is cancelled by the user
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-02-19 16:38:06 +01:00
Arne Schwabe
73c9a592ae Pin googletest version due to google/googletest#2711
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +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
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
Lev Stipakov
a5853870a8
fix clang warnings: remove unused variables
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:46 +02:00
Lev Stipakov
4a7294bd31
mingw: add .gitignore
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:45 +02:00
Lev Stipakov
31fe32c925
mingw: add build script
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:45 +02:00
Lev Stipakov
81e1353ea9
mingw: add build dependencies to cmake
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:45 +02:00
Lev Stipakov
46673d2c9a
mingw: add WFP-specific guids
MinGW doesn't have those.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:44 +02:00
Lev Stipakov
1fabe7e674
mingw: fix ndisguid include
ndisguid.h is located in different directory
in mingw, comparison to msvc.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:44 +02:00
Lev Stipakov
1a3b5235cc
mingw: use generic way to install gtest
find_package() works with vcpkg, which
is used only by msvc build system.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:44 +02:00
Lev Stipakov
b17889fcd6
mingw: add missing include
FOLDERID_System used in this file is defined in "knownfloders.h"

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
0a2663cc2b
scoped_handle.hpp: remove SEH code
This code is MSVC specific (other compilers
don't support SEH) and is only useful during
debugging.

It is better to remove it and mute exception
in debugger, than add ifdefs for other compilers.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
a0af80be25
file.hpp: use best available ifstream constuctor
c++17 provides overload, which accepts
std::filestream::path, which accepts wchar_t,

MSVS provides overload, which directly accepts wchar_t.

In other cases use char constructor. This likely breaks
support of non-ascii profile paths.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
e844bd466b
mingw: change arguments order in lambda
Having capture without initializer after nested struct
is broken in GCC 7.x and is fixed starting from GCC 8.1
(see https://stackoverflow.com/questions/60110629/).

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 16:12:20 +02:00
Lev Stipakov
9393206d74
mingw: add bswap64 implementation for mingw
Because MinGW doesn't provide it
(see https://sourceforge.net/p/mingw/mailman/message/18337754/)
and we use compiler-specific implementations.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 16:12:19 +02:00
Lev Stipakov
e07a2c4e62
mingw: use lowercase in includes
Linux filesystem is case-sensitive and all
mingw includes are in lower case.  Also use
Linux directory separator, since it works on both
Linux and Windows.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 16:12:19 +02:00
Arne Schwabe
743a525f16
Fix netlink add_bypass_route not working with IPv6
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-07 21:12:57 +01:00
Lev Stipakov
7dabcb3cee
omiclient: support for wintun driver
Use wintun driver if config contains

    --windows-driver wintun

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:56 +01:00
Lev Stipakov
0dbbbd3020
support for --windows-driver option
Parse --windows-driver and set corresponding
value of config properties.

Could be used by clients to replicate openvpn2
behavior - use wintun driver if config contains
"--windows-driver wintun".

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:55 +01:00
Lev Stipakov
67fb123b88
ovpnagent: start openvpn process
This is needed to make openvpn-gui client work with openpvn3.

openvpn-gui passes all information, required to start vpn session,
to agent via named pipe. Agent impersonates another end of pipe,
which is gui process, running under user privileges, and starts
openvpn process.

openvpn-gui generates a random password, which is written by agent
into openvpn process's stdin. That password is used by openvpn-gui to
connect to openvpn's management interface.

openvpn-gui creates an event with unique name, which it is passed
to openvpn via command line. When user disconnects VPN session, gui
sets event into signalled state. openvpn waits on event and, when it is signalled, quits.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:54 +01:00
Lev Stipakov
e5f7fd55d8
cmake: disable agent path check for omiclient
This is useful for debugging.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:53 +01:00
David Sommerseth
5f092b80c1
Import AWS support code from internal Common library
This open sources support code used to interact with AWS from an
OpenVPN 3 implementation.  Prior to this change it, it was hosted in
a different git repository which was not open to the public.

The complete git history related to files being moved has been applied
to this repository.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-05 19:31:19 +01:00
Lev Stipakov
b2e8cb42f0
Add GPL headers
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 20:08:58 +02:00
James Yonan
f3c5a7a77e
json: added write_fast() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:57 +02:00
James Yonan
d9681076c1
json: read_fast(): added optional flag
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:57 +02:00
James Yonan
ce7dc7cad4
json::write_atomic: support mtime_ns parameter (nanoseconds-since-epoch)
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:56 +02:00
James Yonan
558cd3770a
json::write_atomic(): fixed bug where method was not writing actual JSON content
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:56 +02:00
James Yonan
45298001a0
json::read_fast: make optional flag implicit
Also interpret an empty file the same as a non-existent file.

Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:55 +02:00
James Yonan
f5dcb29b83
jsonfile.hpp: for read_fast() and read_binary_unix(), rename "must_exist" boolean to "optional" with reversal of value interpretation.
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:55 +02:00
James Yonan
4110d23d25
Added json::read_fast() and json::write_atomic()
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:54 +02:00
Lev Stipakov
b8ff04be75
aws: support for temporary credentials
- add optional token parameter, which is required when
using temporary credentials

 - add optional role parameter to fetch
temporary credentials

 - make route API param more fine grained

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 20:08:54 +02:00