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

31 Commits

Author SHA1 Message Date
Heiko Hund
32a32cf04c
add support for dco-win to agent service
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:44:50 +02:00
Heiko Hund
dbd05f2562
add TunWin::Type enum for the used driver type
This is in preparation for supporting more than two
TAP driver types on Windows.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2021-04-14 22:44:48 +02:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +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
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
Lev Stipakov
48444e5513
agent win: implement add_bypass_route
Add /add-bypass-route method, which is called
by socket_protect() call in client before opening
connection to remote.

This is needed to do reconnect to another remote
in case when force-tunneling is used and existing
VPN tunnel is broken.

OVPN3-427

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:05 +02:00
Lev Stipakov
215c6a0976
win/agent: change event.hpp include path
event.hpp was moved in core from common/ to win/

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:05 +02:00
Lev Stipakov
2d5f056b65
openvpn/win/event.hpp: move to openvpn3 repo
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:04 +02:00
Lev Stipakov
bce60fe08b
ovpnagent/win: support for Wintun ring buffers registration
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:04 +02:00
Lev Stipakov
15a4499a9d
agent: Wintun support for agent
This enables agent to use Wintun instead of tap-windows6
as a tun driver. We pass an optional boolean flag, based on
config setting, from client to agent. That flag is then passed
by agent to TunSetup, which selects tun driver.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:04 +02:00
Lev Stipakov
74a51815b0
win agent: properly handle timeout
Sometimes when machine wakes from sleep,
it takes too long for agent service to start. This causes
an error which core treats as fatal and stops connection.

Fix by detecting timeout and throw non-fatal error, which
makes core reconnect.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:04 +02:00
Lev Stipakov
ba99bd928c
cmdagent.hpp: Add missing io_context
Adapt to latest core changes.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:03 +02:00
James Yonan
2d78ccb803
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-09 12:23:03 +02:00
James Yonan
8604a87e43
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:03 +02:00
James Yonan
068cf36233
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:03 +02:00
James Yonan
cdf5d6c0b4
copyright : updated to 2016 2020-01-09 12:23:02 +02:00
James Yonan
d8610e5e8f
windows cmdagent : updated with new layer 2 virtual methods (none of the methods are current implemented). 2020-01-09 12:23:02 +02:00
James Yonan
78557c54f3
In Windows cmdagent/ovpnagent, make the client exe path available to establish_tun() method. 2020-01-09 12:23:02 +02:00
James Yonan
ebc1292da8
Additional robustness fixes for Windows agent/service:
* When transmitting Windows event objects from client app to
  agent/service, duplicate the event HANDLEs before
  transmission in case the original HANDLEs are closed before
  the agent receives them.  This has a minor disadvantage in
  that the duplicated HANDLEs will leak if the agent/service
  never establishes ownership over them.

* When agent/service receives event HANDLEs, since they have
  already been duplicated in the context of the remote
  process, move (instead of copy) the HANDLEs into the local
  process context by using the DUPLICATE_CLOSE_SOURCE flag
  to DuplicateHandle.

* When agent/service receives event HANDLEs, do some basic
  sanity checks on them before calling async_wait.

* Split agent/service impersonation block into two sections,
  one that can be executed before parent()->establish_tun()
  and one after.  This is done so that any exceptions
  thrown by the pre-establish_tun() block can prevent the
  expensive establish_tun() method from starting.

* In agent/service, call parent()->destroy_tun(os) if any
  exceptions are thrown from http_request_received().
2020-01-09 12:23:02 +02:00
James Yonan
c3e8b60b89
Windows agent/service changes for better robustness:
* Avoid TAP HANDLE leakage on named pipe comm link errors
  when the agent has duplicated the HANDLE but before the
  app has received it by using a Windows Event object
  ("confirm_event") that the agent client can use to assert
  ownership over the HANDLE.  If confirm_event never
  signals, the agent will take responsibility for closing
  the duplicated HANDLE.

