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

4154 Commits

Author SHA1 Message Date
Arne Schwabe
3fe0138d9e Use std::chrono::milliseconds instead of raw integer in client connect logic
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-22 12:42:46 +00:00
Arne Schwabe
fe91436cc4 Trigger events on common TLS alerts
OpenVPN 2.7/master will no longer suppress TLS Alerts but send them
out to the client. Create event for the common events that occur and
notify them to the UI process.

Jira: OVPN-1215
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-22 12:42:46 +00:00
Arne Schwabe
ae3f94a1f5 Refactor client_proto_terminate to avoid code duplication
Also move auth fail logic into own method.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-22 12:42:46 +00:00
Arne Schwabe
b8f7761e66 Correctly set the debug level for ssl alert logging
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-22 12:42:46 +00:00
David Sommerseth
d57522dc9c OpenVPN 3 Core library version 3.10
Noticable changes:
 
 * CVE-2024-5594: control channel: refuse control channel messages with
   nonprintable characters in them
 * Bugfix (macOS): Fixed dropped direct route to VPN server on reconnect
 * Bugfix: Fix incorrect handling of ClientOptions::Config::disableClientCert boolean flag
 * Bugfix: Fix incorrect RandomAPI API usage in aws/awsroute
 * Improvement: Avoid LOG_DEBUG/LOG_INFO macro conflicts with syslog.h
 * Feature: Expose the VPN profile CA certificate via the EvalConfig class
 * Feature: Initial support for custom appcontrol channel
 * Feature: Initial support for certificate checks via appcontrol channel
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEgDq5E1p1aZrNLFFkhs+UTJZx/fIFAma+GWATHGRhdmlkc0Bv
 cGVudnBuLm5ldAAKCRCGz5RMlnH98gV3EACLQS3EMhbCzgm0juwtlK3xsJp35eF0
 7FUoLrqvJ4piirkX35lwFffYHZ3VWlzE+zpreYj8oKbHqJKB3TN1iCg2fEFqWVT+
 Xp7TrX8DV2jN+/Z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M1QgwKsxXuP7XOcBjKPUMUSguqH
 D82GSYVdivvAOosxjKuKYe7S3krIKzQ3fPLrRZjqPQR2jNXsSzawhyw1FvV59plK
 LLwfrhaZ+rzac2gvqn/eyUTxuobmFjIB5kdxBsMk5RVMI7np1yDNcEsBJWKeFRt5
 MzOSg7WTfRlTnCTC329J8HvBi4joQsA1/WbgGOOSHDB12kr/Epu6qT1Nm4yKbgxV
 4dqwFZABZ6nA+jxTFWXPmRWXFU+Kueue/Hha7usl4vWkeNcR1e2lxLXcEGhqpnRT
 39KOHqwqcw8pBxiGM4yirRz28VARzWQHaYWxN54xb0fY0WdqvUjQOjDL0biY12TY
 HcuuYGM3N8pobA==
 =a4sj
 -----END PGP SIGNATURE-----

Merge OpenVPN 3 Core library version 3.10 to master
2024-08-19 22:24:02 +02:00
Arne Schwabe
ca91f3e91c Implement data v3 features for AEAD tag at the end and 64 bit packet counter
Split the implementation of the packet counter for normal packet ID
that includes the "weird" long format for long 64 bit packet ids used
in tls-auth and tls-crypt and a simplified implementation for AEAD that
only does 32 bit and 64 bit flat counters.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-19 12:18:49 +00:00
Arne Schwabe
a384f16b32 Refactor data channel setting to CryptoDCSettingsData class
Instead of passing around a number of individual argument, use a data
holder class to describe all the settings. This will also allow adding
more data channel parameters in the future (tag location, 64 bit IV)
easier.  This has a slight cost of something passing more parameters
than needed.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-19 12:18:49 +00:00
Arne Schwabe
d52d98c7ec Assume AEAD tag at the end of input if not given seperately
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-08-19 12:18:49 +00:00
Razvan Cojocaru
880ebb081a server: Add new to_string_debug() pure virtual member to SendBase
This is part of a series of patches instrumenting crash checks.
Classes that implement SendBase can optionally collect debug
information for various scenarios, and create a string here that
presents them in human-readable form when requested.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-19 10:57:32 +00:00
James Yonan
2b0960452d ServerProto: don't generate new management or tun instances after stop() has been called
This change is intended to safeguard against potential
post-stop() management activity that could result in
management agent getting into a bad state.

