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

187 Commits

Author SHA1 Message Date
Arne Schwabe
9ad98bae8f Add building ovpncli swig library to cmake build
This also moves ovpncli.i to a proper place
2021-12-15 13:05:14 +01:00
Arne Schwabe
d7b316bd11 Move helper function from OpenVPNClient int OpenVPNClientHelper
This also makes most of them non-static to avoid the problem that these
functions depend on Initprocess::Init being instantiated before being
called.

Rename the local variables eval to eval_cfg to avoid shadowing the
class field of the same name.
2021-12-15 13:03:41 +01:00
Arne Schwabe
d583aee26c Remove OpenVPNClient::app_expire() functionality
Early client seemed to have an inbuilt expire date. But that
functionality is no longer used and can be removed.
2021-12-15 13:03:19 +01: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
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
David Sommerseth
ca61dd97db
Merge support for --redirect-gateway local from released 2020-09-02 20:35:47 +02: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
123865356d rename ENABLE_DCO to ENABLE_KOVPN
As a preparation for ovpn-dco support.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-26 10:53:27 +00:00
Lev Stipakov
7193de12ab
Support for redirect-gw local
When VPN server is in local network and
not accessible via default gateway, adding bypass route
via default gw (as we do on windows/mac) makes server
inaccessible.

This handles client-side config option "redirect-gw local"
and skips adding bypass route via agent.

Fixes OVPN3-653

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-08-11 11:42:05 +03:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
Arne Schwabe
6e463ca1f4
Implement tls-cipher and tls-ciphersuite
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
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
97f0407923
mac: add bypass route from socket_protect call
This is used to enable connectivity to a different remote
when force-tunneling is used and current VPN connection is broken.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-15 23:12:28 +01:00
Lev Stipakov
acec6e80ee
mac: add bypass route from socket_protect call
This is used to enable connectivity to a different remote
when force-tunneling is used and current VPN connection is broken.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-11-20 11:22:40 +01:00
Lev Stipakov
87d40ed8da ovpncli.cpp: socket_protect implementation for agent-enabled builds
socket_protect() is called before connecting to remote and this
makes sure that we will be able to (re)connect when there is
existing VPN connection and tunnel is broken.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-10-10 15:23:17 +03:00
Lev Stipakov
0d7143c4bf transport: enable socket_protect call for all platforms
This enables socket_protect call for all transports / platforms
with default implemenation being no-op.

This is needed for better round-robin DNS
fix for Connect clients (OVPN3-427).

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-10-10 15:23:17 +03:00
Antonio Quartulli
3166957e2e
add error codes for better error management at profile parsing time
Prefix error messages with a predefined string of the form:

ERR_PROFILE_xxxxx:

This way a user can parse the prefix and get a better understanding of
the error, without relying on the sole message.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-10-09 17:58:05 +02:00
Arne Schwabe
7c39088f00 Allow overriding reported HW_ADDR and support IV_PLAT_VER 2019-08-29 16:33:05 +02:00
Arne Schwabe
34a3f264f5 [OVPN-314] Add support for signalling SSO support via IV_SSO 2019-06-13 12:05:16 +02: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
David Sommerseth
d85e92621d
Make reproducible builds possible
Packaging OpenVPN 3 Linux on Debian reports this warning:

openvpn3-core/client/ovpncli.cpp:1380:27: warning: macro "__DATE__" might prevent reproducible builds [-Wdate-time]
       ret += " built on " __DATE__ " " __TIME__;

Reproducible builds is something which will come arrive in more
distributions, as it is a good way to verify that binary builds contains
the expected source code and has not been mangled by the packager.

This changes the current behaviour and will not provide the date/time
stamps unless the OPENVPN_DEBUG macro has been set.  Enabling this
macro will re-enable the date/time stamp reporting via
OpenVPNClient::platform().

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-05-07 19:59:21 +02:00
Arne Schwabe
9768562a01 OpenSSL 1.1: Add argument to external sign to specify algorithm
In TLS 1.3 the RSA-PSS padding is required in addition to the
traditional PKCS1 padding used in TLS 1.2 and below. Add an
argument to the external sign function to signal what padding
is required. As quirkyness OpenSSL calls out requesting a NONE
padding instead of RSA-PASS.

