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

2913 Commits

Author SHA1 Message Date
Lev Stipakov
1976c639c1
cmake: add Windows agent build
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-02-03 11:38:17 +02:00
Lev Stipakov
10127e2bdd
Add GPL headers
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-31 10:24:38 +02:00
James Yonan
5ce471e651
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:38 +02:00
James Yonan
5ec273f76c
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:37 +02:00
James Yonan
972d10204d
copyright : updated to 2016 2020-01-31 10:24:37 +02:00
James Yonan
6b6c0f2038
Refactored openvpn/win/logfile.hpp, moving core methods create_file() and log() into a new file logutil.hpp for use by OMI logger. 2020-01-31 10:24:37 +02:00
James Yonan
7be71b2064
Added Windows utility classes and methods:
Win::Service -- A Windows Service wrapper.

Win::LogFile -- a LogBase derivative that allows logging
                to a natively created and handled file.

Win::module_name() -- Get the module name as a
                      std::wstring.

Win::module_name_utf8() -- Get the module name as a UTF-8
                           string.
2020-01-31 10:24:37 +02:00
Lev Stipakov
72d80fc960
agent win: add missing quoting for service path
This fixes https://nvd.nist.gov/vuln/detail/CVE-2014-5455

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-31 10:24:36 +02:00
James Yonan
4346762a0d
Log lines from C++ exceptions should contain the text "exception"
This makes it easier to scan log files for exceptions.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:36 +02:00
James Yonan
5734e99bdb
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:36 +02:00
James Yonan
06cbc850dc
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:36 +02:00
James Yonan
3ff97e4031
copyright : updated to 2016 2020-01-31 10:24:35 +02:00
James Yonan
549634e6c5
Moved pack_string_vector() from winsvc.hpp to core, where it's now called wstring::pack_string_vector(). 2020-01-31 10:24:35 +02:00
James Yonan
7d1eb28016
ovpnagent -- enable service autostart and also added automatic restart-on-fail. 2020-01-31 10:24:35 +02:00
James Yonan
2efdf8a745
Change to calls of Windows API methods:
* Where unicode/ansi versions of a method exist, always
  explicitly call one of unicode or ansi methods by
  appending a 'W' or 'A' to the end of the method name.
  Never omit the 'W' or 'A' because that will cause the
  default method to be used which may vary according to
  build flags.

* Prepend all Windows API method references with "::" to
  indicate that the method names should be resolved from
  the top-level namespace.
2020-01-31 10:24:34 +02:00
James Yonan
c0ecc864cd
Added Windows utility classes and methods:
Win::Service -- A Windows Service wrapper.

Win::LogFile -- a LogBase derivative that allows logging
                to a natively created and handled file.

Win::module_name() -- Get the module name as a
                      std::wstring.

Win::module_name_utf8() -- Get the module name as a UTF-8
                           string.
2020-01-31 10:24:34 +02:00
Antonio Quartulli
c2a87bbc83
listener: create generic ProxyListener abstract class
This class can be used by pgproxy to operate on listeners
no matter their actual implementation.

This way pgproxy can support different listeners at the
same time.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-01-31 10:24:34 +02:00
James Yonan
9524b1496b
WS::Server, Acceptor::TCP: added bind/close logging when OPENVPN_DEBUG_ACCEPT is defined
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:34 +02:00
James Yonan
78cd98a1c8
WS::Server: log accepts when OPENVPN_DEBUG_ACCEPT is defined
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:33 +02:00
James Yonan
8bffbe6acf
Implement TCP shutdown at the HTTP layer
This patch tries to gracefully shutdown a socket before
closing it, in non-error, non-stop situations.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:33 +02:00
James Yonan
b91d7e39ba
Acceptor::TCP: don't set reuseport flag by default on listener socket
Previously, all listener sockets were configured with both
reuseaddr and reuseport.  reuseaddr is reasonable to use as
a default, but reuseport should only be used when different
threads are listening on the same local port/address for
load-balancing purposes.

This patch adds two new socket option flags DISABLE_REUSE_ADDR
and REUSE_PORT, to provide finer-grained control over
these options.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:33 +02:00
James Yonan
94581ff22e
Replace AsioTimer with AsioTimerSafe in cases where handler doesn't clearly check for late cancellation
As noted in the Asio documentation, an AsioTimer handler can be
called with a non-error status after timer cancellation.

Unfortunately, this can lead to race conditions, so I'm moving over
all AsioTimer users to AsioTimerSafe when I don't see the handler
clearly checking for late cancellation.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:32 +02:00
James Yonan
be171b5367
WS::Server::Listener: added walk() method
The walk() method calls a caller-defined function on all
of the active client instance objects bound to the listener.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:32 +02:00
Antonio Quartulli
1aedadbc6d
httpserv::client: add and invoke tcp_intercept() before consuming buffer
Child classes may want to operate on a received buffer, before it is
passed down the stack. This can be useful when the Proxy Protocol
parser wants to parse and wipe its header.