Signed-off-by: James Yonan <james@openvpn.net>
2024-08-17 12:53:23 -06:00
David Sommerseth
22369c80d6
Release: OpenVPN 3 Core Library, version 3.10
Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-08-15 16:33:01 +02:00
Mark Deric
318d83ae43 Fix fail silently bug in pre-commit hook
Without the change and in the absence of a clang-format command in the
user's PATH, the script will fail in line 79 of the hook due to set
-e.  It will fail to produce the error message starting at line 83.

The change allows the error message to print.

Signed-off-by: Mark Deric <jmark@openvpn.net>
2024-08-13 23:26:06 -07:00
Heiko Hund
3936778c38 virtual d'tors: use '= default' instead of empty body
Signed-off-by: Heiko Hund <heiko@openvpn.net>
2024-08-13 02:05:05 +02:00
Heiko Hund
f5db521aa7 WinSvc: define virtual d'tor
The Windows Service class did not specify its destructor as virtual, but
has other virtual function. Not specifying the d'tor virtual is an
anti-pattern in this case.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2024-08-13 02:01:33 +02:00
Heiko Hund
8c8e96e138 streamline overriding virtual function syntax
In the code base three different syntaxes for overriding virtual member
functions could be found:

  1) virtual ... override
  2) virtual ...
  3) ... override

This converts all of them to the third syntax, as recommended by the ISO
C++ core guidelines in C.128

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2024-08-13 02:01:24 +02:00
James Yonan
e4368fd83e CryptoAlgs: added missing #include <list>
CryptoAlgs uses std::list but did not #include <list>

Signed-off-by: James Yonan <james@openvpn.net>
2024-08-09 10:10:05 +00:00
James Yonan
6132010ea1 ManClientInstance::SendBase: added is_stopped() virtual method
is_stopped() should return true when the instance
is stopped or halted.

Signed-off-by: James Yonan <james@openvpn.net>
2024-08-09 10:10:05 +00:00
RenovateBot
7444bad773 chore(deps): update vcpkg digest to f5398d9 2024-08-08 14:43:15 +00:00
RenovateBot
8aaecdd14a chore(deps): update dependency chriskohlhoff/asio to asio-1-31-0 2024-08-08 14:43:14 +00:00
Razvan Cojocaru
98e0f1f650 logger: De-duplicate Logger::log_{trace, info, ...} logic
Add a single template function implementing the logging logic,
parametrized by log level, and have the log_{trace, info, ...}
functions call that.

While at it, const-ify a couple of member functions.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:14 +00:00
Razvan Cojocaru
bd5685c921 Add -Wnon-virtual-dtor to the UNIX C++ compiler flags
Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:12 +00:00
Razvan Cojocaru
6217fa0e1a Add default virtual destructors to base classes with virtual functions
Without this fix, the openvpn3-linux build is broken whenever a
dependency enables -Wnon-virtual-dtor (which protobuf 27.3
currently does on Arch Linux). The openvpn3-linux build treats
warnings as errors.

Jira: OVPN3-1242
Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:12 +00:00
Lev Stipakov
cbea2d46c2 push update: support for Linux
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

OVPN3-1231

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
0c27550736 push update: support for dco-win
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
6a1a641cf5 push update: support for tap-windows6
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

OVPN3-1000

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
72c11c8232 push update: add IV_PROTO flag
This is needed to indicate to server that
we support PUSH_UPDATE control channel message.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
adacc16cd4 push update: base implementation
This adds support for parsing PUSH_UPDATE
control command, which enables to update
options "on the fly", without reconnect.

The options presented in the PUSH_UPDATE list
overwrite current options with the name. To unset
an option, it has to be prefixed with the "-".

For example:

  PUSH_UPDATE,route 10.10.10.0 255.255.255.0,-dns

Replaces all existing routes with this new one
and removes all "dns" options.

If the client doesn't support updating certain option,
it reconnects. Except when option is prefixed with "?" -
in this case option is considered "optional".

For example, this message

  PUSH_UPDATE,?unsupported_option_a

does nothing, but this one:

  PUSH_UPDATE,dns 0,block-ipv6,unsupported_option_b

makes client reconnect, since it contains mandatory unsupported option.

