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

2753 Commits

Author SHA1 Message Date
Lev Stipakov
1a7cb2b694
cmake: Don't use "Wno-unused-private-field" for msvc
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-30 10:31:14 +02:00
Lev Stipakov
0c16068dc7 appveyor: update Windows build
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-29 23:24:56 +01:00
Lev Stipakov
8ab6a7d954 README: update Windows build instructions
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-29 23:24:56 +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
c53c42dc9c Simplify HMAC initialised logic to check just ctx != nullptr
Before the OpenSSL 1.1 conversion, we used HMAC_CTX as a field and the
variable initalised to signal if it is initialised. Since it
got converted to a pointer with OpenSSL 1.1 we can remove the
initialised variable just check if ctx != nullptr if it is initialised.

HMAC_CTX_free is (like free()) also allowed on a nullptr.

This also fixes a ctx might not be initialised warning on Fedora 31

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
Arne Schwabe
fd6e76ea28 Avoid maybe unintialized warning in IP::Addr
Since the memory layout of the IPAddr class has the field ver behind
the union of u.v4 and u.v6, the whole u is always guaranteed to be
valid and can be copied. This avoid the compiler warning that
u.v6[1] might be undefined.

Also initialise the union u by default.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
Arne Schwabe
4c089df991 Add cmake build file for proto
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
Arne Schwabe
86008fd2ee Remove dependency on std::regex from getSortedString
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
Arne Schwabe
6035e3afed Replace std::regex with non regex for HTTP redact
std::regex fails with CentOS7 and RHEL7.
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
James Yonan
f250c4c921 WS::ClientSet: silently ignore when Asio is missing the results.randomize() method
If HTTPCLI_RANDOMIZE_RESULTS_REQUIRED is defined, cause a compile-time
error if Asio is not compiled with results.randomize() method.

If HTTPCLI_RANDOMIZE_RESULTS_REQUIRED is NOT defined, opportunistically
compile results.randomize() usage only if available in Asio.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-29 09:27:46 -07:00
Arne Schwabe
53d22aca99
Remove unneed windows/console.hpp include
This breaks build on non Windows platforms

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-16 15:34:59 +01:00
Arne Schwabe
9c50badeb4
Fix integer comparison problems introduced by the merge of released
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-16 15:34:32 +01:00
Lev Stipakov
629ee45260
win: make OpenSSL configuration default
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-16 14:17:43 +01:00
Lev Stipakov
3a5cf08289
win: support for arm64 and openssl 1.1.1
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-16 14:17:43 +01:00
David Sommerseth
60fa4bf29e
Merge changes applied to coming Core release 2020-01-16 13:30:49 +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
f805c05848
tun mac: implement add_bypass_route() method
This method generates /sbin/route commands which
create and delete bypass route for given host.

It is needed 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:27 +01:00
Arne Schwabe
70923f41df
Silence used return value warning of BIO_flush 2020-01-15 23:08:32 +01:00
Arne Schwabe
c8fb3f112d
use std::enable_if with sizeof(T) instead if(sizeof(T))
This silences a compiler warning about error=shift-count-overflow
2020-01-15 23:08:31 +01:00
Arne Schwabe
984c601090
Fix multiple instances of comparison of signed with unsigned 2020-01-15 23:08:30 +01:00
Arne Schwabe
9566cab3ec
Fix compilation without ASIO when using OpenSSL
Our OpenSSL init code depends on calling the OpenSSL init code
from ASIO. Fortunately that init code is no longer needed with
OpenSSL 1.1.0+, so remove the call and dependency when we are
using OpenSSL 1.1.0+

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-15 23:08:30 +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
6dc5d5ddf0
Fix various warnings reported by -Wall/clang
- missing override annotations
- wrong order of init in constructor
- delete on a pointer to a virtual class without virtual destructor
2020-01-15 23:08:28 +01:00
Lev Stipakov
394b5b2258
omi: add password protection
Implemented as in openvpn2.

If --management option includes "stdin",
client immediately prompts for password.

When there is incoming OMI connection, client
prompts for password and, if it doesn't match
the one entered via stdin, closes OMI connection.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-10 12:30:15 +02:00
Lev Stipakov
0668d9132b
omi: support for exit event
Allows to pass event name which, when signalled,
causes client to exit.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-10 11:17:04 +02:00
Lev Stipakov
ffc000a38b
omi: add vs project files
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-10 11:17:04 +02:00
Lev Stipakov
a4d9989d81
Update license on files moved from common
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:24:20 +02:00
James Yonan
50196ed5fa
JsonClient/AppServer: full HTTP compression support
* gzip or lz4 supported for standard HTTP.

