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

2375 Commits

Author SHA1 Message Date
Arne Schwabe
a5119c3a1a
Revamp OpenSSL tls cipher log message
The new message will look like this:

SSL Handshake: peer certificate: CN=OpenVPN Server, 4096 bit RSA, cipher: ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD

compared to the old message

SSL Handshake: CN=OpenVPN Access Server, TLSv1.2, cipher TLSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 3072 bit RSA

The new message uses the SSL_CIPHER_description method and its
formatting instead out homegrown format. It also moves the xxx bit RSA
part closer to the certificate to make it more obvious that those belong
together

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-04-22 16:52:55 +02:00
James Yonan
edc62cd3b4 PeerStats: added to_string() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-04-13 16:29:45 -06:00
James Yonan
81e9714326 BufferType: added constructor accepting a void *
Signed-off-by: James Yonan <james@openvpn.net>
2020-04-10 16:53:39 -06:00
Lev Stipakov
811dac2e3a xmlhelper.hpp: support for various tinyxml2 versions
This is mostly used by Linux client, which supports
among other distros CentOS7, Ubuntu 16 and Ubuntu 18 -
all of them have different tinyxml2 versions.

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
2020-03-19 07:35:36 +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
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
aaafb33d30
omi\openvpn.cpp: cancel wait on exit event
When OMI is stopped, we must cancel wait on
exit event, otherwise ASIO won't terminate event loop
and process won't exit.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-03-11 19:44:54 +01:00
Lev Stipakov
5bb7beb379
wstring.hpp: workaround for mingw's codecvt_utf8 bug
mingw produces incorrect result when converting
from utf8 to wchar_t using codecvt_utf8.

https://sourceforge.net/p/mingw-w64/bugs/538/
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-03-11 19:44:52 +01:00
Lev Stipakov
7cf2e210d1
mingw: fix various warnings
- remove unused variable
 - replace deprecated JsonReader with CharReader
 - fix initialization order
 - fix signed-unsigned comparison
 - fix string constant to char* conversion
 - fix unknown (to mingw) format character
 - fix passing NULL to non-pointer agrument
 - remove unneeded #pragma once

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-03-11 19:44:40 +01: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
995b6bf467 Added Time::from_seconds_since_epoch() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-03-08 17:37:26 -06:00
James Yonan
9ee92254a3 Time: added OPENVPN_TIME_NO_BASE preprocessor flag to optimize out the base variable for 64-bit platforms
The Time code was originally designed to be efficient on 32-bit
processors.  On 64-bit processors, define OPENVPN_TIME_NO_BASE
to optimize out the base_ variable.  This also has the benefit
of allowing Time to represent any arbitrary time_t value.

