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

171 Commits

Author SHA1 Message Date
James Yonan
94ffa2318c ovpn3 "cli" client : support DEBUG=3 in build script
to enable full debug info and disable optimization.
2016-06-26 21:56:53 -06:00
James Yonan
2f1fd1ad83 Added INFO notification to OpenVPN control channel protocol:
INFO,<payload>

Payload can be any UTF-8 printable string under 64 KB
(multiple lines are okay).

INFO notifications can be sent from server to client
in real-time, on any active client connection.

The client will attach the payload to an INFO event and
forward it to the controlling app via the event callback:

  virtual void event(const Event&) = 0;
2016-05-10 17:53:09 -06:00
James Yonan
74d89fab7c OpenVPN protocol core : when passing objects to methods that
may assert ownership over them, use C++11 rvalue/move
semantics.
2016-05-10 13:02:11 -06:00
James Yonan
2255bab03a OpenVPN protocol core : added logic to control channel
receive path to reassemble messages fragmented by the
SSL layer up to a max message size of 64 KB.

Ramifications:

* Peer info data and pushed options can be significantly
  larger (i.e. approaching 64 KB).

* Less need for the options continuation feature.

Limitations:

* While this patch doesn't change the underlying OpenVPN
  protocol, it can result in messages being sent that are
  fragmented by the receiving SSL implementation into
  multiple buffers.  Implementations that lack reassembly
  capabilities (such as OpenVPN 2.x at this point in time)
  would see each buffer fragment as a separate message.

* This patch running on the server will break negotiation
  with pre-peer-info clients.  Basically this means it will
  interoperate with any OpenVPN 3 version or OpenVPN 2.x
  version that includes the June 2010 commit "Implemented a
  key/value auth channel from client to server.
  Version 2.1.1i".
2016-05-09 21:39:04 -06:00
James Yonan
c033a93aa7 proto test : offset client/server reneg-sec to avoid
renegotiation collisions, and add note about new OpenSSL
error that can be triggered by such collisions.
2016-05-06 14:13:09 -06:00
James Yonan
0f40e47f9c cli.cpp : in log() method, use a mutex around std::cout
output, since log() can be called from multiple threads.
2016-04-09 00:57:21 -06:00
James Yonan
86d7729794 clievent : distinguish between 3 event categories
(instead of 2):

(a) ordinary events such as CONNECTING, CONNECTED,
(b) nonfatal errors such as TRANSPORT_ERROR that will
    automatically trigger a reconnect, and
(c) fatal errors such as AUTH_FAILED, that will be followed
    by a DISCONNECT

In ClientAPI::Event, added a new "fatal" boolean to indicate
when errors are fatal.

Added a new non-fatal event TUN_ERROR that triggers a
reconnect when errors are indicated in tunio.hpp.
2016-03-31 20:24:28 -06:00
James Yonan
081925f81b Removed gok script. 2016-03-19 02:00:26 -06:00
James Yonan
2b42b96312 Added IPv6 setting to ovpn3 client API via
ClientAPI::Config::ipv6 string:

  IPv6 preference
    no      -- disable IPv6, so tunnel will be IPv4-only
    yes     -- request combined IPv4/IPv6 tunnel
    default (or empty string) -- leave decision to server
2016-02-05 12:16:20 -07:00
James Yonan
426eb9d671 Autologin Sessions are now enabled via the client API
bool ClientAPI::Config::autologinSessions and default
to false.  Previously, the logic was hardcoded to true.

Autologin Sessions can be enabled in the cli.cpp wrapper
using the -a flag.
2016-02-04 11:39:44 -07:00
James Yonan
cd675664f0 Added build flag OPENVPN_DISABLE_EXPLICIT_EXIT to prevent
client from sending an Explicit Exit message to server on
disconnect.  Intended only for testing.
2016-01-27 14:16:03 -07:00
James Yonan
e3be7b998b Added gremlin option to client, controllable via
ClientAPI::Config::gremlinConfig string.

The gremlin option allows extra packet latency
or unreliability to be added to the tunnel.

The format of the option is a comma-separated list
of numerical parameters:

  send_delay_ms, recv_delay_ms, send_drop_prob, recv_drop_prob

Parameter description:

  send_delay_ms  : delay packets by n milliseconds before
                   transmission (UDP/TCP).
  recv_delay_ms  : delay received packets by n milliseconds
                   before processing them (UDP/TCP).
  send_drop_prob : drop sent packets with probability 1/n
                   (UDP only).
  recv_drop_prob : drop received packets with probability
                   1/n (UDP only).

