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

45 Commits

Author SHA1 Message Date
James Yonan
aed0678c96 SSL: added SNI::Metadata, an abstract base class for packaging app-specific SNI metadata in AuthCert
Signed-off-by: James Yonan <james@openvpn.net>
2019-07-17 10:53:46 -06:00
James Yonan
5eb39c1dea
AuthCert: save the SNI name
Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:02 +02:00
James Yonan
d5eb77c53c
AuthCert::Fail cleanup
* Make error code priority more rational, where the composite
  error code of the whole object (i.e. the get_code() return
  value) is the most severe error of any added failure.

* For clarity, rename OTHER to CERT_FAIL.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:01 +02:00
James Yonan
bbae814864
OpenSSL: added SNI implementation
On the server side, we add the abstract base class
SNIHandlerBase to provide a hook (sni_hello) where
servers can inspect the SNI name given in the client
hello message and possibly return a different SSLFactoryAPI.

In other changes, we rename the ENABLE_SNI flag to
ENABLE_CLIENT_SNI to be clear that this flag only affects
the client-side SNI implementation.

We also add the NO_VERIFY_HOSTNAME flag on the client side
to allow the SNI name to be transmitted to the server
without requiring a match between the SNI name and the
common name or subject alternative name in the server
certificate.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:21:00 +02:00
James Yonan
f9631cd90f
AuthCert::Fail: use std::string for the reason string (instead of const char *)
Also added AuthCert::fail_str() method.

Signed-off-by: James Yonan <james@openvpn.net>
2019-06-19 18:20:59 +02:00
James Yonan
3e5921c06d
AuthCert: added is_uninitialized() method
Signed-off-by: James Yonan <james@openvpn.net>
2019-05-15 19:12:59 +02:00
James Yonan
1da56fcce6 ValidateCreds: added strict flag for use with OMI
The OMI model (OpenVPN management interface) can't deal
with control characters in credentials, so we add a strict
flag to ValidateCreds::is_valid() that when true will
validate according to OMI requirements.

Also increased max length for credentials under strict=true
to 512 for OMI.

Signed-off-by: James Yonan <james@openvpn.net>
2018-05-21 11:34:02 +03:00
James Yonan
52e4d4a5f2
Increase client validation of password/response size to 16KB to support bundling SAML messages.
Also, don't fail (client-side) a username containing spaces
since the server side will already accept this.

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-26 23:58:35 +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
6e8f2a73f8 Moved openvpn::to_string() to separate source file.
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 15:46:45 -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
050e8717f1 mbedTLS: Port from polarssl-1.3 to mbedtls-2.3 (symbol renames)
This patch renames internal OpenVPN 3 symbols
from polarssl -> mbedtls.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 12:24:54 -06:00
James Yonan
9c0397ebd3 Added Relay capability, a kind of proxy function similar
to HTTP CONNECT but implemented over the OpenVPN protocol.

1. Client connects to relay server as if it were connecting
   to an ordinary OpenVPN server.

2. Client authenticates to relay server using its client
   certificate.

3. Client sends a PUSH_REQUEST method to relay server which
   then replies with a RELAY message instead of PUSH_REPLY.

4. On receiving the RELAY message, the client attempts to
   reconnect using the existing transport socket.  The
   server will proxy this new connection (at the transport
   layer) to a second server (chosen by the relay server)
   that is the target of proxy.

5. The client must establish and authenticate a new session
   from scratch with the target server, only reusing the
   transport layer socket from the original connection to
   the relay server.

6. The relay acts as a man-in-the-middle only at the
   transport layer (like most proxies), i.e. it forwards
   the encrypted session between client and target server
   without decrypting or having the capability to decrypt
   the session.

7. The client is designed to protect against potentially
   untrusted or malicious relays:

   (a) The client never transmits the target server
       username/password credentials to the relay server.

   (b) The relay forwards the encrypted OpenVPN session
       between client and target server without having
       access to the session keys.

   (c) The client configuration has a special directive
       for relay server CA (<relay-extra-ca>) and relay
       server tls-auth key (<relay-tls-auth>) to allow
       for separation of TLS/crypto configuration between
       relay and target servers.

   (d) The client will reject any PUSH_REPLY messages
       from the relay itself to prevent the relay from
       trying to establish a tunnel directly with the
       client.

Example configuring a client for relay:

  # remote addresses point to the relay server
  remote ... 1194 udp
  remote ... 443 tcp

  # include all other directives for connecting
  # to the target server

  # enable relay mode
  relay-mode

  # constrain the relay server's cert type
  relay-ns-cert-type server

  # include extra CAs that validate the relay
  # server cert (optional).
  <relay-extra-ca>
  -----BEGIN CERTIFICATE-----
  . . .
  -----END CERTIFICATE-----
  </relay-extra-ca>

  # specify the TLS auth key for the relay server
  relay-key-direction 1
  <relay-tls-auth>
  -----BEGIN OpenVPN Static key V1-----
  . . .
  -----END OpenVPN Static key V1-----
  </relay-tls-auth>
