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

155 Commits

Author SHA1 Message Date
Lev Stipakov
fd0655969d
Merge release of OpenVPN Core library 3.6.4 to master 2021-09-22 13:56:37 +02:00
James Yonan
905ee72fe3 ClientProto: added OPENVPN_DISABLE_AUTH_TOKEN for debugging to disable transmission of auth token to server
Signed-off-by: James Yonan <james@openvpn.net>
2021-08-17 13:07:40 -06:00
Heiko Hund
634e58e23b ovpncli: add open_url support for unixoid OSes
Open the user's default browser for OPEN_URL and WEB_AUTH dynamic
auth requests.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-08-11 22:37:24 +02:00
Heiko Hund
0c57e23aca ovpncli: support CR_TEXT type challenge/response
Support CR_TEXT type challenge/response exchanges. The challenge flags are
ignored currently, but displayed with the challenge text for debug purposes.
Thus, input is always echoed and it is assumed that a response is
required.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-08-10 14:17:30 +02:00
Lev Stipakov
613aa6bf7a
Win: support for local DNS resolvers
Local DNS resolvers, such as Umbrella Roaming Client,
change DNS settings on adapters to 127.0.0.1.

This may not work with openvpn3 because:

 - NRPT rule might be created for "." zone,
which redirects all DNS requests to the server
specified in rule. This takes precendence over adapters'
DNS settings.

 - DNS requests might be blocked on all adapters
except TAP (tap-windows6/wintun/ovpn-dco-win) to prevent
DNS leaks.

To enable compatibility with local DNS resolvers, add
"allowLocalDnsResolvers" core config option, which,
when enabled, makes core to

 - avoid creating NRPT rule for "." zone

 - permit DNS requests to 127.0.0.1 / ::1

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-08-10 15:00:58 +03:00
Arne Schwabe
98f5b59a07 Document WEBAUTH and implement it as auth pending method in demo client
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2021-07-28 14:50:06 +02:00
Lev Stipakov
d31620d0c6
agent mac: move from common
Windows agent has been moved from common to core,
so for consistency move mac agent too.

Since agent and agent-enabled client depend on jsoncpp,
also move jsoncpp build scripts.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2021-06-10 23:06:24 +02:00
Heiko Hund
51bd6d4201 use DCO opportunistically
If DCO support is compiled in, detect if it is available (i.e. Windows driver
or Linux kernel module is loaded) and then use it, if it is.

This changes the default configuration for DCO from off to on, so users of
the library need to set ClientAPI::Config::dco to false in case they do not
want to use dco for a connection.

The change is also reflected in the reference client "ovpncli". If DCO is
enabled in a build, it will detect and use it. The previously available
"ovpncliovpndco" and "ovpncliovpndcowin" clients have thus been removed.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-05-27 17:20:24 +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
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
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
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
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
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +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
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
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
1c9834c50d win: replace msvc project files with cmake
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-29 23:24:54 +01:00
Arne Schwabe
cb229c7bba
Add -Wall option by default to openvpn compile
Fix DCO compile from a fresh checkout

Allow do use -DUSE_WERROR=true to error out on warnings during the build
2020-01-15 23:08:29 +01:00
Arne Schwabe
a8275e13f4
Add ovpnclinull and ovpnclidco variants to cmake build script 2019-11-20 11:07:49 +01:00
James Yonan
e8b31c5454 cli: advertise "openurl" as supported SSO method
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:57 -06:00
Antonio Quartulli
47046cf6d2
Merge branch 'qa' 2019-07-19 14:39:43 +02:00
James Yonan
4eaa46a879 MbedTLS: added MBEDTLS_DISABLE_NAME_CONSTRAINTS preprocessor flag
This allows building a client against a generic mbedTLS library.

Signed-off-by: James Yonan <james@openvpn.net>
2019-07-17 10:53:46 -06:00
Lev Stipakov
a2496a3616 Wintun: experimental support
This introduces experimental support for Wintun
as an alternative for tap-windows6.

In order to use wintun, set "ClientAPI::Config::wintun"
flag to "true" or use "-w" option in test client.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-29 20:21:28 +03:00
Arne Schwabe
d56e049ea4 Refactor dependencies to be in a cmake script
This allows the dependencies to be used by multiple parts of the project,
e.g. non public unit tests, ovpncli etc.