Signed-off-by: James Yonan <james@openvpn.net>
2020-03-08 17:35:21 -06:00
Arne Schwabe
ac25908d25 [JSON] Implement get_int64_optional and get_integer_optional
The get_integer_optional select the type to get from the JSON
dependent on the default_value parameter, making it simple to ensure
that the returned value will fit the requested type and range.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
c7972b0532 WS::Client: reworked SIMULATE_HTTPCLI_FAILURES to more closely hew to asio error throw points
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07: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
James Yonan
f004e09ae1 json: fixed get_string_ref() to properly return a string reference
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
84ef4533c6 WS::Client: implemented simulated network fault injection
Enable with SIMULATE_HTTPCLI_FAILURES

Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
05b51a9ec0 KoTun::API: added set_simulate_mesh_keepalive_failures() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:04 -07:00
James Yonan
021e10b5b1 openssl/compat.hpp: added missing #include
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-28 11:56:03 -07:00
Arne Schwabe
f014afdf5c Fix potential double free reported by Coverity
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 17:04:26 +01:00
Arne Schwabe
4330c67a46 OpenSSL: Use ctx != nullptr to infer if initialised
Before the OpenSSL 1.1 changes ctx was a struct and not a pointer, so
the extra variable was necessary
This also solves a defect reported by Coverity of ctx not always
initialised.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 17:04:26 +01:00
Arne Schwabe
bade36f2ad Add missing openssl/dh.h include in dh.hpp
This is needed when compiling without OPENSSL_API_COMPAT

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-26 12:45:59 +01:00
David Sommerseth
6969264a94
Merge changes applied to coming Core release
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-19 18:24:49 +01:00
David Sommerseth
1f92c424e1
Finalizing OpenVPN 3 Core library release v3.5.4
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-02-19 18:06:17 +01:00
Lev Stipakov
ad5f819ea3
win/tunutil.hpp: read adapter name as Unicode
Adapter name can contain non-ascii chars. Read it as unicode
and convert to utf-8.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-19 17:56:34 +01:00
Antonio Quartulli
16db74d10a
async_resolve: detach resolve thread when resolution is cancelled by the user
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-02-19 16:38:06 +01:00
Arne Schwabe
a1250b9bed Announce Chacha20-poly1305 in IV_CIPHER if supported
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Arne Schwabe
80399075d4 Implement CHACHA20-Poly1305 support for data channel
This also changes the mbed TLS implementation from using the AES GCM
specific API to the generic AEAD API in mbed TLS. As result we can
refactor the commonly used parts of AEAD and normal cipher into a
common class.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Arne Schwabe
424d9b34af Rename GCM classes and files to AEAD
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-18 18:50:27 +01:00
Lev Stipakov
a5853870a8
fix clang warnings: remove unused variables
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:46 +02:00
Lev Stipakov
46673d2c9a
mingw: add WFP-specific guids
MinGW doesn't have those.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:44 +02:00
Lev Stipakov
1fabe7e674
mingw: fix ndisguid include
ndisguid.h is located in different directory
in mingw, comparison to msvc.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:44 +02:00
Lev Stipakov
b17889fcd6
mingw: add missing include
FOLDERID_System used in this file is defined in "knownfloders.h"

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
0a2663cc2b
scoped_handle.hpp: remove SEH code
This code is MSVC specific (other compilers
don't support SEH) and is only useful during
debugging.

It is better to remove it and mute exception
in debugger, than add ifdefs for other compilers.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
a0af80be25
file.hpp: use best available ifstream constuctor
c++17 provides overload, which accepts
std::filestream::path, which accepts wchar_t,

MSVS provides overload, which directly accepts wchar_t.

In other cases use char constructor. This likely breaks
support of non-ascii profile paths.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 21:48:43 +02:00
Lev Stipakov
e844bd466b
mingw: change arguments order in lambda
Having capture without initializer after nested struct
is broken in GCC 7.x and is fixed starting from GCC 8.1
(see https://stackoverflow.com/questions/60110629/).

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 16:12:20 +02:00
Lev Stipakov
9393206d74
mingw: add bswap64 implementation for mingw
Because MinGW doesn't provide it
(see https://sourceforge.net/p/mingw/mailman/message/18337754/)
and we use compiler-specific implementations.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-12 16:12:19 +02: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
743a525f16
Fix netlink add_bypass_route not working with IPv6
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-02-07 21:12:57 +01:00
Lev Stipakov
7dabcb3cee
omiclient: support for wintun driver
Use wintun driver if config contains

    --windows-driver wintun

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:56 +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
67fb123b88
ovpnagent: start openvpn process
This is needed to make openvpn-gui client work with openpvn3.

openvpn-gui passes all information, required to start vpn session,
to agent via named pipe. Agent impersonates another end of pipe,
which is gui process, running under user privileges, and starts
openvpn process.

openvpn-gui generates a random password, which is written by agent
into openvpn process's stdin. That password is used by openvpn-gui to
connect to openvpn's management interface.

openvpn-gui creates an event with unique name, which it is passed
to openvpn via command line. When user disconnects VPN session, gui
sets event into signalled state. openvpn waits on event and, when it is signalled, quits.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:54 +01:00
Lev Stipakov
e5f7fd55d8
cmake: disable agent path check for omiclient
This is useful for debugging.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 19:41:53 +01:00
Lev Stipakov
b2e8cb42f0
Add GPL headers
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-05 20:08:58 +02:00
James Yonan
f3c5a7a77e
json: added write_fast() method
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:57 +02:00
James Yonan
d9681076c1
json: read_fast(): added optional flag
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:57 +02:00
James Yonan
ce7dc7cad4
json::write_atomic: support mtime_ns parameter (nanoseconds-since-epoch)
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:56 +02:00
James Yonan
558cd3770a
json::write_atomic(): fixed bug where method was not writing actual JSON content
Signed-off-by: James Yonan <james@openvpn.net>
2020-02-05 20:08:56 +02:00