* Trigger tun destroy through a Windows Event
  ("destroy_event") instead of a separate API method
  ("/tun-destroy") for better robustness since the Event
  can easily be signaled by the app-side tuncli instance
  destructor without any potential for exceptions.

* Agent client will now detect unexpected agent/service
  process termination and immediately disconnect any
  active session via this error:

    self->parent.tun_error(Error::TUN_IFACE_DISABLED,
                           "service failure");

* /tun-setup API method will now explicitly close any
  pre-existing tun instance before establishing a new
  instance.

* Increased agent client API timeout from 10 to 30 seconds.

* Increased verbosity of agent/service logging in
  agent.log.
2020-01-09 12:23:01 +02:00
James Yonan
c731d2395d
For jsoncpp usage, rename deprecated misspelled method name:
getFormatedErrorMessages -> getFormattedErrorMessages
2020-01-09 12:23:01 +02:00
James Yonan
447868cf44
Implemented Stop support for Windows cmdagent.hpp (via TunWin::SetupBase interface).
Also updated Windows ovpnagent.cpp with Stop hooks
but without implementation.
2020-01-09 12:23:01 +02:00
James Yonan
920ca44c29
In Windows cmdagent.hpp, when parsing returned TAP handle, catch the error case where service is 64 bits and client is 32 bits. 2020-01-09 12:23:01 +02:00
James Yonan
7943a1007b
Windows OpenVPN agent : refactored internal named-pipe API (between non-privileged client and privileged service) to be based on TunBuilderCapture instead of ActionList:
* TAP interface is now opened from the service and
  the TAP HANDLE is communicated back to the client.
  This allows us to configure the TAP driver to
  reject open requests from non-privileged users.

* Old ActionList approach required us to validate and
  execute command lines sent from client to service.
  The new API approach is higher-level and communicates
  at the TunBuilderCapture level instead of using
  lists of command lines (ActionList objects) that must
  be sanity-checked.

* ovpnagent service can now detect client crashes and
  close out an active tun session, preventing network
  lockout.
2020-01-09 12:23:00 +02:00
James Yonan
7f7873d81d
Windows client: added privilege separation layer, including:
1. OpenVPN Agent service -- ovpnagent/win/ovpnagent.cpp
2. OpenVPN agent client -- openvpn/client/win/cmdagent.hpp

Common configuration in openvpn/client/win/agentconfig.hpp

The client and service communicate over a named pipe, and
Windows Vista+ platforms will verify that both client and
server .exe files are running from the same directory.

Build OpenVPN 3 Windows client with OPENVPN_COMMAND_AGENT
to enable the privilege separation layer.
2020-01-09 12:23:00 +02:00
Lev Stipakov
de5662221c
ovpnagent/win: add Visual Studio project files
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2020-01-09 12:23:00 +02:00
Yuriy Barnovych
586e8cc8a8
ovpnagent: Enable pipe name build-time customization
We need to support customization of pipe name in case when few
clients based on ovpnagent running at the same time. Name of
pipe is defined by build-time variable “OVPNAGENT_NAME” (we
already use it as name of Windows service).

Signed-off-by: Yuriy Barnovych <yuriy@openvpn.net>
Jira: UCONNECT-1151
2020-01-09 12:23:00 +02:00
James Yonan
a2962be74e
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:22:59 +02:00
James Yonan
1d974645b4
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:22:59 +02:00
James Yonan
3fd389586b
copyright : updated to 2016 2020-01-09 12:22:59 +02:00
James Yonan
08f8563be5
Windows client: added privilege separation layer, including:
1. OpenVPN Agent service -- ovpnagent/win/ovpnagent.cpp
2. OpenVPN agent client -- openvpn/client/win/cmdagent.hpp

Common configuration in openvpn/client/win/agentconfig.hpp

The client and service communicate over a named pipe, and
Windows Vista+ platforms will verify that both client and
server .exe files are running from the same directory.

Build OpenVPN 3 Windows client with OPENVPN_COMMAND_AGENT
to enable the privilege separation layer.
2020-01-09 12:22:59 +02:00