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

67 Commits

Author SHA1 Message Date
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
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
efe7f6d620
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:32 +02:00
James Yonan
bfadf92762
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:32 +02:00
James Yonan
fd949d96a3
copyright : updated to 2016 2020-01-09 12:23:31 +02:00
James Yonan
706574a59f
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-09 12:23:31 +02:00
James Yonan
edcc119b85
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-09 12:23:31 +02:00
James Yonan
5bb9515515
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:31 +02:00
James Yonan
0d4b64139c
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:30 +02:00
James Yonan
61c99b5f6d
copyright : updated to 2016 2020-01-09 12:23:30 +02:00
James Yonan
25085c9073
Windows: refactored NamedPipePeerInfoClient/Server to use a common base class that includes most of the implementation. 2020-01-09 12:23:30 +02:00
James Yonan
397d44fccc
Windows: In NamedPipePeerInfo::get_process() and allow_client_query(), allow/request SYNCHRONIZE access so that we can wait for process termination by waiting on the process HANDLE. 2020-01-09 12:23:30 +02:00
James Yonan
7bba5cec30
Added openvpn/win/handlecomm.hpp, containing classes for communicating Windows HANDLEs across process boundaries. 2020-01-09 12:23:29 +02:00
James Yonan
b8f3d013aa
In Windows npinfo.hpp, added:
1. NamedPipeImpersonate : RAII class for scoping
                          ImpersonateNamedPipeClient/RevertToSelf.

2. send_handle() : duplicate a handle prior to sending
                   to a remote process.

Added #ifdefs to support both XP/Win2003 and Vista+.
2020-01-09 12:23:29 +02:00
James Yonan
c1a793b27f
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-09 12:23:29 +02:00
James Yonan
22061c8135
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-09 12:23:29 +02:00
James Yonan
c81b4ac4ff
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:28 +02:00
James Yonan
a518f007c2
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:28 +02:00
James Yonan
ad1bf8ee8d
copyright : updated to 2016 2020-01-09 12:23:28 +02:00
James Yonan
70866a59dd
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-09 12:23:28 +02:00
James Yonan
2a21d63486
copyright: updated to 2017
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:27 +02:00
James Yonan
4793912e3f
license : this branch (common) is proprietary, so remove all GPL headers.
Signed-off-by: James Yonan <james@openvpn.net>
2020-01-09 12:23:27 +02:00
James Yonan
bc9b4390c3
copyright : updated to 2016 2020-01-09 12:23:27 +02:00
James Yonan
2e8946b093
Added openvpn/win/handlecomm.hpp, containing classes for communicating Windows HANDLEs across process boundaries. 2020-01-09 12:23:27 +02:00
Lev Stipakov
a6151cdeab wintun: use auto-reset events
Wintun documentation clearly states that we must use auto-reset events in ring buffers.
Auto-reset sets event back to non-signalled state after calling WaitForSingleObject.
Without auto-reset and explicit ResetEvent call we got a busy loop.

To avoid confusion move event.hpp from common/ to win/, since it is
Windows-specific code.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-05 13:45:41 +03:00
Lev Stipakov
48f2b5100b wintun: support for privilege separation
This allows to run openvpn under normal user account,
in which case ring buffers registration is performed
by a separate privileged process.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 19:09:11 +03:00
Antonio Quartulli
47046cf6d2
Merge branch 'qa' 2019-07-19 14:39:43 +02:00
Lev Stipakov
5485de19a2 win/impersonate: refactor impersonate logic
Extend existing Impersonate class and move there
impersonate_as_system code from tunwin.hpp

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-06-20 10:34:38 +03:00
Lev Stipakov
980ef1eff8 win/call.hpp: re-encode command output to utf8
Command output can be in any encoding, for example cp866
in Russian edition of Windows and cp850 in English one.