Set any parameter to 0 to disable.

Gremlin parameters currently work with UDP and TCP
transport as documented above, but not for proxy transport.

Client must be built with the OPENVPN_GREMLIN flag to compile
gremlin functionality.

Command-line client can set the gremlin config
string using --gremlin or -G, for example:

  --gremlin=250,250,64,64

When using the above parameters, an extra 500 milliseconds
will be added to round-trip latency, and 1/64 sent or
received packets will be dropped.
2016-01-26 00:27:11 -07:00
James Yonan
8e9c059680 In command line client (cli.cpp), allow additional config
file directives to be specified on the command line after
the config file name.
2015-12-28 13:23:39 -07:00
James Yonan
1219720d26 In cli.cpp, fixed regression where command line arg
parser wasn't aligning correctly on the argv array.
2015-12-11 12:11:25 -07:00
James Yonan
ee8489afe2 In test/ssl/go, build for PolarSSL by default but
build for OpenSSL if OSSL=1.
2015-11-27 17:25:59 -07:00
James Yonan
a96c972c43 Refactored cli.cpp so it can be called externally
via openvpn_client() method.
2015-11-25 19:51:12 -07:00
James Yonan
8fd85864c3 In cli.cpp, document the process for using a custom logging
class with ovpn3 core:

  // If enabled, don't direct ovpn3 core logging to
  // ClientAPI::OpenVPNClient::log() virtual method.
  // Instead, logging will go to LogBaseSimple::log().
  // In this case, make sure to define:
  //   LogBaseSimple log;
  // at the top of your main() function to receive
  // log messages from all threads.
  // Also, note that the OPENVPN_LOG_GLOBAL setting
  // MUST be consistent across all compilation units.
  #if 0
  #define OPENVPN_LOG_GLOBAL // use global rather than thread-local log object pointer
  #include <openvpn/log/logbasesimple.hpp>
  #endif
2015-11-25 11:31:24 -07:00
James Yonan
0609c76c0b Refactored Mac OS X tun handler (tuncli.hpp) by moving tun
interface management code into TunMac::Setup()
(tunsetup.hpp).

Added TunBuilderSetup::Config, Base, and Factory for use
as a unix-portable abstraction layer for tun interface
management code.

Added Stop object pointer to Mac OS X tun config
(TunMac::ClientConfig), so that tun management code can
detect stop commands if it's blocking outside of outer
asio::io_context.
2015-11-20 19:16:39 -07:00
James Yonan
a9ed9d47f2 ovpn3 client API now supports adding user-defined peer-info
data to the OpenVPN handshake (peer-info is a client -> server
key/value list that is part of the OpenVPN protocol).  To
add peer-info key/value pairs, use ClientAPI::Config::peerInfo.