Make it a virtual method so that it can be overridden by child classes
where higher level logic are implemented.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-01-31 10:24:32 +02:00
James Yonan
6a48b166b2
Make lambda functions mutable that benefit from using std::move() on closure vars
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:32 +02:00
Antonio Quartulli
297a12226c
listener: create generic ProxyListener abstract class
This class can be used by pgproxy to operate on listeners
no matter their actual implementation.

This way pgproxy can support different listeners at the
same time.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-01-31 10:24:31 +02:00
Antonio Quartulli
b6ececadf3
ws/httpserv: LinkCommon is now in charge of calling tcp_* handlers
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2020-01-31 10:24:31 +02:00
James Yonan
ee5fe53607
HTTP server: implement throttling
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:31 +02:00
James Yonan
4f91530f2f
HTTP: added Alt Routing support to HTTP client/server
Alt Routing allows services on meshed PG nodes to communicate
with services on other nodes via the secure mesh, and without
requiring SSL.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:30 +02:00
James Yonan
daa98d1e45
WS::Server changes:
* Cancel general timeouts for websockets

* CoarseTimer must always be reset when its associated
  AsioTimer is cancelled.

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:30 +02:00
James Yonan
fc19e73bcd
WS::Server: use C++11 member initializers
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:30 +02:00
James Yonan
fddf4c534b
HTTP layer: added Websocket support
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:30 +02:00
James Yonan
179d00e15b
Added i/o abstraction layer.
Created a lightweight abstraction layer so that another i/o
reactor can be dropped in place of asio.

This commit includes:

* Added ASIO=1 to many "go" scripts that require asio
* Renamed "asio::" to "openvpn_io::".

Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:29 +02:00
James Yonan
979c831466
Moved asio files from openvpn/common to openvpn/asio
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:29 +02:00
James Yonan
50fba999f6
Moved openvpn::to_string() to separate source file.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:29 +02:00
James Yonan
1bea8dace5
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:28 +02:00
James Yonan
7dedd61bfa
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-31 10:24:28 +02:00
James Yonan
2ac9e18a34
copyright : updated to 2016 2020-01-31 10:24:28 +02:00
James Yonan
f09a0c4402
HTTP server : struct Factory now inherits from OPENVPN_HTTP_SERV_RC instead of being hardcoded to RC<thread_unsafe_refcount>. 2020-01-31 10:24:27 +02:00
James Yonan
9649eb83f2
In HTTP client and server, enable TCP_NODELAY on socket. 2020-01-31 10:24:27 +02:00
James Yonan
cbc9a2ec6a
In WS::Server::Config, remove the constructor and use C++11 member initializers. 2020-01-31 10:24:27 +02:00
James Yonan
d03dd13f1e
In WS::Server::Listener::Client, added new virtual method http_pipeline_peek() to allow HTTP servers to observe and possibly modify/delete incoming out-of-context raw socket data before the data is written to the out-of-context pipeline (where it would be later processed by SSL and/or HTTP layers). 2020-01-31 10:24:26 +02:00
James Yonan
323db959d9
Added unix_fd() method to WS::Server::Listener::Client to allow derived classes to obtain the raw unix domain socket. 2020-01-31 10:24:25 +02:00
James Yonan
7185e45ff0
Minor change to httpserv.hpp -- Bracket unix domain socket code with #ifdef ASIO_HAS_LOCAL_SOCKETS instead of #if !defined(OPENVPN_PLATFORM_WIN) 2020-01-31 10:24:25 +02:00
James Yonan
0b2865cac4
In httpserv.hpp, added WS::Server::Listener::Client::get_parent() method. 2020-01-31 10:24:25 +02:00
James Yonan
ab6c29cfbc
Factored out HTTP Server acceptor classes into openvpn/acceptor. 2020-01-31 10:24:25 +02:00
James Yonan
a6ddc344fa
In HTTP server (httpserv.hpp), allow users to specify the Windows SDDL string used to set the permissions on created named pipes.
Also, refactor some Windows-specific code into secattr.hpp
(SECURITY_ATTRIBUTES stuff) and npinfo.hpp (getting info
about named pipe peer).
2020-01-31 10:24:24 +02:00
James Yonan
257ba661a0
For Windows named pipe implementation in httpserv.hpp, removed PIPE_WAIT flag from CreateNamedPipeA call, as it seems incompatible with FILE_FLAG_OVERLAPPED. 2020-01-31 10:24:24 +02:00
James Yonan
7f10bd7fae
Added Windows named pipe support to HTTP client/server library. 2020-01-31 10:24:24 +02:00
James Yonan
7723bcba40
Ported httpserv.hpp to Windows, mostly by removing Unix-only constructs for the Windows build such as unix domain socket support. 2020-01-31 10:24:23 +02:00