This ensures that output is always utf8 encoded.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-06 17:10:12 +03:00
Lev Stipakov
fddb440e99 unicode.hpp: customize utf16 conversion routine
Enable to use other than utf8 encoding for incoming string.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-05-03 15:02:28 +03:00
Lev Stipakov
4d7c12ac4d [OVPN3-405] Support for non-ASCII profile path on Windows
This uses Windows-specific wchar_t override of std::ifstream
to make it work with UNICODE paths. It is assumed that caller
passes UTF8-encoded string.

To support passing non-ASCII chars via command line, we
read it as wstring and then convert to UTF-8 encoded string.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-04-30 17:45:01 +03:00
Lev Stipakov
5a4a875520 cosmetics: helper function to check registry errors
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-08-31 17:56:17 +03:00
Lev Stipakov
fc52fd8a58 [OC-78] proxy: support PROXY_AUTO_CONFIG_URL on Windows
Set proxy settings in registry:

HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings

If process is running under SYSTEM account, we impersonate to
logged-in user to access HKEY_CURRENT_USER.

After modifying proxy setting we need to tell Windows to refresh those,
we do it if process is running under user account. Unfortunately WinInet API
we use is not available for services, even with impersonation, so
user application should take care of refreshing settings.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-08-31 17:56:16 +03: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
Lev Stipakov
d7f8c47a2e nrpt: create separate policy per dns suffix
Contrary to what documentation says, on Windows 10 only first DNS suffix is respected.

OVPN3-133

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:39 +08:00
James Yonan
691a641a43 Added i/o abstraction layer.
Created a lightweight abstraction layer so that another i/o
reactor can be dropped in place of asio.

The basic approach is to rename all references to asio::xxx
types to openvpn_io::xxx and then make openvpn_io a
preprocessor variable that points to the top-level namespace
of the i/o reactor implementation.

All of the source files that currently include <asio.hpp> now
include <openvpn/io/io.hpp> instead:

This gives us a lightweight abstraction layer that allows us
to define openvpn_io to be something other than asio.

Other changes:

* Inclusion of asio by scripts/build is now optional, and is
  enabled by passing ASIO=1 or ASIO_DIR=<dir>.

* Refactored openvpn/common/socktypes.hpp to no longer
  require asio.

* Refactored openvpn/log/logthread.hpp to no longer require
  asio.

* Added openvpn::get_hostname() method as alternative to
  calling asio directly.

* openvpn/openssl/util/init.hpp will now #error
  if USE_ASIO is undefined.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-30 15:48:14 -06: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
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
1ed095c719 Minor Win edit: forgot to add leading "::" before
::wcslen() call in openvpn/win/unicode.hpp.
2016-02-24 23:42:17 -07:00
James Yonan
6b79923ccf Win client: Modifed WFP rules to be more aggressive in
preventing DNS leakage.

  Filter #1 -- permit IPv4 DNS requests from OpenVPN app
  Filter #2 -- permit IPv6 DNS requests from OpenVPN app
  Filter #3 -- block IPv4 DNS requests from other apps
  Filter #4 -- block IPv6 DNS requests from other apps
  Filter #5 -- allow IPv4 traffic from TAP
  Filter #6 -- allow IPv6 traffic from TAP

This change has the unfortunate side-effect of causing
lags in DNS resolution, so for now the capability is
disabled in tunsetup.hpp, pending evaluation of
NRPT-based approaches.
2016-02-24 12:14:44 -07:00
James Yonan
eb2141c648 Removed JsonCpp support from some Action-derived classes. 2015-11-10 23:18:27 -07:00
James Yonan
98143f7ec5 In Windows class ScopedHANDLE, added a reset() method (without
arguments) that acts the same as close().
2015-11-10 23:14:13 -07:00
James Yonan
2f40c52fbc 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.
2015-11-09 14:56:08 -07:00
James Yonan
eb9ac6eb83 Added regex verification of WinCmd command strings.
Includes new source file openvpn/addr/regex.hpp
containing validating regular expressions for
IPv4/v6.
2015-11-01 15:11:36 -07:00
James Yonan
9fac4c0770 win/call.hpp mostly stylistic cleanup:
* Prefix Windows API calls with "::"
* Fix comment alignment
2015-11-01 15:03:05 -07:00