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

303 Commits

Author SHA1 Message Date
Heiko Hund
e9a903fd9f add support for the --peer-fingerprint option
This option lets you specify the SHA256 fingerprint of a peer's self-signed
certificate. The peer's certificate, presented during connection bring-up,
is compared to the fingerprint. The connection fails if it doesn't
match.

So, this serves as an easy, yet secure, alternative to setting up a PKI,
but can also be used in conjunction with one to add one more check during
leaf certificate validation.

The option can also be given as inline block, for easier management for
multiple fingerprints:

  <peer-fingerprint>
  00:11:22:33:...:BB:CC:DD:FF
  BB:CC:DD:FF:...:00:11:22:33
  </peer-fingerprint>

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-28 23:56:22 +02:00
David Sommerseth
2a5f0ee76f
docs: Update README
The README file had several deprecated ways of building various test
binaries.  Clean up this and direct users towards using CMake
everywhere.

The change to test/ssl/CMakeLists.txt covers various build-time
parameters the deprecated build script supported.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2021-04-22 12:54:34 +02:00
David Sommerseth
38f2a08d2b
cmake: Clean up duplications
The CMakeLists.txt settings from the project root directory are
inherited by the defined subdirectories automatically.

Also switch to a simpler way of setting the CMAKE_MODULE_PATH.
According to the CMake documentation, this variable is empty by
default [1] and should not need to pull in existing settings.

Finally remove the comment regarding CMake's use case, as we are
moving towards full CMake support for OpenVPN 3.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2021-04-22 12:54:26 +02:00
Lev Stipakov
e9c62c1b08
Add vcpkg port for dco-win
Port script only copies uapi header, same way it is done for tap-windows6.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:44:52 +02:00
Heiko Hund
9b03cddea9
add support for ovpn-dco-win TAP driver
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:44:49 +02:00
Heiko Hund
1e55fdadf1
make it possible to provide HTTP proxy creds
Extend struct ProvideCreds so that it can also hold HTTP proxy
credentials. This makes it possible to use proxy settings from
options, but provide credentials separately.

This is in contrast to the already existing struct Config::proxy*
which need to be given as a complete set to override eventual
HTTP proxy options.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:40:09 +02:00
Heiko Hund
f2508d9363
add unit test for HTTP proxy options
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:40:07 +02:00
Heiko Hund
63d38ba278 add results_type to class AsyncResolvable
Makes code more readable and implicitly declares the
correct internet protocol.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-03-18 18:10:30 +01:00
Heiko Hund
bdc135c0d6 add unit tests for class RemoteList
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-03-02 11:07:09 +01:00
Heiko Hund
08a02669c5 add support for remote-random-hostname option
Add the option from openvpn2. If given, prepend hostnames
from remote options with six random hex bytes before
DNS resolution is taking place, e.g.

	host.domain -> e3b17bf7cd57.host.domain

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-03-02 11:07:09 +01:00
Heiko Hund
4e15a06468 Expand unit test for class PushedOptionsFilter
* add tests for pull-filter option
  * adapt route-nopull test to refactored class

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-02-11 02:21:30 +01:00
Heiko Hund
ef2b3179b1 Fix some typos in unittest README files
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-02-11 02:14:19 +01:00
Heiko Hund
cb7b37b1d7 Add unit test for class PushedOptionsFilter
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-02-09 15:43:16 +01:00
James Yonan
68a5451c84 unittests/test_helper.hpp: added JY_ASSERT_LE and JY_ASSERT_GE
Googletest has issues with ASSERT macros in class
constructors or functions/methods that return values,
so we need to create our own suite of ASSERT macros.

Signed-off-by: James Yonan <james@openvpn.net>
2021-01-11 11:39:58 -07:00
James Yonan
f50bcab9e4 unit testing: LogOutputCollector: added log_wrapper() method for multi-threaded tests
To enable logging in new threads, add this line to the
beginning of your thread function:

  Log::Context log_context(testLog->log_wrapper());

