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

4140 Commits

Author SHA1 Message Date
David Sommerseth
149ec03864 OpenVPN 3 Core library version 3.8.5
-----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEgDq5E1p1aZrNLFFkhs+UTJZx/fIFAmYmR6wTHGRhdmlkc0Bv
 cGVudnBuLm5ldAAKCRCGz5RMlnH98rZPD/4vNyAZYSVN5HXO9SdrxCju/8VDxuDj
 0/CuS444NC4RKNLJIlorlLSi1zeL4fjuSRtEkLwB8QzCc3/sxEFFIqVk974zytMi
 ohBlNqISJTSUqugMZg1UfcySJSqHGaQfNfaiywSrQAe7hrCVPrUu+cAcXNsBeBPa
 fDOggL6K/7EVCwvZ5gcGUY0lw/LIriFkh40XD8LY+aYhGonPzDGnuQjcYHU48Hlp
 3ufsjLIQdLs4jCTmzSlURcXvaxi04o4WV+YOEGrUYSXeY8+6J4T8uKXqlMyoKQ+C
 w/m8Kgr5gQf/E020LYpWPoPWkoPrRRtBLvvXAighNEKMEtefSqxQtE1r/c/rMU12
 VeSX5LwJ3VRhCiZuTJD+08aRrGQNf+Fm6nswnyLw66bFGyIpPErEwhhbJsmPmaNN
 pOrbAxsAMwc/+jy0gqw7XFT/oDts+VN8WiYSRRaHfZ68lCvgf9AYirtygJy6oNYM
 WLTDOJjMwb42qBqyo6eYjos5yU57F5thV9M6qY5ycCIO0AIM0cFrRkZjNLF1pWS6
 6n8pwpPab29nUy3Ql3PZhW7t/4bhz0todfN7egHZrrvCkCOSQ/5DDWLLBI6ow9bM
 fXKB1sVjkNLPrHJ//5Hqh0GdO/Uc8GqdOIFngCnnjR3CS/ax+PZoAawCn1XbBpUW
 ddgSpAigLtFsLg==
 =3t/k
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEgDq5E1p1aZrNLFFkhs+UTJZx/fIFAmY03Y8THGRhdmlkc0Bv
 cGVudnBuLm5ldAAKCRCGz5RMlnH98sRwEACMzTmRreCO3jz456Q9gJS/kV1Ll/NB
 xOfEnhttxc19t+kjKL/AQOW3kfvP34uJUQdQAvjmp/HyJYGXQuNwGDW2/VD6aRaM
 e8agFKtKT6cGYPV3NoL3i4+hcl+ZIVnnVAQ+U7Pd9P8eAOzjALa53nAzx978Sfsc
 517M9V6M2dCAERtZYfTlUcM9Fi7055KsW8Ermna1qyRyA25F9ekVMSOMTvSzlUCa
 7W7OE0J2uJafyP4K5gGpmHZLrirEWSrtY3oOjHO0HAjur+Ir3XwcTnB9U4ACdVQV
 HYnIv3QzElQV0aGeWwqKir1i9WIefpZe28h+53UP8pTnx5C5uo+U03kNibyjDDRx
 fMxGa5fELyTMk6kttN6TtWcIbHeWTch6qzsvYJR1Exaqql3EEbRIerlsCL5ZM2TV
 JP04BWzJ7Hfz6qTS3dFUiFHfZw3ptPthE/3JiAYObIFE1YdQKYjwAKHXRjjdh1kT
 pq0ubqx9mX8OkgVZWNC9NDIZvZpdGFBn57wfG3TN29iR/J2WELsjhPOI3tMQAWMT
 ZqrDl45BciFUA2lVkZ7C9tgaGMR/nok/3bTksrNcM3h2DCE8Rt28giZwvtN2nSjq
 8ekT6jDs15WZd3kfVJHP4tb2MCh/IuP/8DPmUxW6jbg6tFJ+JqOSmD502pwZfxog
 gRbBXbdUqV9B3A==
 =nrJ0
 -----END PGP SIGNATURE-----