Building ovpncli demostrates this
2019-05-13 14:49:36 +02:00
Lev Stipakov
dfcc4bc437 [OVPN3-354] cli.cpp: support for round-robin DNS and redirect gw
This takes into use new TunSetup API which enables to create bypass
routes before establishing connection.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-10 10:48:53 +03:00
Lev Stipakov
7d112eb3e5 cli: enable utf8 console output
This allows cli to display non-ASCII strings,
assuming they're utf8 encoded.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-06 17:10:12 +03:00
Lev Stipakov
7150f72e09 tun: remove code duplications in Linux tun implementations
There are two ways how Linux tun can be manipulated -
by using iproute2 or netlink. Both implementations have
defined identical Setup class implementation.

This commit factors out Setup class from tun implementations
and templatizes it, which removes need in duplicated code.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-02 21:34:20 +03:00
Lev Stipakov
8112f0cd7c [OVPN3-378] cli: support for TunBuilder API
This enables to use TunBuidler API by test client
on Linux and Mac platforms.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-02 21:34:20 +03:00
Lev Stipakov
4d7c12ac4d [OVPN3-405] Support for non-ASCII profile path on Windows
This uses Windows-specific wchar_t override of std::ifstream
to make it work with UNICODE paths. It is assumed that caller
passes UTF8-encoded string.

To support passing non-ASCII chars via command line, we
read it as wstring and then convert to UTF-8 encoded string.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-04-30 17:45:01 +03:00
Arne Schwabe
84dbc5b9b2 Allow test/cli.cpp to be used with NetCfg Tunbuilder client
This requires cli.cpp to be included in openvpn3-linux build environment
and the right defines set before the test.cpp is included.

This workaround is necessary since the dbus dependencies are not part
of the core and to adding an extra copy of cli.cpp to openvpn3-linux

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2018-12-06 11:49:30 +01:00
Arne Schwabe
2ea88a93ba Add Remote endpoint information to protect_socket call
On the linux client we need the information to which remote the client
is connecting to query the route information to ultimately discover the
device. On other platform that do not need these extra information we
ignore the extra arguments

The API uses std::string and bool instead of passing of passing IPAddr as
the API needs to be understand by Swig/Java and similar methods also opt in
favour of call by value and simply types.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2018-12-04 13:33:18 +01:00
Antonio Quartulli
0a081ee17f
[OVPN3-315] cli/go: add option to compile SITNL component
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-11-30 08:51:14 +10:00
David Sommerseth
4a25059f5c
test/ovpncli: Don't override PROF env variable
If the PROF env variable is already set, respect that original value
instead of enforcing a value which might be wrong on the build host.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2018-11-07 17:57:08 +01:00
Antonio Quartulli
8d9834b793
cli: build with OPENVPN_VERSION generated from commit id
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-06-25 16:37:51 +08:00
James Yonan
0e673f1e0b Cleaned up cli build script
Also added an option to build with OpenSSL
instead of mbedTLS.

Signed-off-by: James Yonan <james@openvpn.net>
2018-05-21 11:34:01 +03:00
Antonio Quartulli
d9b5055cda
[OVPN3-169] cli.cpp: compile with -DOPENVPN_TLS_LINK when requested
Compile with -DOPENVPN_TLS_LINK if TLS=1 was specified on
the command line

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-04-19 17:38:19 +08:00
James Yonan
59de63fa65
cli.cpp: added OPENVPN_REMOTE_OVERRIDE
For testing, add the capability to get the next "remote"
directive from the output of an external script or binary.

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-26 23:58:35 +08:00
James Yonan
01ee1f5a41
Added ClientAPI::Config::retryOnAuthFailed parameter
// If true, consider AUTH_FAILED to be a non-fatal error,
  // and retry the connection after a pause.
  bool retryOnAuthFailed = false;

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:33 +08:00
James Yonan
eedee4fa6d
cli.cpp: allow -s server override to reference a friendly name
The OpenVPN 3 config file parser allows an embedded server list,
given as:

  setenv SERVER <HOST1>/<FRIENDLY_NAME1>
  setenv SERVER <HOST2>/<FRIENDLY_NAME2>
  . . .

This patch allows the -s server override to specify
a friendly name and will substitute the host or IP
address given in the server list.

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:32 +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