Signed-off-by: James Yonan <james@openvpn.net>
2020-10-15 22:49:41 -06:00
Arne Schwabe
f964fb07b1 Allow auth pending methods be specified via commandline
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-09-30 17:58:12 +02:00
Arne Schwabe
b67702e19f Also log the signature algorithm when printing the verified certificates
This allows the user to figure out which certificate uses MD5/SHA1.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-09-30 17:58:12 +02:00
Arne Schwabe
949386f5fe Change continuation_test1 to always only use 100 iteration
This test also takes more than one minute to run on my mac with
a debug build and consume 99% of the time of the test run.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-09-30 17:58:12 +02:00
David Sommerseth
5b15dbe940
Merge changes from Core library v3.5 2020-09-23 20:13:07 +02:00
Lev Stipakov
081b17fcbd
test_sitnl.cpp: add missing "override" specifier
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-09-23 10:20:01 +03:00
Lev Stipakov
242cdad9c9
win: add ipv4 routes via IP Helper API
Use ::CreateIpForwardEntry2() to add route instead of
expensive netsh call. Make it as a default choce.

Add unit test.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-09-09 18:25:38 +03:00
Lev Stipakov
d0e2e036eb
win: add ipv4 routes via IP Helper API
Use ::CreateIpForwardEntry2() to add route instead of
expensive netsh call. Make it as a default choce.

Add unit test.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-09-09 13:07:06 +03:00
Lev Stipakov
d79536240e
unittests/CMakeLists.txt: fix tests execution
Commit 941104cf4 refactored the way how test files are added, but
broke (disabled) execution of sitnl and cputime tests. Fix that.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-09-09 12:35:25 +03:00
Arne Schwabe
012e7e8226
Refactor InitProcess to use refcounting
Although the init calls were protected by a mutex more than consumer of
the API will the second one if the uninit was called too early.

While at it, move from explicit init/uninit calls to RAII.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-09-02 20:37:01 +02:00
Lev Stipakov
8593c41540 ovpn-dco: basic communication with kernel module
Add dependency to libnl-genl, which is C library
for generic netlink communication.

Implement C++ wrapper for libnl-genl, inspired by
ovpn-cli - a test client for ovpn-dco kernel module.

Implement ovpn-dco netlink commands:

  - OVPN_CMD_START_VPN - pass transport socket,
protocol (UDP) and mode (client).

  - OVPN_CMD_NEW_PEER - pass local and remote
endpoint info.

  - OVPN_CMD_PACKET - move (control channel) packets
between userspace and kernel.

  - OVPN_CMD_DEL_PEER - sent by kernel when peer is deleted
due to keepalive timeout (causes reconnect) or any other
reason (considered as fatal).

This change allows to perform openvpn handshake and
establish connection which doesn't work, since data channel
keys are not passed to kernel yet.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-26 14:59:24 +00:00
Lev Stipakov
3761f2ff89 ovpn-dco: initial support
Add tun/transport client skeleton for ovpn-dco,
which doesn't do any work except creating/removing
ovpn-dco device.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-26 10:53:27 +00:00
Lev Stipakov
5bc16a71ef dcocli.hpp: refactor dco transport client
In preparation of ovpn-dco support, split dco transport
client into two parts:

 - generic dco support in dcocli.hpp
 - kovpn-specific code in kovpncli.hpp

Add build directory (used by VS Code) to .gitignore

Use #pragma once instead of #ifndef/#define/#endif

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-26 10:53:27 +00:00
Lev Stipakov
0ba5e06882 cli.cpp: use SITNL on Linux by default
Macro OPENVPN_USE_SITNL should be defined before
inclusion of client/ovpncli.cpp.