2017-03-18 12:24:54 -06:00
Samuli Seppänen
04b2a3c9b7 Switch from AGPLv3 to GPLv3
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2017-03-16 14:43:55 +02:00
James Yonan
971abda88f copyright : updated to 2016 2016-09-03 23:29:23 -06:00
James Yonan
fc249e6a46 OpenSSL, AuthCert : implemented DEFERRED_CERT_VERIFY SSL
flag, to allow server-side SSL users to get information
about client certificate validation errors without
immediately terminating the connection.  This allows
certificate errors to be handled at a higher level, such
as by messaging error info to the peer over the TLS control
channel.
2016-07-30 15:17:57 -07:00
James Yonan
efd909a901 AuthCert/SSL : support x509-track. Initially, only OpenSSL
is supported.  In AuthCert, made all data members private,
but friend SSL implementation classes.
2016-05-05 00:18:42 -06:00
James Yonan
529912629a In AuthCreds, added is_valid_user_pass() and refactored
is_valid() in terms of it.
2016-02-04 11:22:11 -07:00
James Yonan
a8ace74e8a AuthCreds::is_valid() method now additionally validates
username/password using new validate_auth_cred() function.
2015-12-22 19:26:48 -07:00
James Yonan
82972668eb Added validate_auth_cred() function to do basic validation on
authentication credentials such as username, password, and
challenge response.
2015-12-22 19:25:34 -07:00
James Yonan
544afc3e0e In class AuthCreds, comment out code that could
log password in debug mode.
2015-12-22 19:06:28 -07:00
James Yonan
88d171d197 AuthCreds changes: added defined() and is_valid() methods. 2015-06-27 16:31:20 -06:00
James Yonan
bc6cfa2b20 Added a couple methods in AuthCert:
cn_defined()    : return true if CN is defined
normalize_cn()  : remove trailing "_AUTOLOGIN" from AS certs
2015-06-27 16:28:37 -06:00
James Yonan
88518335c4 Boost dependency elimination -- change boost::algorithm
usage (for string algorithms) to use methods of our own
implementation in openvpn/common/string.hpp.
2015-06-04 19:22:59 -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
fe6fcefa61 C++11 : rename NULL to nullptr 2015-05-17 02:53:37 -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
aacdfd54f6 Added ChallengeResponse::generate_dynamic_challenge(). 2015-05-10 15:29:38 -06:00
James Yonan
c51a728a76 Added ChallengeResponse::parse_static_cookie(). 2015-05-01 13:43:10 -06:00
James Yonan
2c872dacb5 In AuthCert::issuer_fp_str(), add the option to format
fingerprint in OpenSSL format.
2015-05-01 13:40:05 -06:00
James Yonan
762f84a7db Added AuthCert::defined() method. 2015-01-12 23:23:41 -07:00
James Yonan
e0910bf6c4 Added PolarSSL AuthCert support (server-side only). 2015-01-12 23:20:23 -07:00
James Yonan
7f040d6482 Minor reordering of struct AuthCert data members. 2015-01-12 10:52:35 -07:00
James Yonan
ec0e7d5549 On server side, collect client cert info in the
new AuthCert object, and pass it through to
management decision object along with other creds
to consider for authentication.

In OpenSSL driver, split the verify_callback
function into client/server versions.

Modified InitProcess to do a special one-time call of
SSL_get_ex_new_index in OpenSSL library, so that we
can store a private object pointer in an OpenSSL
SSL struct.

TODO: Add AuthCert functionality to PolarSSL driver.
2015-01-08 15:33:48 -07:00
James Yonan
c2c7292a70 Updated copyright to 2015. 2015-01-06 12:56:21 -07:00
James Yonan
eb25f37d11 Route:
* Make class Route standalone, moving it out of namespace
  CIDRMap.

CryptoAlgs:

* Added comments

* For type-safety, mode() now returns a Mode rather than an
  int.

CryptoDC:

* Added CRYPTO_DEFINED flag to indicate when encrypt() and
  decrypt() methods are implemented by a data channel
  provider.

Manage:

* Implemented skeleton management API for server-side client
  authentication and managing client-instance properties.

Proto:

* Added Config::update_dc_factory() method.

* Support new CryptoDCInstance::CRYPTO_DEFINED flag.

* Updated server_auth() method to support SafeString transit
  of client-provided auth-user-pass password to management
  layer.

* control_send now does a reset() on the provided
  Ptr reference before returning to reflect the
  transfer-of-ownership of the underlying buffer.

* Implemented disable_keepalive() and override_dc_factory
  methods.

Transbase (server) new methods:

  // disable keepalive for rest of session
  virtual void disable_keepalive() = 0;

  // override the data channel factory
  virtual void override_dc_factory(const CryptoDCFactory::Ptr& dc_factory) = 0;

  // override the tun provider
  virtual TunClientInstanceRecv* override_tun(TunClientInstanceSend* tun) = 0;

ServProto:

* Added abstract base classes for Tun factories and client instance
  sender/receivers.

* Added Tun and Management linkages.

* Added new receiver methods for overriding the data channel
  factory, Tun factory, and keepalive config.

* Added AuthCreds support.
2014-10-30 10:41:53 -06:00
James Yonan
2c6d972ad6 Added AGPL copyright/licensing language. 2014-07-20 21:22:06 -06:00
James Yonan
4d9a751af2 Added head comments to all source files.
Minor reorganization of unicode code.
2012-11-23 06:18:43 +00:00
James Yonan
5a5a18942a Added parser size validation constants in
openvpn/client/cliconstants.hpp
2012-11-12 01:52:03 +00:00
James Yonan
3ca3a857bd Initial HTTP proxy implementation in core, with support for
non-authenticated proxies and Basic Auth.

Includes new PROXY_ERROR and PROXY_NEED_CREDS events.

Still to do: Digest and NTLM auth.
2012-10-24 06:38:20 +00:00
James Yonan
48ab9cbbe9 Added our own system() implementation to allow args to be passed as
array instead of concatenated string, and to resolve issue on OS X
where signals were being ignored after system() was called.

C++ iterators incremented in a for statement should usually use
a preincrement syntax.
2012-09-12 04:24:05 +00:00
James Yonan
a6b6d487ef Global edit to add copyright notice at head of each source file. 2012-08-24 21:13:42 +00:00
James Yonan
3a04648684 Android 4 client -- Implemented dynamic challenge/response. 2012-03-03 02:56:58 +00:00