Merge OpenVPN 3 Core library version 3.8.5 to master

Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-05-03 14:50:21 +02:00
Arne Schwabe
74ff4c9191 Fix NONE cipher not present in IV_CIPHERS
We currently accept cipher none as pushed cipher when legacy ciphers are
enabled but do not announce support for it in IV_CIPHERS. This means we
currently display inconsistent behaviour. Servers that ignore IV_CIPHERS
can use none but server that are correctly working cannot.
2024-04-24 15:46:44 +00:00
RenovateBot
060f45b251 chore(deps): update github actions to v4 2024-04-24 15:46:43 +00:00
Krasovskiy Saveliy Igorevich
dbc6a14260
ovpnagent: fix ADAPTER_DOMAIN_SUFFIX option when using DCO
Setting ADAPTER_DOMAIN_SUFFIX for non-DHCP adapters requires
registry modification. For that, we need adapter GUID.

This passes adapter GUID from agent to client via /tun-open call
and then from client to agent via /tun-setup call, when adapter
domain suffix is set.

Github: #304

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Signed-off-by: Krasovskiy Saveliy Igorevich <skrasovskiy@ozon.ru>
2024-04-23 16:23:45 +02:00
David Sommerseth
03236ed7bb
Release: OpenVPN 3 Core Library, version 3.8.5
Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-04-22 13:18:11 +02:00
Charlie Vigue
80e07cdf66 Fix unit test merge error
PROTO_N_THREADS clause tries to set mangled variable name. Fixed.

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-04-19 14:27:18 +00:00
RenovateBot
6f9bca5289 chore(deps): update dependency chriskohlhoff/asio to asio-1-30-2 2024-04-18 10:02:32 +00:00
Arne Schwabe
ad5057b991 Move test_proto into coreUnittests
With compression logic now being able to be tuned at runtime the
different executable to allow a different define for the compression
log level is no longer needed.

Prefix the defines of test_proto.cpp with PROTO_ to avoid collision of
these very generic named defines

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-04-17 14:48:50 +00:00
Arne Schwabe
dc35bd8d07 Replacing logging in ssl context und proto context with new logger
This allows the test_proto.cpp to supress all the logging of this
class. This is also the only place in our project that actually uses
a non-default loglevel for this class. A lot of files were defining the
OPENVPN_LOG_SSL(x) macro to be what the also remove ssllog.hpp would do
anyway if it were not defined.

The removed debug_level field  only controlled the mssfix
logging and is now controlled by the general protocol logging instead.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-04-17 14:48:50 +00:00
Arne Schwabe
e2c2f6e936 Refactor compression to allow setting log level at runtime
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-04-17 14:48:50 +00:00
Arne Schwabe
71cc30e642 Introduce more flexible logging class
This template base class allows specifying a maximum log level that
can be used to make the logging function empty above that level.

This allows us to make our logging more structured and move to a more
standard logging approach. The use of if constexpr ensures that logging of
very high level is not emitting code.

This also add a few macros (LOG_VERBOSE, LOG_INFO, LOG_TRACE) that are drop
in replacements for the old OPENVPN_xx_LOG and OPENVPN_xx_LOG_VERBOSE macros
and also ensure not to do string construction if logging at a certain level
is already disabled at compile time.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-04-17 14:48:50 +00:00
David Sommerseth
b47ef50484
test/ovnpcli: Refactor to use GDBus++ D-Bus implementation
The openvpn3-linux ships with a netcfg-cli client, which is essentially
the same code as test/ovpncli/cli.cpp but it uses the
net.openvpn.v3.netcfg D-Bus service to create the virtual network
adapter and the related network and DNS configuration.  This is a useful
test client when only wanting to test the Network Configuration service
openvpn3-linux ships with.

As part of the refactoring of the D-Bus implementation in
openvpn3-linux, the supporting D-Bus setup needs to be adjusted to the
new D-Bus API.

It has been considered to support both types of APIs, but the legacy
D-Bus API is deprecated and will not be used any more after the release
of OpenVPN 3 Linux v22_dev.  Prior releases will depend on an older
OpenVPN 3 Core library version, which contains the old API.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-04-16 21:01:27 +02:00
David Sommerseth
9d542454ea
dco: Fix incorrect #ifdef vs #if usage for ENABLE_KOVPN
The code in dco/dcocli.hpp used #if ENABLE_KOVPN, which will
fail on newer compilers if the macro is defined in a source
file.  Compilers may not complain if the macro is defined on
the command line, via -D.