* lz4 support for websocket.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:20 +02:00
James Yonan
7297015895
websocket: make Sender::frame() const
Sender::frame() was already const-ready, it just didn't
have the const attribute specified.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:20 +02:00
James Yonan
6055aaf34c
HTTP layer: added Websocket support
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:19 +02:00
James Yonan
14379360c1
WS::Creds::load_from_header(): use the simpler string::split() rather than Split::by_char()
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:19 +02:00
James Yonan
c8b4fe322e
WS::Creds: use atomic_thread_fence(std::memory_order_acq_rel) instead of OPENVPN_COMPILER_FENCE
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:19 +02:00
James Yonan
95f1654921
WS::Creds: use crypto::str_neq() when comparing credentials against expected values
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:19 +02:00
James Yonan
0ac1999cd0
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:18 +02:00
James Yonan
d3751a65c2
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:18 +02:00
James Yonan
4dc149ffd9
copyright : updated to 2016 2020-01-09 12:24:18 +02:00
James Yonan
4ebd66bfbb
httpcreds : redefined WS::Creds::load_from_options() to pass through the UserPass flags value. 2020-01-09 12:24:18 +02:00
James Yonan
c86fd2a5de
Added write_private() methods from core (no Windows implementation yet).
In httpcreds.hpp, use write_private() for creating creds
files rather than UMask.
2020-01-09 12:24:17 +02:00
James Yonan
3b20b9bf6a
Fix to httpcreds.hpp for Windows: #ifdef out umask functionality. 2020-01-09 12:24:17 +02:00
James Yonan
94419fd21c
Update httpcreds.hpp with SplitLines change where S_OK was renamed to S_OKAY due to Windows symbol conflict. 2020-01-09 12:24:17 +02:00
James Yonan
8ca935bcd4
In httpcreds.hpp, added WS::Creds::load_from_options() method. 2020-01-09 12:24:17 +02:00
James Yonan
5965e046ed
Added AGPL license header to HTTP, Java, and common code. 2020-01-09 12:24:16 +02:00
James Yonan
75acd76f40
HTTP client/server changes:
* HTTP client and server now support unix domain sockets
  via AsioPolySock abstraction.

* HTTP server now supports Basic auth credentials.

* HTTP server now supports peercred authentication
  over unix domain sockets.

* HTTP server now supports file creation permission
  bits on unix domain socket.

* Added udstest tool to test HTTP client over unix domain
  sockets.
2020-01-09 12:24:16 +02:00
Arne Schwabe
99dbc6848b
Fix adding int to a string
Compiler warning:

openvpn/ws/httpcommon.hpp:157:135: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
2020-01-09 12:24:16 +02:00
James Yonan
f1546d6b8b
WS::HTTPBase: added more detail to http_content_out_finish() exception on unexpected state
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:16 +02:00
James Yonan
7b6d4cf6cb
AppServer, WS::HTTPBase: added support for ssl_did_full_handshake() method added to SSL layer
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:15 +02:00
James Yonan
73f8525f9e
Implemented TLS session ticket support in the HTTP layers.
Added support for PGDB server and clients, and the chat test.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:15 +02:00
James Yonan
9e7470c37d
AppServer, WS::HTTPBase: change update_max_content_bytes() to reduce_max_content_bytes()
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:15 +02:00
James Yonan
77f7e06786
Change to commit "httpcommon: fixed race that can occur on high-speed persistent connections"
The original commit has some unintended side effects
that break server-side code.

This commit tries a different approach: do an early
return from http_in() when buffer size is zero.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:15 +02:00
James Yonan
8e6e8e759d
httpcommon: fixed race that can occur on high-speed persistent connections
I observed a case where http_in() (running as a client) called
parent().base_http_done_handler() twice for the same transaction!
Normally the 'ready' var blocks this sort of behavior, but with
a high-speed persistent session, the 'ready' var can transition
so quickly as to create a window for a double-done race.

The fix is to use a more robust filter against unsolicited input
after base_http_done_handler() is called by setting rr_status to
REQUEST_REPLY::Parser::undefined.  This value is never matched
in httpcommon, so it effectively turns http_in() into a no-op when
set.

There is also the question of whether unsolicited input should
be considered a fatal error on a persistent session.  It probably
should, but this fix focuses on a corner case where http_in()
is called with a zero-length buffer, presumably from the SSL/TLS
layer.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:24:14 +02:00