We might need to move from RSA_method to EVP_PKEY_method in the
future.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-04-15 15:47:22 +02:00
Arne Schwabe
0a0d080a49 Implement allowing local LAN access
On Android local networks need to be excluded from the default (or any
other route) route if they should bypass the VPN. This adds a callback
to specifically bypass the local LAN networks.
2019-03-12 11:36:29 +01:00
Antonio Quartulli
d5eeb78ed9
ClientAPI: print core version when starting
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-01-30 11:09:16 +10: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
Lev Stipakov
9e600c89e7 Merged in OVPN3-211-implement-big-mutex (pull request #5)
[OVPN3-211] bigmutex: introduce macro to ensure thread-safety

Approved-by: James Yonan <james@openvpn.net>
2018-06-08 08:03:44 +00:00
Lev Stipakov
ccc17a5631 [OVPN3-211] bigmutex: introduce macro to ensure thread-safety
Platforms like UWP and iOS may call core methods
from another threads. Since core is not thread-safe,
we provide OPENVPN_ASYNC_HANDLER macro which instantiates
lock guard. It follows RAII principle and locks global
mutex in constructor and unlocks in destructor. This
guarantees that code in block protected with this macro
won't be called simultaneously from different threads.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-06-07 21:17:42 +03:00
James Yonan
a8e9605f15 ClientAPI::OpenVPNClient: fixed erroneous comment
Signed-off-by: James Yonan <james@openvpn.net>
2018-05-21 11:34:01 +03:00
James Yonan
b7075014a4 RemoteOverride: handle exceptions thrown from virtual remote_override() method
Signed-off-by: James Yonan <james@openvpn.net>
2018-05-21 11:34:01 +03:00
Lev Stipakov
3e49de7dea [OVPN3-210] ovpncli: handle "allow-name-constraints" for OpenSSL
This is mbedTLS-only option, which has no effect on OpenSSL-built client.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-04-19 11:11:39 +03:00
James Yonan
68595de4d1
ClientAPI::RemoteOverride: added error status
RemoteOverride agent can now return an error status.

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
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
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
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
James Yonan
d496311ade ovpncli.hpp: inline LogInfo constructor for clarity
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
Lev Stipakov
96e0d89454 Revert "Merged in OVPN3-21-prepend-log-record-with-unique- (pull request #7)"
This reverts commit 62423c91cb, reversing
changes made to f26b08b6ef.
2017-09-27 16:16:18 +08:00
Lev Stipakov
cce245587b Prepend log string with unique reference.
OVPN3-21

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-08-08 11:35:37 +03:00
James Yonan
3ba37fcb91 OpenVPN 3 client: added OPENVPN_OVPNCLI_ASYNC_SETUP flag.
Added OPENVPN_OVPNCLI_ASYNC_SETUP flag, which causes most
of ClientAPI::OpenVPNClient::connect() setup to run as an
openvpn_io::post() handler.  This is potentially useful in
i/o layer implementations to guarantee sequenced execution
of core setup and handlers.

Signed-off-by: James Yonan <james@openvpn.net>
2017-04-17 23:28:36 -06:00
James Yonan
4095565b4d OpenVPN 3 client: added tun abstraction layer.
To enable, #define OPENVPN_EXTERNAL_TUN_FACTORY

Then add override in your client class (that derives from
ClientAPI::OpenVPNClient):

  virtual TunClientFactory* new_tun_factory(const ExternalTun::Config& conf, const OptionList& opt) override
  {
    ...
  }

Signed-off-by: James Yonan <james@openvpn.net>
2017-04-13 13:28:34 -06:00
James Yonan
f89da9619e OpenVPN 3 client: added single-thread mode:
* enabled by OPENVPN_OVPNCLI_SINGLE_THREAD compile flag.

* turns off the signal blocker.

* Adds overrideable clock_tick() virtual method with
  configurable frequency that is used when processing
  signals when the OpenVPN client is running in
  single-thread mode.

Signed-off-by: James Yonan <james@openvpn.net>
2017-04-12 12:37:41 -06:00
James Yonan
233dfde2c2 OpenVPN 3 client: fixed state->session typos.
Fixed some minor typos where state->session was used even
though a direct pointer to session was available.

Signed-off-by: James Yonan <james@openvpn.net>
2017-04-12 12:35:57 -06:00
James Yonan
691a641a43 Added i/o abstraction layer.
Created a lightweight abstraction layer so that another i/o
reactor can be dropped in place of asio.

The basic approach is to rename all references to asio::xxx
types to openvpn_io::xxx and then make openvpn_io a
preprocessor variable that points to the top-level namespace
of the i/o reactor implementation.

All of the source files that currently include <asio.hpp> now
include <openvpn/io/io.hpp> instead:

This gives us a lightweight abstraction layer that allows us
to define openvpn_io to be something other than asio.

Other changes:

* Inclusion of asio by scripts/build is now optional, and is
  enabled by passing ASIO=1 or ASIO_DIR=<dir>.

* Refactored openvpn/common/socktypes.hpp to no longer
  require asio.

* Refactored openvpn/log/logthread.hpp to no longer require
  asio.

* Added openvpn::get_hostname() method as alternative to
  calling asio directly.

* openvpn/openssl/util/init.hpp will now #error
  if USE_ASIO is undefined.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-30 15:48:14 -06:00
James Yonan
2855053680 Moved asio files from openvpn/common to openvpn/asio
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-30 15:48:14 -06: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
88ae6eba36 SSL : added tls-cert-profile directive for mbedTLS.
legacy            -- allow 1024-bit RSA certs signed with SHA1
preferred         -- require at least 2048-bit RSA certs signed
                     with SHA256 or higher
suiteb            -- require NSA Suite-B

The current default is legacy.

The directive can be set in the profile or overridden/defaulted
in the client API via ClientAPI::Config::tlsCertProfileOverride
var.

TODO: implement for OpenSSL.
2017-03-18 12:24:54 -06:00