This type of checks should use either #ifdef or #if defined(...).
The #if conditional expects a boolean expression.

Since these code blocks also depended on #elif (also expects
a boolean expression , the defined(...) approach was chosen
throughout this file.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-04-16 21:00:18 +02:00
RenovateBot
0f990cfbd2 chore(deps): pin dependencies 2024-04-12 04:02:08 +00:00
Arne Schwabe
e14c3f0441 Refactor ClientProto::Session to use ProtoContext as field insatead of Base
Currently the protocontext is used as kind of composition but not really
and makes following the code harder, since this inheritance not only serves
for composition but also as callbacks through virtual method inheritance.

Making ProtoContext a normal field and definining a callback interface makes
the class relationship easier to understand.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-04-11 09:59:05 +00:00
RenovateBot
2ff8029eba chore(deps): update dependency chriskohlhoff/asio to asio-1-30-1 2024-04-10 12:00:45 +00:00
illia.polishchuk
458826d784 Make the inactive behavior similar to openvpn2
By resetting the timer on each incoming packet, we can capture more gaps.
Consider the following examples:

Old logic:
0 seconds: openvpn3 starts with an inactive timeout of 60 seconds.
30 seconds: An ICMP packet was received with 48 bytes.
60 seconds: 48 bytes received for the last 60 seconds, continue...
90 seconds: An ICMP packet was received with 48 bytes.
120 seconds: 48 bytes received...

New logic:
0 seconds: openvpn3 starts with an inactive timeout of 60 seconds.
30 seconds: An ICMP packet was received with 48 bytes.
Inactive timeout reset!.
90 seconds: Inactive timeout triggered. Terminating session..."

Signed-off-by: illia.polishchuk illia.polishchuk@openvpn.com
2024-04-08 12:11:28 +00:00
Charlie Vigue
dd115d2e83 Fix RouteBase string formatting bug
When correcting conversion issues in RouteBase a to_string bug was
introduced which caused some characters to be escaped when inserted
to the string, for example a prefix_len of 0 would render as "\0"
rather than inserting '0'. The std::ios::binary flag does not seem
to prevent this for std::ostringstream so I have cast the data member
up to uint16_t which should be safe, and solves the issue.

Added a unit test to demonstrate the issue. Old code output was
"0.0.0.0/\0", now outputs "0.0.0.0/0" as expected.

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-03-29 03:13:00 +00:00
RenovateBot
e150bb3985 chore(deps): update dependency google/googletest to v1.14.0 2024-03-28 11:27:25 +00:00
RenovateBot
70c0d9a534 chore(deps): update dependency chriskohlhoff/asio to asio-1-29-0 2024-03-28 11:27:24 +00:00
Mark Deric
8558312d92 Fix client logging problems
A refactoring of the logging code in commit 9ffa263b removed
conventional #ifndef header guards and replaced them with #pragma
once.  Some consumers of the code used the header #defines to guide
their behavior.  The missing guards caused the consumers to log
incorrectly.  The fix was to still rely on the #pragma once for
guarding, but to reinstate the #defines from the original headers.

Signed-off-by: Mark Deric <jmark@openvpn.net>
2024-03-28 11:27:23 +00:00
Mark Deric
5955f05eab Improve C2os unit tests with better templates
Signed-off-by: Mark Deric <jmark@openvpn.net>
2024-03-28 11:27:23 +00:00
Frank Lichtenheld
91a62654fe renovate: add global Core configuration
So that we override values from the global Ops
configuration we do not like.