OVPN3-1234

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
6f9f02ff9e cmake: use multiprocessor build for MSVC
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
fa78d9a8a9 vcpkg.json: add GTest host dependency
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Razvan Cojocaru
961ac5d699 Collapse LOGGER_LOG_{INFO, VERBOSE, DEBUG, TRACE, ERROR} implementation
Reduced the pasted implementations of the LOGGER_LOG_<VERBOSITY>
macros to a single macro with a verbosity parameter, in an attempt
to make the code easier to read by reducing the line count, and
hopefully reduce the probability of copy / paste bugs
(LOGGER_LOG_ERROR() was already checking against LOG_LEVEL_INFO).

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-05 16:51:55 +03:00
RenovateBot
4e643142aa chore(deps): update github actions 2024-08-01 00:00:38 +00:00
Arne Schwabe
5e968be14e Report run-time OpenSSL version instead of compile time version
Returning OPENSSL_VERSION_TEXT will return the value of the library at
compile time. We rather want to know the version of the library that is
actually running, so use OpenSSL_version instead.

Jira: OVPN3-1227
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:32 +00:00
Arne Schwabe
b43851c7a0 Disable swig warnings for ClangCL
Swig under windows add a lot of code that clang does not like, so disable those warning

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:30 +00:00
Arne Schwabe
6f6cedc2a6 Make building with clang-cl under windows -Werror clean
Use empty braces to initalise the structs to zero since they
use sub structs and clang wants us to otherwise use {{ 0 }}

Ensure that methods with a return value do not return without a
value or exception by throwing an exception.

Add missing override in the unit test

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:30 +00:00
Leonard Ossa
b550d6bf7f IP Refactor
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-29 13:40:29 +00:00
Charlie Vigue
0faf0f89de Make runtime range check only happen if needed
In numeric_cast when casting from signed to unsigned, the second part
of the conditional might be const in some cases. This is intended to
ensure the second runtime check is only present if possibly needed.

This is better and avoids a Coverity performance warning

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-07-25 16:39:46 +00:00
Frank Lichtenheld
20260b27f6 CodeCoverage.cmake: Import coverage helper code
From https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake

Jira: OVPN3-1237
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-25 13:43:22 +00:00
Charlie Vigue
4aca9606c6 Change ::value --> _v and ::type --> _t
Also add doxygen and make requested changes from code review

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-07-22 17:36:18 +00:00
Charlie Vigue
18c3dfe103 Respect data encapsulation 2024-07-22 17:36:18 +00:00
Charlie Vigue
6b3db207d2 Move all impl to bottom 2024-07-22 17:36:18 +00:00
Charlie Vigue
8443be9f6d Move BufferType impl into ConstBufferType 2024-07-22 17:36:18 +00:00
Charlie Vigue
28787e03a1 Move all impl from declarations
Move ConstBufferType BufferType BufferAllocatedType member function
implementations out of declaration
2024-07-22 17:36:18 +00:00
RenovateBot
13d6b06e1c chore(deps): update dependency google/googletest to v1.15.0 2024-07-17 10:00:24 +00:00
Frank Lichtenheld
bf6f42dc19 Merge current state of releaseprep/3.10 to master
* origin/releaseprep/3.10:
  Do not reject control message with trailing newlines
  aws: account for RandomAPI change
  Allow disabling TLS 1.3 in certcheck to more easily debug problems
  Implement changes to allow test dpc certcheck to be tested
  Allow setting a maximum TLS version
  Change cxa1 protocol tag to dpc1
  Fix spelling errors raised by Debian linter
  mac agent: reinstall host route during restart
  Preparing QA cycle for OpenVPN 3 Core library release v3.10

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-16 17:19:49 +02:00
Frank Lichtenheld
27ceba227a Release Merge: OpenVPN 3 Core library version 3.9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-16 17:19:23 +02:00
Razvan Cojocaru
f15261b8dd Fix crash if no tls-auth section is present in the config
We are now only initializing TLS-related objects if TLS auth mode
is enabled.

This fixes internal Jira issue PG-122.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-07-12 09:29:27 +00:00
Leonard Ossa
e929058607 Refactor by getting rid of redundant value in loop
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
a8b6cb01fc Refactor iterating to range-based loop in find()
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
c52419411e Refactor enum to enum class in addrspacesplit
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
a00a4c6241 Refactor empty constructor to default
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00