Incremented core OPENVPN_VERSION to "3.0.6".
2015-09-21 19:42:24 -07:00
James Yonan
1acc33feaf Obsoleted asiodispatch in favor of C++11 lambdas. 2015-06-25 13:59:12 -06:00
James Yonan
0bac5d8990 Core: revamped packet ID code to use a much larger window size,
allowing backtracks of up to 2048 (previous limit was 64).
In addition, we now maintain the packet ID window as a bit
array (previously a byte array was used).
2015-06-18 01:55:52 -06:00
James Yonan
496e797a21 Added client hooks for DCO (Data Channel offload).
Updated tun implementation on Linux.
2015-06-17 01:48:33 -06:00
James Yonan
b9844280e0 Minor gitignore mod. 2015-06-11 12:32:42 -06:00
James Yonan
c4a9cea3e1 Updated Windows client for VS 2015. 2015-06-09 11:21:41 -06:00
James Yonan
1563dca02f Added Asio to deps/lib-versions.
Removed Snappy dependency as ovpn3 clients now
standardize on LZ4 (with LZO-asym fallback).
2015-06-06 13:29:30 -06:00
James Yonan
c6a21c827b Boost dependency elimination -- final removal of Boost
dependency.  Asio is now included as a standalone,
header-only dependency.
2015-06-06 10:59:18 -06:00
James Yonan
8d9e1e2e41 Deleted some obsolete server files. 2015-06-04 21:06:07 -06:00
James Yonan
9c23b145a2 In ovpn3 command-line client (cli.cpp), scope the signal handler
(for unix) so that it's only active during thread->join() to
minimize potential deadlock issues between signal handler and
main thread.
2015-05-27 22:01:05 -06:00
James Yonan
b75c780cab Renamed boost::intrusive_ptr<T> usage to RCPtr<T>. 2015-05-17 21:26:53 -06:00
James Yonan
35ac9f6229 Renamed types.hpp to size.hpp since it now only defines
size_t and ssize_t.
2015-05-17 13:27:34 -06:00
James Yonan
e494846f7d Moved count_t to its own header file. 2015-05-17 13:17:24 -06:00
James Yonan
fe6fcefa61 C++11 : rename NULL to nullptr 2015-05-17 02:53:37 -06:00
James Yonan
3bcf8743c1 More conversions of threads/mutexes from boost to C++11 std.
As part of this work, removed openvpn/common/thread.hpp
2015-05-10 20:04:22 -06:00
James Yonan
e4c2ab6c71 In cli.cpp, improve dynamic challenge/response support.
In client API, allow ClientAPI::ProvideCreds::dynamicChallengeCookie
to be set with either the dynamic challenge/response State ID
or the full cookie.
2015-05-10 15:39:57 -06:00
James Yonan
f094f93213 In cli.cpp build script, enable -DOPENVPN_SHOW_SESSION_TOKEN 2015-05-10 15:38:43 -06:00
James Yonan
2144a08c69 Converted test/ssl/proto.cpp from boost::thread to std::thread. 2015-04-23 17:17:40 -06:00
James Yonan
a51c0bf0bf Mostly complete transition from boost::thread to std::thread. 2015-04-23 17:07:56 -06:00
James Yonan
2ca397b513 Core: #define BOOST_DISABLE_ASSERTS because boost asserts on
null smart pointer dereferences are fairly useless
since a segfault will generate more actionable debug info.
2015-04-10 23:48:24 -06:00
James Yonan
a37949cade Minor change to test/ovpncli/go script. 2015-04-10 22:40:10 -06:00
James Yonan
7927982371 Added "Exclude Routes Emulation" feature for both IPv4 and IPv6.
This feature is needed by Android because it lacks a native
VPN API method for excluding routes.

If redirect-gateway is enabled and exclude routes are present,
such as:

  route 54.215.128.71 255.255.255.255 net_gateway

the client will emulate the excluded route(s) by adding routes
that encompass the entire IPv4/v6 address space EXCEPT for the
excluded route.  These routes will be used for redirect-gateway
instead of the standard 0.0.0.0/0 and ::0/0.
2015-02-28 15:09:53 -07:00
James Yonan
8f4b17ce6a Add extension parameter to ProfileMerge constructor to allow
parsing of files with non-ovpn extensions.
2015-02-10 15:48:08 -07:00
James Yonan
5c31950852 Added TLS version min override parameter to ClientAPI::Config:
// Override the minimum TLS version:
  //   disabled -- don't specify a minimum, and disable any minimum
  //               specified in profile
  //   default or ""  -- use profile minimum
  //   tls_1_0  -- use TLS 1.0 minimum (overrides profile)
  //   tls_1_1  -- use TLS 1.1 minimum (overrides profile)
  //   tls_1_2  -- use TLS 1.2 minimum (overrides profile)
  std::string tlsVersionMinOverride;
2015-02-04 20:29:43 -07:00
James Yonan
a1a3b6f256 Added "--alt-proxy, -A" help message to test/ovpncli/cli.cpp. 2015-02-04 14:57:09 -07:00
James Yonan
557df02296 Added AltProxy API that allows for alternative proxy implementations
to be developed outside the core.
2015-02-02 23:11:51 -07:00
James Yonan
73672d1884 Added SSLConfigAPI abstract base for configuring SSL properties
independently of SSL implementation.
2015-01-31 21:51:25 -07:00
James Yonan
d4af03c205 Extended follow_references parameter of ProfileMerge class to allow
for full reference following (e.g. cert ssl/serv.crt) as is helpful
in server-side environments.
2015-01-19 14:30:37 -07:00
James Yonan
84fb5c7731 Added NULL=1 option to test/ovpncli/go to build a tunnull binary. 2015-01-17 04:41:46 -07:00
James Yonan
c2c7292a70 Updated copyright to 2015. 2015-01-06 12:56:21 -07:00
James Yonan
3fe1a359c0 Added OpenSSL GCM support. 2014-12-31 00:24:54 -07:00
James Yonan
3115ad5cfe test/ssl/proto.cpp changes:
1. work with latest proto.hpp API changes.
2. NOERR -- if defined, turn off simulated errors
3. FORCE_AES_CBC -- set force_aes_cbc_ciphersuites SSL flag
4. if VERBOSE, enable SSL debugging output
2014-12-30 18:15:05 -07:00