While here change rebaseWhen. Since we do rebase
everything before merge anyway, let's renovate
do it for us.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-28 11:27:22 +00:00
Arne Schwabe
c07fb748a9
Fix IV_SSL and IV_HWADDR not reported
The previous commit restructured the way how peer info was built and
accidentally move those into its own method without calling the method.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-03-27 22:42:55 +01:00
David Sommerseth
43da4c8bc2
unittest: Don't include sys/socket.h unconditionally
The sys/socket.h header is not available on Windows.  This issue was
introduced in commit 1b4f736bb9, so the same fencing used in
that commit was also added around the #include statement.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-03-22 22:15:11 +01:00
David Sommerseth
7f3e61089b
mac/gw: Fix incorrect additional )
In commit 1b4f736bb9, an additional parentheses was added to
the MacGatewayInfo constructor.  This results in code which cannot be
compiled.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2024-03-22 22:15:10 +01:00
Lev Stipakov
4f1f22159f
Improve handling of unknown options
A few minor changes:

 - add ORGANIZATION meta option to ignore list

 - remove excessive OVPN_ACCESS_SERVER_ prefix from NO_WEB meta option

 - Increase status message length from 256 to 2048 to be able to show
   the full list of unsupported options

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-03-22 21:25:48 +01:00
Mark Deric
18e92a823f Extend C2os to handle containers of pointers
Create a new cast to tell the ostreamer to dereference before
inserting.

Signed-off-by: Mark Deric <jmark@openvpn.net>
2024-03-22 15:15:10 +00:00
Illia Polishchuk
00bdf8ba8b Make profile errors clearer for users by reporting specific error codes.
ERR_INVALID_OPTION_DNS -- invalid value for some of DNS\Domain options
ERR_INVALID_OPTION_CRYPTO -- invalid value for some of SSL\Crypto option
ERR_INVALID_CONFIG -- missing option or not supported option
ERR_INVALID_OPTION_PUSHED -- pushed to server option error
ERR_INVALID_OPTION_VAL -- invalid value for some general option

Signed-off-by: Illia Polishchuk <illia.polishchuk@openvpn.com>
2024-03-22 15:15:09 +00:00
Illia Polishchuk
447c942395 Add codes support to option_error for clearer messages.
Signed-off-by: Illia Polishchuk <illia.polishchuk@openvpn.com>
2024-03-22 15:15:09 +00:00
Illia Polishchuk
c2b7a39a1b Simplify creation of exceptions with codes by a new macro
The OPENVPN_EXCEPTION_WITH_CODE(C, DEFAULT_CODE, ...)
macro creates enum C_code with __VA_ARGS__ codes
and constructor with the C_code as first argument which
adds label at the beginning of error message, other
constructors add DEFAULT_CODE label

Signed-off-by: Illia Polishchuk <illia.polishchuk@openvpn.com>
2024-03-22 15:15:09 +00:00
Frank Lichtenheld
9b63b1e3be Do not check for C++ <= 17
Code should now silently assume C++-17 semantics.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-19 12:23:44 +01:00
Antonio Quartulli
1216f566e4 sitnl: allow user to configure custom metric for routes
Until now sitnl was just default to metric 0 when installing routes,
while ignoring any value that may have been passed by the user.

Extend logic to properly accept a user value.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2024-03-15 13:27:14 +00:00
Antonio Quartulli
1e23850291 tunnetlink.hpp: remove unused include
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2024-03-15 13:27:14 +00:00
Antonio Quartulli
56dbd2ceec TunBuilderCapture: use default route metric if none was specified
When the user specifies no metric (i.e. value is -1), the TunBuilder
should pass the default value down the stack.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2024-03-15 13:27:14 +00:00
Arne Schwabe
1b4f736bb9
Make macOS gateway detection IPv6 aware and use actual server address
This also move the building IV_HWADDR peer info variable to the point
that the server address is actually available.

This also avoids failing to connect when push-peer-info is enabled and
there is no IPv4 default gateway. The new code will always pick the device
that holds the route to the current remote.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-03-14 14:10:53 +01:00
Frank Lichtenheld
763176ea70
Options: do not error out on client + pull
Config

    client
    pull

was not correctly handled like client + tls-client
since the code short-circuited if tls-client wasn't set
and so didn't touch pull option.