Include tuncli.hpp for consistency with mac-specific code below.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-26 10:53:27 +00:00
James Yonan
c6441ee9f3
unittests: added test_all to .gitignore
Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:53:07 +02:00
James Yonan
3555b12a16
push-continuation: added new server-side fragmentor
Includes new unit test for both client and
server-side push-continuation code.

Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:53:00 +02:00
James Yonan
d0298f5520
unittests: test_common.h should include <openvpn/io/io.hpp> rather than <asio.hpp> directly
Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:52:56 +02:00
James Yonan
159a64e338
unittests: work around some limitations in googletest
Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:52:54 +02:00
James Yonan
fc0e12fdf7
Unit tests: added new "fake-secure" random source that's guaranteed to be deterministic
Signed-off-by: James Yonan <james@openvpn.net>
2020-08-19 18:52:51 +02:00
David Sommerseth
f6ab0178a5
test: Fix OPENVPN_USE_SITNL redefine warning in ovpncli
If the OPENVPN_USE_SITNL is defined as compiler arguments or set
earlier if cli.cpp was used in an #include statement, the compiler
would warn about OPENVPN_USE_SITNL being redefined.

We want OPENVPN_USE_SITNL by default, but the code does not need
to explicitly define it if it is already defined.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-08-18 10:49:54 +02:00
Arne Schwabe
2141e23ecd Implement tls-groups option to specify eliptic curves/groups
OpenSSL 1.1+ by default only allows signatures and key exchange from the
default list of X25519:secp256r1:X448:secp521r1:secp384r1. Since in
TLS1.3 key exchange is independent from the signature/key of the
certificates, allowing all groups per default is not a sensible choice
anymore and the shorter lister is reasonable.

However, when using certificates with exotic curves the signatures of
this certificates will no longer be accepted. This option allows to
modify the list for these corner cases.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-05-13 16:23:36 +02:00
James Yonan
3b3ee130b9 cli: allow --peer-info option to accept a JSON file as input
Signed-off-by: James Yonan <james@openvpn.net>
2020-05-02 20:33:14 -06:00
James Yonan
bf69c9f046
unittests/test_comp.cpp: added missing '/' in filename lookup
Signed-off-by: James Yonan <james@openvpn.net>
2020-04-24 13:22:53 +02:00
James Yonan
e2a9630718
unit tests: added a .gitignore for executables
Signed-off-by: James Yonan <james@openvpn.net>
2020-04-24 13:22:48 +02:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
Arne Schwabe
941104cf49
Implement supporting IANA cipher names in tls-cipher and unit tests
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-03-11 19:51:37 +01:00
Arne Schwabe
fa5f0f0b02
Ensure that InitProcess is always called before starting unit test
This is needed for the tls-cipehr/tls-ciphersuites to have an
initialised OpenSSL when using OpenSSL < 1.1.0

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-03-11 19:51:37 +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
Lev Stipakov
532ebf1798
cli agent: disable agent path check for test client
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-03-11 19:44:51 +01:00
James Yonan
9f430b46ba cli: added --write-url option to write URLs received via INFO/OPEN_URL notifications to a file
Signed-off-by: James Yonan <james@openvpn.net>
2020-03-11 11:11:56 -06:00
James Yonan
f669831556 Base64: fixed issue where decode() method would ignore bad chars rather than throwing base64_decode_error()
Added a unit test to confirm the fix.

Other changes:

* In Base64 decode(), avoid the use of std::strlen() in favor
  of std::string length() method since a std::string could
  conceivably contain embedded null chars.

* In Base64 unit test, renamed b64_test_bad() to
  b64_test_bad_decode() for clarity.

Signed-off-by: James Yonan <james@openvpn.net>
2020-03-11 11:11:56 -06: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
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
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
8f4da2ec62 Move CMAKE module path to root directory
This fixes the cmake build when using openvpn3 standonline

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-30 14:52:57 +01:00
Lev Stipakov
1a7cb2b694
cmake: Don't use "Wno-unused-private-field" for msvc
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-30 10:31:14 +02:00