Github: #277
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-13 16:51:33 +01:00
Frank Lichtenheld
458e5df1ab
test_cliopt: Refactor by using parameterized tests
This makes it easier to add other configuration
variants to test.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-13 16:51:32 +01:00
Frank Lichtenheld
f8c7d0629f
Manage more parts of GHA with renovate
- Add custom rule for vcpkg
- Add custom rule for repository checkouts

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-13 16:43:53 +01:00
Frank Lichtenheld
4a51628afe
Tweaking renovate config
- Group GHA updates and set them to monthly schedule to
  drastically reduce the numbers of PRs
- Notify about GoogleTest updates

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-03-13 16:43:52 +01:00
RenovateBot
ad0e0f5e7a
Add renovate.json 2024-03-13 16:43:27 +01:00
Antonio Quartulli
9eeeb38c45
unit-test: fix sitnl systematic failure
It was noted that the SITNL unit test is always failing for no clear
reason.

It turned out that commit 22ba196429
("SITNL: revert change of sitnl_send return type, return int"),
that was supposed to be a simple revert of
ae663c573a ("Using new numeric
conversion tools") is actually converting two "return ret" into
return -1 and return -EINVAL accordingly.

This accidental change results in two functions always returning
an error despite terminating succesfully.

This behaviour was obviously fooling the unitest which failed in result.

Fix both functions by properly returning "ret" as it was originally.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2024-03-12 09:47:54 +01:00
Frank Lichtenheld
3bd3915d0a CMake: Add USE_WCONVERSION option
Makes it easier to test with -Wconversion, e.g. in Jenkins.

For now disable -Wsign-conversion. That is the default in g++,
but not clang++. Once we have fixed all -Wsign-conversion
warnings, we can enable it for both.

For now disable -Wenum-enum-conversion. Only present in clang++.
Not clear whether cleaning those up will be worth the effort.

Disable -ferror-limit in clang++. This ensures that it always
displays all errors.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 6e7a98b5f4)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
53c35b1013 CMake: Refine CXX_STANDARD setting
- Set CXX_STANDARD_REQUIRED ON so that we error out early
  if CMake thinks that the compiler does not support the
  used standard.
- Set CXX_EXTENSIONS OFF so that we get less compiler
  specific behavior.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 9b8797fe5e)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
82d8dbb975 CMake: accept all NEW policies in released CMake versions
Using the <max> argument to cmake_minimum_required will
set all policies up to <max> to NEW. We might need to
fix some issues arising from that, but this means that
modern CMake can already behave like it wants even with
leaving <min> so that we can support old distros (currently
Debian 10).

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 268bf42b9e)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
61c0ab7f6b client: Switch to UseSWIG instead of manual custom command
On modern CMake this gets us swig dependency management,
which should reduce problems for incremental builds.
Also it is just cleaner.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 72275db1d5)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
ef3b290de6 CMake: replace FindPythonIntp with FindPython3
The earlier were deprecated since CMake 3.12.
Since CMake 3.27 this causes deprecation warnings.
Should be safe nowadays to require CMake 3.12.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit bb61350ae5)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
14136ee923 CMake: disable -Wmaybe-uninitialized for GCC builds
This is very noisy with lots of false positives, especially
in newer version of GCC. So for now disable this.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit d7e8375fc5)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
ce054c562c CMake: make doxygen generation work better
- Use CURRENT source and binary dir to make this work even
  if used as a sub-directory in another project.
- Make USE_MDFILE_AS_MAINPAGE actually work. It is only
  used when part of the INPUT and does not automatically
  add it to INPUT.
- Make sure CMake uses the latest version of README.rst
  by using configure_file instead of file(COPY).
- Improve EXCLUDE_PATTERNS.
- Add NUM_PROC_THREADS.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 474de6c93f)
2024-03-07 00:29:36 +02:00
Frank Lichtenheld
c9939d271b CMake: Reorder includes to prefer asio
By adding the asio includes first we have a better
chance to force using "our" asio. This can be important
since some parts of the code require a patched version.

The actual "core" parts of the code work fine with
upstream asio however, so I also do not want to
force the patched asio by requiring a special header
name or directory structure.

So this is a compromise solution which hopefully works
for most use-cases.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit bc7f4be01b)
2024-03-07 00:29:36 +02:00