]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
8 months agosample-keys: renew for the next 10 years release/2.5
Frank Lichtenheld [Tue, 21 Nov 2023 11:04:30 +0000 (12:04 +0100)] 
sample-keys: renew for the next 10 years

Old expiration was October 2024, less than a year away.
Give everyone the chance to get the new keys before tests
start failing.

Change-Id: Ie264ec1ec61fd71e8cc87987be3e2adc2735c201
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20231121110430.16893-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27530.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 78e0c5f2f57a18e8ea60951696a458a4b3ff3621)

12 months agoPreparing release 2.5.11 v2.5.11
Gert Doering [Thu, 18 Jul 2024 12:23:03 +0000 (14:23 +0200)] 
Preparing release 2.5.11

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 months agoAllow trailing \r and \n in control channel message
Arne Schwabe [Thu, 11 Jul 2024 11:30:22 +0000 (13:30 +0200)] 
Allow trailing \r and \n in control channel message

Writing a reason from a script will easily end up adding extra \r\n characters
at the end of the reason. Our current code pushes this to the peer. So be more
liberal in accepting these message.

Github: closes OpenVPN/openvpn#568

This is the backport of the fix (commit be31325e1dfdffb) to release/2.5.

Change-Id: I47c992b6b73b1475cbff8a28f720cf50dc1fbe3e
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240711113022.52076-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28923.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
13 months agoProperly handle null bytes and invalid characters in control messages
Arne Schwabe [Mon, 27 May 2024 13:02:41 +0000 (15:02 +0200)] 
Properly handle null bytes and invalid characters in control messages

This makes OpenVPN more picky in accepting control message in two aspects:
- Characters are checked in the whole buffer and not until the first
  NUL byte
- if the message contains invalid characters, we no longer continue
  evaluating a fixed up version of the message but rather stop
  processing it completely.

Previously it was possible to get invalid characters to end up in log
files or on a terminal.

This also prepares the logic a bit in the direction of having a proper
framing of control messages separated by null bytes instead of relying
on the TLS framing for that. All OpenVPN implementations write the 0
bytes between control commands.

This patch also include several improvement suggestion from Reynir
(thanks!).

CVE: 2024-5594

Reported-By: Reynir Björnsson <reynir@reynir.dk>
Change-Id: I0d926f910637dabc89bf5fa919dc6beef1eb46d9
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20240619103004.56460-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28791.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 414f428fa29694090ec4c46b10a8aba419c85659)

16 months agoPreparing release 2.5.10 v2.5.10
Gert Doering [Thu, 21 Mar 2024 17:03:36 +0000 (18:03 +0100)] 
Preparing release 2.5.10

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
16 months agointeractive.c: Fix potential stack overflow issue
Lev Stipakov [Wed, 20 Mar 2024 08:19:45 +0000 (10:19 +0200)] 
interactive.c: Fix potential stack overflow issue

When reading message from the pipe, we first peek the pipe to get the size
of the message waiting to be read and then read the message. A compromised
OpenVPN process could send an excessively large message, which would result
in a stack-allocated message buffer overflow.

To address this, we terminate the misbehaving process if the peeked message
size exceeds the maximum allowable size.

This commit is backported from 9b2693f in release/2.6 branch, fixing
merge conflicts around &ring_buffer_handles and wins_cfg_message_t.

CVE: 2024-27459
Microsoft case number: 85932

Reported-by: Vladimir Tokarev <vtokarev@microsoft.com>
Change-Id: Ib5743cba0741ea11f9ee62c4978b2c6789b81ada
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Heiko Hund <heiko@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240320082000.284-2-lev@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28433.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
16 months agointeractive.c: disable remote access to the service pipe
Lev Stipakov [Tue, 19 Mar 2024 15:16:07 +0000 (17:16 +0200)] 
interactive.c: disable remote access to the service pipe

Remote access to the service pipe is not needed and might
be a potential attack vector.

For example, if an attacker manages to get credentials for
a user which is the member of "OpenVPN Administrators" group
on a victim machine, an attacker might be able to communicate
with the privileged interactive service on a victim machine
and start openvpn processes remotely.

CVE: 2024-24974

Microsoft case number: 85925

Reported-by: Vladimir Tokarev <vtokarev@microsoft.com>
Change-Id: I8739c5f127e9ca0683fcdbd099dba9896ae46277
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Heiko Hund <heiko@openvpn.net>
Message-Id: <20240319151723.936-2-lev@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28419.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2c1de0f0803360c0a6408f754066bd3a6fb28237)

16 months agowin32: Enforce loading of plugins from a trusted directory
Lev Stipakov [Tue, 19 Mar 2024 13:53:45 +0000 (15:53 +0200)] 
win32: Enforce loading of plugins from a trusted directory

Currently, there's a risk associated with allowing plugins to be loaded
from any location. This update ensures plugins are only loaded from a
trusted directory, which is either:

    - HKLM\SOFTWARE\OpenVPN\plugin_dir (or if the key is missing,
    then HKLM\SOFTWARE\OpenVPN, which is installation directory)

    - System directory

Loading from UNC paths is disallowed.

Note: This change affects only Windows environments.

CVE: 2024-27903

Change-Id: I154a4aaad9242c9253a64312a14c5fd2ea95f40d
Reported-by: Vladimir Tokarev <vtokarev@microsoft.com>
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20240319135355.1279-2-lev@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28416.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit aaea545d8a940f761898d736b68bcb067d503b1d)

2 years agofix typo: dhcp-options to dhcp-option in vpn-network-options.rst
George Pchelkin [Fri, 14 Jul 2023 09:25:57 +0000 (11:25 +0200)] 
fix typo: dhcp-options to dhcp-option in vpn-network-options.rst

Closes: OpenVPN/openvpn#313
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230714092557.229260-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26855.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 9d2e947e7358c7998f13b142d8bf17a2ce9eb7a3)

2 years agoAdd Apache2 linking with for new commits
Arne Schwabe [Wed, 26 Apr 2023 09:49:31 +0000 (11:49 +0200)] 
Add Apache2 linking with for new commits

After first round of mailing people with more than 10 commits we have
almost all committers have agreed. This put this license in the realm
of having a realistic change to work. Had any of these contributers
disagreed, rewriting all their code might have been not feasible.

The rationale of adding this exception now is to avoid having to
have a second round of agreement for new contributers and ensure
that all new code will include the exemption.

patch v2: add explaination and use exception rather than excemption
patch v3: actually send v3

Change-Id: Ide83f914f383b53ef37ddf628e4da5a78e241bf0
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20230426094931.1168078-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26610.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7b21c69dbe1e1ecfb5bed564417387892b42108a)

2 years agoPreparing release 2.5.9 v2.5.9
Gert Doering [Tue, 14 Feb 2023 16:20:58 +0000 (17:20 +0100)] 
Preparing release 2.5.9

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 years agoDo not include auth-token in pulled option digest
Selva Nair [Mon, 19 Dec 2022 14:04:05 +0000 (09:04 -0500)] 
Do not include auth-token in pulled option digest

As change in auth-token is common on restart and does not
require tun-reopen, exclude it from the "pulled options digest"
calculation. Without this tun is always re-opened on SIGUSR1
if auth-token is in use which breaks persist-tun.

Github: Fixes OpenVPN/openvpn#200

v2: explcitly filter auth-token and auth-token-user

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221219140405.1221341-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25768.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f778f4f88e56851c0a68205e95110c021f3032b3)

2 years agogit-version.py: proper support for tags
Lev Stipakov [Mon, 19 Dec 2022 15:56:38 +0000 (17:56 +0200)] 
git-version.py: proper support for tags

Git magic to get branch name

  git rev-parse --symbolic-full-name HEAD

doesn't work when we're on tag, which is the case when
we build releases.

First, try to get tag name with

   git describe --exact-match

and if this fails, get branch name as before.

Use subprocess.Popen() to suppress stdout/stderr output.

Github: Fixes OpenVPN/openvpn#199

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20221219155638.497-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25773.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 91ab3d022e2652a46e6d6f25ab62f7c903e583c1)

2 years agoFix corner case that might lead to leaked file descriptor
Arne Schwabe [Thu, 15 Dec 2022 19:01:42 +0000 (20:01 +0100)] 
Fix corner case that might lead to leaked file descriptor

Reported-By: Trail of Bits
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221215190143.2107896-8-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25730.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a034dc8153522713c3cfda90b2cda114cea70e2d)

2 years agoRemove unused gc_arena
Arne Schwabe [Thu, 15 Dec 2022 19:01:41 +0000 (20:01 +0100)] 
Remove unused gc_arena

Reported-By: Trail of Bits
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221215190143.2107896-7-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25736.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 97929d16a4eb05cb521a469ff4eaca32761699f3)

2 years agoImprove documentation on user/password requirement and unicodize function
Arne Schwabe [Thu, 15 Dec 2022 19:01:39 +0000 (20:01 +0100)] 
Improve documentation on user/password requirement and unicodize function

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221215190143.2107896-5-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25733.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4b6854881c36e16054878e0467ef87d925e20cae)

2 years agoEnsure that argument to parse_line has always space for final sentinel
Arne Schwabe [Thu, 15 Dec 2022 19:01:38 +0000 (20:01 +0100)] 
Ensure that argument to parse_line has always space for final sentinel

This fixes two places were we do not have enough space in the array
of parameters given to parse_line for the final NULL parameter that
signal the end of the parsed argument errors.

Both these cases can lead to a buffer overflow. But both of these
cases require root/admin access to OpenVPN:

- parse_argv, only able to trigger if starting openvpn from the command
  line, at this point you cannot  gain more privileges than you already
  have.

  Way to reproduce, compile with ASAN and run:

       openvpn --tls-verify a a a a a a a a a a a a a a a

- remove_iroutes_from_push_route_list

This operates on the list of pushed entries that is generated
by the server itself. So trigger this, you need to have control
over config, management interface, a plugin or cdd files.

The parse_argv problem was found by Trial of Bits. I found the
remove_iroutes_from_push_route_list problem by looking for similar
problems.

Reported-By: Trial of Bits (TOB-OVPN-4)
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221215190143.2107896-4-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25734.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 749beb6d0cb9f8628997bb656ba2f64e31cac377)

2 years agopull-filter: ignore leading "spaces" in option names
Selva Nair [Wed, 30 Nov 2022 10:55:02 +0000 (05:55 -0500)] 
pull-filter: ignore leading "spaces" in option names

It seems sometimes comma-separated pulled options have
an offending leading space. Not sure whether that is an error,
but the change here matches the behaviour of option parsing.

v2: fix typo in commit message
v3: space() --> isspace()

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221130105502.662374-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25582.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f02946ff9900a37dd36f61748173d53eca01adf9)

2 years agoDo not add leading space to pushed options
Selva Nair [Wed, 30 Nov 2022 10:56:09 +0000 (05:56 -0500)] 
Do not add leading space to pushed options

This makes auth-token push during reneg
consistent with regular PUSH_REPLY.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221130105609.662402-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25583.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d0672e7a06437c730e27df645b9b9a5407b44ccf)

2 years agoCheck if pkcs11_cert is NULL before freeing it
Max Fillinger [Wed, 23 Nov 2022 15:49:12 +0000 (16:49 +0100)] 
Check if pkcs11_cert is NULL before freeing it

When running openvpn --show-tls with mbedtls, it showed a null pointer
error at the end because of this.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20221123154912.28394-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25530.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 19c64f16baebbce966d55c62135d1ef066f7c8c2)

2 years agoFix handling an optional invalid cipher at the end of data-ciphers
Arne Schwabe [Mon, 6 Dec 2021 15:08:52 +0000 (16:08 +0100)] 
Fix handling an optional invalid cipher at the end of data-ciphers

If an optional cipher was found at the end of --data-cipher that was
not available, it would reset the error and allow non optional ciphers
to be ignored.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211206150852.3142891-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211206150852.3142891-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 868433857fbf8d71515ac0ffecb98eae893515dc)

2 years agoImplement optional cipher in --data-ciphers prefixed with ?
Arne Schwabe [Wed, 1 Dec 2021 18:07:19 +0000 (19:07 +0100)] 
Implement optional cipher in --data-ciphers prefixed with ?

This allows to use the same configuration multiple platforms/ssl libraries
and include optional algorithms that are not available on all platforms

For example "AES-256-GCM:AES-128-GCM:?CHACHA20-POLY1305" can be used to
emulate the default behaviour of OpenVPN 2.6.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201180727.2496903-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23279.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 766044507497c41f0319159c37992788ecb681e6)

2 years agomsvc: always call git-version.py
Frank Lichtenheld [Fri, 11 Nov 2022 12:12:12 +0000 (13:12 +0100)] 
msvc: always call git-version.py

There is no way to detect whether this information
is outdated in nmake itself. So leave it up to the
Python script to decide.

While here, change some leading whitespace to tabs as
expected in Makefile.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20221111121212.25167-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25508.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 3951ed8479c01e79bd8fae5c7d4b5f6b07d1f0fb)

2 years agoPreparing release 2.5.8 v2.5.8
Gert Doering [Thu, 27 Oct 2022 07:13:14 +0000 (09:13 +0200)] 
Preparing release 2.5.8

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 years agoDo not copy auth_token username to itself
Selva Nair [Thu, 27 Oct 2022 16:06:19 +0000 (12:06 -0400)] 
Do not copy auth_token username to itself

- Fixes a potential mis-behaviour (strncpy with
dest == src) introduced by commits ecad4839c (2.6)
and 3d792ae955 (2.5).
Reported by: Gert Doering <gert@greenie.muc.de>

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221027160619.11894-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=20221027160619.11894-1-selva.nair@gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit dbf142ffe597b21aa09a47677ea2061b74a9354e)

2 years agoPurge auth-token as well while purging passwords
Selva Nair [Wed, 26 Oct 2022 18:55:43 +0000 (14:55 -0400)] 
Purge auth-token as well while purging passwords

Starting from commit e61b401a auth-token is saved in a separate struct
from auth-user-pass and is not cleared when ssl_purge_auth() is called.
This makes "forget-passwords" sent to the management
interface or "--management-forget-disconnect" option not to work
as expected.

Purging caused by --auth-nocache is not affected
(auth-token is retained in that case as it should be).

Use case:
For Pre-Logon access and persistent connections on Windows, use of
"forget-passwords" before disconnect is probably the only way to
ensure that no credentials are left behind. Note that openvpn.exe
continues to run after disconnect in these cases.

Also, the original intent of "forget-passwords" appears to be to
clear all "passwords" that can be used to reconnect.

v2:
- call ssl_clean_auth_token() directly from manage.c instead
  of amending ssl_purge_auth()
- Add a comment that ssl_purge_auth() does not clear auth-token

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221026185543.5378-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25460.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit ecad4839caf4c2fab9c6627ceeca9b9cb32e8929)

2 years agoEnsure --auth-nocache is handled during renegotiation
Selva Nair [Sun, 23 Oct 2022 19:51:05 +0000 (15:51 -0400)] 
Ensure --auth-nocache is handled during renegotiation

Currently, clearing auth_user_pass struct is delayed until
push-reply processing to support auth-token. This results in
username/password not purged after renegotiations that may
not accompany any pushed tokens -- say, when auth-token is not
in use.

Fix by always clearing auth_user_pass soon after it is used,
instead of delaying the purge as in pre-token days. But, when
"pull" is true, retain the username in auth_token in anticipation
of a token that may or may not arrive later.

Remove ssl_clean_user_pass() as there is no delayed purge any
longer -- auth-nocache handling is now done immediately after
writing username/password to the send-buffer.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20221023195105.31714-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25452.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 3a4fb17d103be37599d72d072bbee42cc121a39d)

2 years agoFix OpenVPN querying user/password if auth-token with user expires
Arne Schwabe [Thu, 17 Feb 2022 18:22:34 +0000 (19:22 +0100)] 
Fix OpenVPN querying user/password if auth-token with user expires

The problematic behaviour happens when starting a profile without
auth-user-pass and then connecting to a server that pushes auth-token.
When the auth token expires OpenVPN asks for auth User and password
again (but it shouldn't).

The problem is that the auth_user_pass_setup sets
auth_user_pass_enabled = true; This function is called from two places.
In ssl.c it is only called with an auth-token present or that
variable already set. The other one is init_query_passwords.

Move setting auth_user_pass_enabled to the second place to ensure it is
only set if we really want passwords.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Acked-by: Heiko Hund <heiko@ist.eigentlich.net>
Message-Id: <20221009130805.1556517-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25367.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry-picked from commit 7d291e10bccd1d6b9e584307fb5fe3ebfb114ec9)

2 years agomsvc: add branch name and commit hash to version output
Lev Stipakov [Mon, 26 Sep 2022 07:08:43 +0000 (10:08 +0300)] 
msvc: add branch name and commit hash to version output

Add a simple python script which generates header with
branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj
and add proper copyright header to Makefile.mak.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220926070843.717-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25314.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 years agoChange command help to match man page and implementation
Arne Schwabe [Thu, 8 Sep 2022 16:14:35 +0000 (18:14 +0200)] 
Change command help to match man page and implementation

Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220908161435.327109-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25151.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2b4f3ea880377401275baf965ff603f30cde36f1)

2 years agot_client.sh: do not require fping6
Frank Lichtenheld [Mon, 22 Aug 2022 14:18:06 +0000 (16:18 +0200)] 
t_client.sh: do not require fping6

fping and fping6 were merged in version 4.0,
released in 2017. Many recent distributions do
not include the compatibility symlink anymore.

So if we find fping but not fping6 do not error
out but assume that fping is capable of IPv6.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20220822141806.39406-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25058.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit fb06c9f026a78b879f264ab8e67de09d725b5540)

2 years agot_client: Allow to force FAIL on prerequisite fails
Frank Lichtenheld [Fri, 22 Jul 2022 13:49:02 +0000 (15:49 +0200)] 
t_client: Allow to force FAIL on prerequisite fails

In automated tests we want the build to fail if the
worker node is configured incorrectly.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220722134902.22092-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24723.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 79932b94513303567fdd5d1c4e0abb79e6642b6e)

2 years agoAllow a few levels of recursion in virtual_output_callback()
Selva Nair [Thu, 28 Jul 2022 03:45:08 +0000 (23:45 -0400)] 
Allow a few levels of recursion in virtual_output_callback()

Without this, replies to commands from the management client
are sometimes lost if the server is writing when a command
comes in and leads to a recursive call to this function.

For some reason I've not been able to trigger this on Linux,
but it does sometimes happen on Windows during intense write
activity by openvpn.exe sending log lines to the management
client.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220728034508.15180-2-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24751.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4dfd592ff1ee18aa4859264c8a341dfa1a291988)

2 years agoFix auth-token usage with management-def-auth
Selva Nair [Mon, 4 Jul 2022 02:58:40 +0000 (22:58 -0400)] 
Fix auth-token usage with management-def-auth

When auth-token verify succeeds during a reauth, other auth
methods (plugin, script, management) are skipped unless
external-auth is in effect (skip_auth gets set to true).

However, in this case, the status of management-def-auth
(ks->mda_status) stays at its default value of ACF_PENDING
and will never change. This causes TLS keys to go out of sync
and an eventual client disconnect.

Further, a message saying username/password authentication is
"deferred" gets logged which is misleading.
For example:

test/127.0.0.1:35874 TLS: Username/auth-token authentication
    succeeded for username 'test'

followed by

test/127.0.0.1:35874 TLS: Username/Password authentication
    deferred for username 'test' [CN SET]

Fix by setting ks->mda_status to ACF_DISABLED, and do not
set ks->authenticated = KS_AUTH_DEFERRED when skip_auth is true.

Also log a warning message when token is marked as expired on
missing the reneg window.

Reported by: Connor Edwards <connor.edwards@b2c2.com>

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220704025840.2558-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24627.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit ddbe6a6fc26586d09f5a9105f13124c479b4d993)

2 years agoDo not skip ERROR:/SUCCESS: response from management interface
Selva Nair [Thu, 28 Jul 2022 03:45:07 +0000 (23:45 -0400)] 
Do not skip ERROR:/SUCCESS: response from management interface

Generally we expect a response of SUCCESS: or ERROR: to every
command sent to the management interface. But, while in
the management-hold state, sending "signal foo" returns only
the following reply (with foo = SIGHUP, SIGUSR1 etc.):

>HOLD:Waiting for hold release:0

Fix by always responding

ERROR: signal 'foo' is currently ignored"
followed by the above line.

Though this is seldom seen in practice[*], such violation of the
protocol could stall clients like the GUI. So fix it.

[*] One way this happens is with SIGHUP sent before the daemon
is on hold state which it enters before the SIGHUP is received.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220728034508.15180-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24750.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 579b78e22feab7fe7cc627355cbb270cd91aebb4)

3 years agotls-crypt-v2: bail out if the client key is too small
Antonio Quartulli [Tue, 28 Jun 2022 09:41:44 +0000 (11:41 +0200)] 
tls-crypt-v2: bail out if the client key is too small

The tls-crypt-v2 key should be at least 2 bytes long in order to read
the actual length. Bail out if the key is too short.

This looks like it could be abused to trigger a read of uninitialized
memory, but after close checking it won't:

  We read from BEND(), so this is defined for TCP since the minimum
  length there is 3 bytes (pkt len + opcode)

  For UDP we might read past the beginning of the packet but since they
  are buffers coming from the packet stack we have the headroom/tailroom,
  so might read some random data (but not out of bound!).

  So we copy some more or less random number into net_len/wkc_len but without
  actually reading from undefined memory.

  The next line will then almost definitively fail (buf_advance()).

While at it improve the error message a bit.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220628094144.17471-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24580.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 462339a45089ef655faf02232d7d792def9b8afb)

3 years agoUpdate the replay-window backtrack log message
Martin Janů [Fri, 10 Jun 2022 12:04:05 +0000 (12:04 +0000)] 
Update the replay-window backtrack log message

The man pages reference a logging message which has been rephrased
in ac1310528a248c99e039e7afaf48724ad1b7f10e. This commit updates the
man page message to reflect the change for improved grep-ability.

Signed-off-by: Martin Janů <martin.janu@protonmail.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <SVrvuTydxR6Qs_mvwvG7mqT8iLV0inlcCMXoenZTMI8M0LkosV4pZsH9m_XCTwcRWAPN5H8Zdro0ubhJrnSp6v5KC2ZNAL9So0Y2SKiSe7g=@protonmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24472.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 98cbd2914cb728bfaa6ce36a968e944555c57d53)

3 years agoAllow running a default configuration with TLS libraries without BF-CBC
Arne Schwabe [Fri, 3 Jun 2022 09:52:19 +0000 (11:52 +0200)] 
Allow running a default configuration with TLS libraries without BF-CBC

Modern TLS libraries might drop Blowfish by default or distributions
might disable Blowfish in OpenSSL/mbed TLS. We still signal OCC
options with BF-CBC compatible strings. To avoid requiring BF-CBC
for this, special this one usage of BF-CBC enough to avoid a hard
requirement on Blowfish in the default configuration.

This patch is cherry-picked from 79ff3f79 and the missing
ciphername = "none"; has been added in the OCC code.

Due to uncrustify complains, a few extra whitespace fixes had to be
done to options.c.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220603095219.637361-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24456.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRemove useless empty line from CR_RESPONSE message
Arne Schwabe [Mon, 30 May 2022 22:41:49 +0000 (00:41 +0200)] 
Remove useless empty line from CR_RESPONSE message

The out buffer is not filled and this adds an extra empty line for
CR_RESPONSE outputs. Also make minor style fixes.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220530224149.201883-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24447.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 0dbcaba4f301c21e68a5cd032a4b56eb75c17c37)

3 years agoPreparing release 2.5.7 v2.5.7
Gert Doering [Mon, 23 May 2022 15:46:35 +0000 (17:46 +0200)] 
Preparing release 2.5.7

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix client-pending-auth error message to say ERROR instead of SUCCESS
Arne Schwabe [Mon, 23 May 2022 09:17:24 +0000 (11:17 +0200)] 
Fix client-pending-auth error message to say ERROR instead of SUCCESS

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220523091724.3418887-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24421.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d681e9d42e11b08668fae6e7b61d6a040c93082d)

3 years agoTranslate OpenSSL 3.0 digest names to OpenSSL 1.1 digest names
Arne Schwabe [Mon, 23 May 2022 10:35:45 +0000 (12:35 +0200)] 
Translate OpenSSL 3.0 digest names to OpenSSL 1.1 digest names

Since we used the OpenSSL <=1.1 names as part of our OCC message, they
are now unfortunately part of our wire protocol.

OpenSSL 3.0 will still accept the "old" names so we do not need to use
this translation table for forward lookup, only for returning the name
with md_kt_name()

Backport of master commit 88342ed8277c5797.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20220523103546.3425388-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24424.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agocipher-negotiation.rst missing from doc/Makefile.am
Jan Mikkelsen [Wed, 18 May 2022 18:37:15 +0000 (20:37 +0200)] 
cipher-negotiation.rst missing from doc/Makefile.am

Trac: #1461
Signed-off-by: Jan Mikkelsen <janm@transactionware.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220518183715.931-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24394.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7c8dd98ec10f61c3b014b64c24090717cd6ebf05)

3 years agoAdd message when decoding PKCS12 file fails.
Arne Schwabe [Tue, 19 Oct 2021 18:31:22 +0000 (20:31 +0200)] 
Add message when decoding PKCS12 file fails.

Currently we never display the OpenSSL error stack when decoding a
PCKS12 file fails. With LibreSSL defaulting to RC2-40-CBC, the failure
might not be a wrong password but can actually be an unsupported encoding,
seeing the error stack is really helpful (example from OpenSSL 3.0):

error:0308010C:digital envelope routines:inner_evp_generic_fetch:
  unsupported:crypto/evp/evp_fetch.c:346:Global default library
  context, Algorithm (RC2-40-CBC : 0), Properties ()

to pinpoint the issue

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-17-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23017.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6ac4e63c577986ec11eae3519fe8516e8ca8ac0f)

3 years agoRemove dependency on BF-CBC existance from test_ncp
Arne Schwabe [Fri, 13 May 2022 08:36:35 +0000 (10:36 +0200)] 
Remove dependency on BF-CBC existance from test_ncp

The test_check_ncp_ciphers_list test assumed that BF-CBC is always
available, which is no longer the case with OpenSSL 3.0. Rewrite the
test to not rely on BF-CBC to be available.

This is a cherry-pick from c07f95f3

Patch V2: manually fix if condition. Somehow the git cherry-pick ended up
          with a broken if condition.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220513083635.2199131-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24346.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix allowing/showing unsupported ciphers and digests
Arne Schwabe [Thu, 12 May 2022 12:14:28 +0000 (14:14 +0200)] 
Fix allowing/showing unsupported ciphers and digests

This is a minimal version to hide the non-supported ciphers in these
show-cipher/show-digests listings. It also adds code to the kt_md_get/
kt_cipher_get functions to error out early instead of getting an ugly
backtrace with OpenSSL errors later when actually trying to use the
ciphers.

This allows make check to work again on with OpenSSL 3.0.

The changes are kept minimal to  avoid pulling in all the other refactoring
for OpenSSL 3.0.

This commit is partly cherry-picked from ab3f32b9.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-7-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24334.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd --with-openssl-engine autoconf option (auto|yes|no)
Arne Schwabe [Thu, 12 May 2022 12:14:27 +0000 (14:14 +0200)] 
Add --with-openssl-engine autoconf option (auto|yes|no)

This is a cherry-pick to release2.5 from 0df2261da. The OpenSSL engine
tests fail  otherwise and it is good to have the same behaviour as in
master/2.6

This allows to select engine support at configure time. For OpenSSL 1.1 the
default is not changed and we detect if engine support is available.

Engine support is deprecated in OpenSSL 3.0 and for OpenSSL 3.0 the default
is to disable engine support as engine support is deprecated and generates
compiler warnings which in turn also break -Werror.

By using --with-openssl-engine=no or --with-openssl-engine=yes engine
support can be forced on or off. If it is enabled but not detected an
error will be thown.

This commit cleans up the configure logic a bit and removes the
ENGINE_cleanup checks as we can just assume that it will be also
available as macro or function if the other engine functions are
available. Before the cleanup we would only check for the existance
of engine.h if ENGINE_cleanup was not found.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-6-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24332.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd macos OpenSSL 3.0 and ASAN builds
Arne Schwabe [Thu, 12 May 2022 12:14:26 +0000 (14:14 +0200)] 
Add macos OpenSSL 3.0 and ASAN builds

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-5-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24330.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd ubuntu 22.04 to Github Actions
Arne Schwabe [Thu, 12 May 2022 12:14:25 +0000 (14:14 +0200)] 
Add ubuntu 22.04 to Github Actions

This adds Ubuntu 22.04 to the Github actions. mbed TLS in 22.04 is still
old enough (2.28) to build with OpenVPN and GPL licensed.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-4-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24329.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAllow loading of non default providers
Arne Schwabe [Thu, 12 May 2022 12:14:24 +0000 (14:14 +0200)] 
Allow loading of non default providers

This allows OpenVPN to load non-default providers. This is mainly
useful for loading the legacy provider with --providers legacy default

Cherry-pick of 08081aa0a153 to release/2.5. Changes.rst has been adjust to
better fit the changes in 2.5.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24327.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoRefactor early initialisation and uninitialisation into methods
Arne Schwabe [Thu, 12 May 2022 12:14:23 +0000 (14:14 +0200)] 
Refactor early initialisation and uninitialisation into methods

This put the early initialisation and uninitialisation that needs to
happen between option parsing and post processing into small methods.

Cherry-pick of 97056dbf9 as prerequirement for the provider patch

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220512121429.2096164-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24328.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoFix M_ERRNO behavior on Windows
Lev Stipakov [Wed, 4 May 2022 09:13:05 +0000 (12:13 +0300)] 
Fix M_ERRNO behavior on Windows

We use M_ERRNO flag in logging to display error code
and error message. This has been broken on Windows,
where we use error code from GetLastError() and
error description from strerror(). strerror() expects
C runtime error code, which is quite different from
last error code from WinAPI call. As a result, we got
incorrect error description.

The ultimate fix would be introducing another flag
for WinAPI errors, like M_WINERR and use either that or
M_ERRNO depends on context. However, the change would be
quite intrusive and in some cases it is hard to say which
one to use without looking into internals.

Instead we stick to M_ERRNO and in Windows case we
first try to obtain error code from GetLastError() and
if it returns ERROR_SUCCESS (which is 0), we assume that
we have C runtime error and use errno. To get error
description we use strerror_win32() with GetLastError()
and strerror() with errno.

strerror_win32() uses FormatMessage() internally, which
is the right way to get WinAPI error description.

This commit is the backport of 54800aa975418fe3570f3206a5f9b277dc59bd47,
adjusted for the different code base related to socket errors (print
socket file descriptor) in x_check_status().

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20220504091305.434-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24274.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agovcpkg: switch to manifest
Lev Stipakov [Thu, 5 May 2022 12:42:05 +0000 (15:42 +0300)] 
vcpkg: switch to manifest

Add vcpkg manifest file which lists
dependencies and enable manifest usage in
project file.

This simplifies build process by eliminating
separate "vcpkg install" step to install dependencies.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220505124205.435-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24286.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoAdd insecure tls-cert-profile options
Arne Schwabe [Fri, 29 Oct 2021 11:24:07 +0000 (13:24 +0200)] 
Add insecure tls-cert-profile options

The recent deprecation of SHA1 certificates in OpenSSL 3.0 makes it
necessary to reallow them in certain deployments. Currently this works
by using the hack of using tls-cipher "DEFAULT:@SECLEVEL=0".

Add "insecure" as option to tls-cert-profile to allow setting a seclevel of 0.

Patch v4: fix default accidentially changed to insecure

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211029112407.2004234-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23076.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 23efeb7a0bd9e0a6d997ae6e77e0e04170da3e67)

3 years agovcpkg-ports/pkcs11-helper: bump to release 1.29
Marc Becker [Sat, 23 Apr 2022 13:57:04 +0000 (15:57 +0200)] 
vcpkg-ports/pkcs11-helper: bump to release 1.29

This release has merged win32 support patch,
so our own patch could be removed from the port.

Upstream archive format changed back to BZIP2.

Signed-off-by: Marc Becker <becm@gmx.de>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20220423135704.88164-1-becm@gmx.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24180.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 99e6b814edcdd522c97217e027bd24ed43661917)

3 years agoauth-pam.c: add missing include limits.h
Antonio Quartulli [Thu, 21 Apr 2022 13:19:09 +0000 (15:19 +0200)] 
auth-pam.c: add missing include limits.h

On most systems limits.h is pulled in by some other header and thus no
error is ever triggered, but it's possible to find the right environment
which lackis this and prevents compiling auth-pam.c (possibly when using
LibreSSL).

Include the header explicitly as it includes the definition of PATH_MAX.

(note that this bug is fixed in Gentoo since 2020 by including a custom
patch, but apparently the issue was never reported upstream)

Reported-by: Michelangelo Scopelliti <kernelpanic@gmx.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220421131909.32053-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24136.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 0fed64a91d894b46105bf7e8b16edea4d90ab70c)

3 years agot_net.sh: delete dummy iface using iproute command
Antonio Quartulli [Thu, 7 Apr 2022 08:15:55 +0000 (10:15 +0200)] 
t_net.sh: delete dummy iface using iproute command

A dummy interface cannot be deleted using --rmtun because openvpn tries
to send some ioctl (i.e. TUNSETPERSIST) which is not supported by this
device type. This results in the following error:

2022-04-07 09:59:29 Cannot ioctl TUNSETPERSIST(0) ovpn-dummy0: Bad file
descriptor (errno=9)
2022-04-07 09:59:29 Exiting due to fatal error

and the interface is not deleted.

Use iproute to generically delete an interface.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220407081555.25228-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24086.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 976e6caf0e161d3c787e1378cec44608c17b292a)

3 years agonetworking_iproute2: don't pass M_WARN to openvpn_execve_check()
Antonio Quartulli [Thu, 7 Apr 2022 20:14:11 +0000 (22:14 +0200)] 
networking_iproute2: don't pass M_WARN to openvpn_execve_check()

openvpn_execve_check() expects a set of flags as third argument and not
a loglevel. For this reason, if no FATAL behaviour is expected, we
should simply pass 0. openvpn_execve_check() will then pick the
appropriate loglevel on its own.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220407201411.22486-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24090.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 545f6bdea30e04a09b118c4e1faf6523544fd935)

3 years agovcpkg-ports: remove openssl port
Lev Stipakov [Thu, 17 Mar 2022 13:57:28 +0000 (15:57 +0200)] 
vcpkg-ports: remove openssl port

We've added functionality to openvpn-build

  f83f21ef "windows-msi: add ability to specify port overlays in
  openvpn-build"

(which is used for release building) to use overlay ports, which
enables us to build releases with updated ports (like openssl)
without making changes to openvpn repo. This means that openssl port
overlay from this repo could be removed.

Developers can still use openvpn repo for Windows development and
use whatever openssl version is provided by vcpkg official repo. When
we need to build a release and the latest openssl is not there, we add
port overlay to openvpn-build.

While on it, bump vcpkg commit id in github actions.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220317135728.183-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23993.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agotapctl: Resolve MSVC C4996 warnings
Simon Rozman [Mon, 22 Mar 2021 07:43:59 +0000 (08:43 +0100)] 
tapctl: Resolve MSVC C4996 warnings

wcsncat() was declared unsafe in favour of wcsncat_s(). However, the
string concatenation follows the string length check, making wcsncat()
safe too. Code analysis is just not smart enough (yet) to detect this.

The code was refactored to use wcscat_s() MSVC is considering as "safe".

Signed-off-by: Simon Rozman <simon@rozman.si>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210322074359.527-1-simon@rozman.si>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21774.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e5e9a07e8baee4065b7dfd65736bfa77b8329cfc)

3 years agomsvc: adjust build options to harden binaries
Lev Stipakov [Fri, 18 Feb 2022 23:52:55 +0000 (01:52 +0200)] 
msvc: adjust build options to harden binaries

 - enable hardware-enforced stack protection on
compatible hardware/software (/CETCOMPAT linker option)

 - hash object files with SHA256 (/ZH:SHA_256 compiler option)

 - enable SDL. The required to add

    _CRT_NONSTDC_NO_DEPRECATE
    _CRT_SECURE_NO_WARNINGS
    _WINSOCK_DEPRECATED_NO_WARNINGS

preprocessor definitions. I don't feel like replacing strdup (which is
correct POSIX function) and inet_ntoa (we always pass IPv4 address to
it, inet_ntop will make code more complex)

Above issues were discovered by bitskim.

Before applying this patch, this one must be applied from master:

https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21774.h
tml

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220218235255.334-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23852.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agonetworking: use OPENVPN_ETH_ALEN instead of ETH_ALEN
Antonio Quartulli [Wed, 23 Feb 2022 08:06:28 +0000 (09:06 +0100)] 
networking: use OPENVPN_ETH_ALEN instead of ETH_ALEN

With the introduction of SITNL two occurrences of ETH_ALEN
were introduced in the code. This define exists on Linux in
the linux/if_ether.h header, however the latter is included
in linux/if_tun.h which may or may not exist (depending on
how old your system is).

If the system lacks if_tun.h then the compilation fails because
ETH_ALEN cannot be found.

For this reason, swap ETH_ALEN with OPENVPN_ETH_ALEN which is
already used in other places of the code.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220223080628.4773-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23882.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 8d487b4cc5b896cff5277adef6dd491b5918381f)

3 years agovcpkg-ports\pkcs11-helper: shorten patch filename
Lev Stipakov [Wed, 16 Mar 2022 13:54:11 +0000 (15:54 +0200)] 
vcpkg-ports\pkcs11-helper: shorten patch filename

"make dist" uses 'tar -o' which breaks on long filenames:

  tar:

openvpn-2.5.6/contrib/vcpkg-ports/pkcs11-helper/0003-config-w32-vc.h.in-ind
icate-OpenSSL-EC-support.patch:
  file name is too long (max 99); not dumped
  tar: Exiting with failure status due to previous errors

and then "make dist" continues.

Make filename shorter to make tar happy.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220316135411.217-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23977.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2047522286f179cac09bd7615bf845d67a5dc1c8)

3 years agoPreparing release 2.5.6 v2.5.6
Gert Doering [Tue, 15 Mar 2022 19:25:30 +0000 (20:25 +0100)] 
Preparing release 2.5.6

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agovcpkg-ports: add openssl 1.1.1n
Lev Stipakov [Wed, 16 Mar 2022 08:09:12 +0000 (10:09 +0200)] 
vcpkg-ports: add openssl 1.1.1n

Since vcpkg official repo doesn't have openssl 1.1.1n yet,
add own port - just copy files from vcpkg\ports\openssl (excluding
unix and uwp directories) and replace 1.1.1m with 1.1.1n, not
forgetting about SHA512.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220316080912.118-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23972.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoplug-ins: Disallow multiple deferred authentication plug-ins
David Sommerseth [Sun, 13 Mar 2022 19:31:53 +0000 (20:31 +0100)] 
plug-ins: Disallow multiple deferred authentication plug-ins

The plug-in API in OpenVPN 2.x is not designed for running multiple
deferred authentication processes in parallel. The authentication
results of such configurations are not to be trusted.  For now we bail
out when this is discovered with an error in the log.

CVE: 2022-0547
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20220313193154.9350-3-openvpn@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23931.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 282ddbac54f8d4923844f69983b38dd2b813a00a)

3 years agosample-plugin: New plugin for testing multiple auth plugins
David Sommerseth [Sun, 13 Mar 2022 19:31:52 +0000 (20:31 +0100)] 
sample-plugin: New plugin for testing multiple auth plugins

This plugin allows setting username/passwords as well as configure
deferred authentication behaviour as part of the runtime initialization.

With this plug-in it is easier to test various scenarios where multiple
authentication plug-ins are active on the server side.

A test documentation was also added to describe various test cases and
the expected results.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20220313193154.9350-2-openvpn@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23932.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 79a111c7e16d157278495cb5f4c52eab2229b68e)

3 years agovcpkg-ports/pkcs11-helper: adapt to new upstream URL
Lev Stipakov [Mon, 14 Mar 2022 12:03:34 +0000 (14:03 +0200)] 
vcpkg-ports/pkcs11-helper: adapt to new upstream URL

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220314120334.231-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23940.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit fd567aa0ef71afc0788b97341e88f59406c8f7df)

3 years agoremove unused sitnl.h file
Antonio Quartulli [Mon, 14 Mar 2022 16:20:48 +0000 (17:20 +0100)] 
remove unused sitnl.h file

sitnl.h must have slipped in when implementing the networking AI and the
SITNL backend. However it is unused and should simply be removed.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20220314162048.22955-1-a@unstable.cc>
URL: https://www.mail-archive.com/search?l=mid&q=20220314162048.22955-1-a@unstable.cc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c697febbc2f445981a6042bb8deb9ed49beb5b73)

3 years agoFix --mtu-disc maybe|yes on Linux.
Gert Doering [Tue, 22 Feb 2022 11:38:32 +0000 (12:38 +0100)] 
Fix --mtu-disc maybe|yes on Linux.

--mtu-disc (on Linux) needs two components to work:
   - setsockopt() with IP_MTU_DISCOVER or IPV6_MTU_DISCOVER
   - "extended error reporting" (setsockopt(IP_RECVERR) and
     then via mtu.c/format_extended_socket_error()) to react on
     "packet too big" errors on sendto() / sendmsg()

Some configure.ac reorganization broke detection of <linux/errqueue.h>
and "struct sock_extended_err".  Re-add <linux/errqueue.h> to configure.ac,
remove all the other conditionals in syshead.h, and remove the
"struct sock_extended_err" check completely (assumption: if errqueue.h
exists, it contains what we need).

Thus, the "non-helpful" socket error message turns into:

2022-02-22 12:31:42 write UDPv4 [EMSGSIZE Path-MTU=800]: Message too long (fd=3,code=90)
2022-02-22 12:31:42 Note adjusting 'mssfix 1400 mtu' to 'mssfix 800 mtu' according to path MTU discovery
2022-02-22 12:31:42 Note adjusting 'fragment 1400 mtu' to 'fragment 800 mtu' according to path MTU discovery

... while at it, fix extra space in first part of these messages, and
print o->ce.fragment for the "fragment" message...

v2: assume that "if it's linux, and has these two headers, everything
else will be there as well" and get rid of most of the #ifdef checks

Trac: #1452

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220222113832.13383-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23863.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4225114b96723bdecd68398f7a89765879b31b5d)

3 years agoCI: github actions: keep "pdb" in artifacts
Ilya Shipitsin [Thu, 26 Aug 2021 10:02:21 +0000 (15:02 +0500)] 
CI: github actions: keep "pdb" in artifacts

"pdb" files are important for example, for BinSkim analysis. Let us
keep them

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210826100221.1378-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22769.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 9da733751ce80b2226ef19923365bd3102cfbd47)

3 years agovcpkg: link lzo statically
Lev Stipakov [Wed, 16 Feb 2022 13:42:27 +0000 (15:42 +0200)] 
vcpkg: link lzo statically

Having .dll for a single executable doesn't make
much sense. Static linking removes 117kb .dll
and grows .exe size by only 4kb.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220216134227.147-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23807.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit cac1ebd859e9d60642d2375a2c0bdacac35ca12c)

3 years agodoc/options: clean up documentation for --proto and related options
Frank Lichtenheld [Tue, 15 Feb 2022 14:54:25 +0000 (15:54 +0100)] 
doc/options: clean up documentation for --proto and related options

The family specific options were generally omitted.

Cc: David Sommerseth <openvpn@sf.lists.topphemmelig.net>
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20220215145425.1989-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23798.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit ba9a07a69db3ddb63fceac05b92a000d9b1c805e)

3 years agodoc/Makefile: rebuild rst docs if input files change
Frank Lichtenheld [Thu, 10 Feb 2022 10:44:45 +0000 (11:44 +0100)] 
doc/Makefile: rebuild rst docs if input files change

For now the dependencies are statically defined, which
should be fine and is still a much better solution than
to have no dependencies.

Also delete empty example-fingerprint.rst.

(cherry picked from commit 529cc6a52fc45a1a67abb5c91819ba4fb2f631e3)
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by:
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220210104445.16767-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23747.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agomsvc: cleanup
Lev Stipakov [Tue, 8 Feb 2022 11:49:05 +0000 (13:49 +0200)] 
msvc: cleanup

Remove unused macros for dependency directories,
since dependencies are handled by vcpkg.

Remove unused .bat files.

Reported-by: Frank Lichtenheld <frank@lichtenheld.com>
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220208114905.100-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23730.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit ff5723c4ddfee28564500d28a1bd78766171ea3e)

3 years agoRepair --inactive with 'bytes' argument larger 2Gbytes.
Gert Doering [Fri, 4 Feb 2022 11:42:01 +0000 (12:42 +0100)] 
Repair --inactive with 'bytes' argument larger 2Gbytes.

--inactive has an optional 2nd parameter specifiying the number of
bytes that need to be sent/received in the given time window.  This
was parsed with atoi(), stored in an 32bit int.  atoi() overflows at
2Gbyte (signed int), which makes gcc return "0" and MSVC "2^31-1"
for the value reported in the ticket (10G) - so on gcc, this was
behaving like "not set", while windows builds after 2.5.4 honoured
this setting, and aborted (unexpectedly) due to "not enough traffic".

Fix by increasing word length of all involved variables to int64_t.

While add it, add option printer SHOW_LONG(), and print variable.

This has the potential to break existing setups where this value is
set unreasonably high, thus "impossible to achieve in the interval",
but which was never noticed before due to "overflow, 0, ignored".
Thus, print WARNING if a value >INT_MAX (2Gbyte) is configured.

v2: use atoll(), as atol() is limited to INT_MAX on MSVC, and PRi64
for format string.  Rename SHOW_LONG() to SHOW_INT64().

Trac: #1448

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20220204114201.5632-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23720.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit cae1a7fcf14e6ded34ab5a1e8842c3034cc89608)

3 years agokeyingmaterialexporter.c: include strings.h
Antonio Quartulli [Thu, 3 Feb 2022 08:26:20 +0000 (09:26 +0100)] 
keyingmaterialexporter.c: include strings.h

strcasecmp() was initially declared in string.h and subsequently moved
to strings.h. For historical reasons it still exists in string.h, but
would require _DEFAULT_SOURCE to be defined.

Due to the above, just include strings.h as currently dictated by the
manpage.

Fixes the following warning:

keying-material-exporter-demo/keyingmaterialexporter.c:155:14: warning:
implicit declaration of function  strncasecmp’; did you mean ‘strncmp’?
[-Wimplicit-function-declaration]
  155 |         if (!strncasecmp(objbuf, "CN", 2))
      |              ^~~~~~~~~~~
      |              strncmp

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220203082620.8186-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23702.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d93a2b6160759d42d3fbaecc7fc868a7120221ef)

3 years agoupdate copyright year to 2022
Antonio Quartulli [Wed, 26 Jan 2022 12:43:29 +0000 (13:43 +0100)] 
update copyright year to 2022

Cc: David Sommerseth <davids@openvpn.net>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220126124329.14784-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23663.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoGitHub Actions: update script to same version as master
Antonio Quartulli [Fri, 21 Jan 2022 20:49:33 +0000 (21:49 +0100)] 
GitHub Actions: update script to same version as master

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220121204933.591-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23634.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agovcpkg-ports/pkcs11-helper: indicate OpenSSL EC support
Lev Stipakov [Tue, 11 Jan 2022 15:06:47 +0000 (17:06 +0200)] 
vcpkg-ports/pkcs11-helper: indicate OpenSSL EC support

We always build with OpenSSL >= 1.1.1, which has EC support.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220111150647.267-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23527.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 95b076144933e04782c031182669523dab457f15)

3 years agovcpkg-ports/pkcs11-helper: bump to release 1.28
Lev Stipakov [Tue, 11 Jan 2022 15:06:05 +0000 (17:06 +0200)] 
vcpkg-ports/pkcs11-helper: bump to release 1.28

This release has merged openssl 1.1.1 support patch,
so our own patch could be removed from the port.

Remove unconditional /release flag, which is added by vcpkg
for release builds. Having this flag unconditionally breaks vcpkg
debug builds.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220111150605.208-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23526.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit bced08530c011fc9ea2b736938e0ca2199a45e1b)

3 years agoauth_token.c: add NULL initialization
Lev Stipakov [Fri, 7 Jan 2022 12:35:50 +0000 (14:35 +0200)] 
auth_token.c: add NULL initialization

This fixes

  error C4703: potentially uninitialized local pointer variable
'b64output' used

found by arm64 msvc compiler with SDL enabled.

Not sure why this is not triggered on x86/x64.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20220107123550.188-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23511.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4b6073b8253dafeb425361fb55bab0f2cdc5474f)

3 years agofix Changes.rst errors in 2.5.3 and 2.5.5 announcement
Gert Doering [Mon, 27 Dec 2021 20:16:16 +0000 (21:16 +0100)] 
fix Changes.rst errors in 2.5.3 and 2.5.5 announcement

- 2.5.3 had a typo in the CVE ID (CVE-2121-3606 should be -2021-)
- 2.5.5 had windows paths with backslashes, which need to be doubled

(CVE ID typo also reported by "@attritionorg" in Github PR 165)

v2: SSL -> ssl, and .cfg -> .cnf

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20211227201616.13315-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/search?l=mid&q=20211227201616.13315-1-gert@greenie.muc.de
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoPreparing release 2.5.5 v2.5.5
Gert Doering [Tue, 14 Dec 2021 14:51:40 +0000 (15:51 +0100)] 
Preparing release 2.5.5

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoMove deprecation of SWEET32/64bit block size ciphers to 2.7
Arne Schwabe [Mon, 13 Dec 2021 15:09:50 +0000 (16:09 +0100)] 
Move deprecation of SWEET32/64bit block size ciphers to 2.7

We originally wanted to deprecated these ciphers (especially BF-CBC) with
2.6 but currently these ciphers are still too widespread to make this
transition for 2.6.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213150950.3993881-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23402.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7f2d7dbf986fd7233eabb250b35bf7c3112d3e37)

3 years agoconfig-msvc.h: indicate key material export support
Lev Stipakov [Mon, 13 Dec 2021 13:58:14 +0000 (15:58 +0200)] 
config-msvc.h: indicate key material export support

MSVC build uses OpenSSL from vcpkg, which at the moment
is 1.1.1l. Key material export was added to 1.1.1, so it is safe
to indicate its support unconditionally.

2.5 does not have tls-ekm yet, but it has the generic keying material
exporter framework, which was only enabled in MinGW builds.  Fix.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211213135814.265-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23395.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoadd test case(s) to notice 'openvpn --show-cipher' crashing
Gert Doering [Fri, 10 Dec 2021 16:55:43 +0000 (17:55 +0100)] 
add test case(s) to notice 'openvpn --show-cipher' crashing

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20211210165543.77587-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23381.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b08b5f5df96dbe7d854a2fbbeb8a3e104e3158e2)

3 years agoMove '--push-peer-info' documentation from 'server' to 'client options'
Gert Doering [Tue, 7 Dec 2021 13:04:36 +0000 (14:04 +0100)] 
Move '--push-peer-info' documentation from 'server' to 'client options'

While --push-peer-info can be configured on the server, it's not really
intended for that, and it ended in the "SERVER OPTIONS" section by
mishap.  Fix that.

Reported-by: Stella Ashburne <rewefie@gmx.com>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20211207130436.22187-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23325.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 883cd6f4031ef9920580f0862594acbb45e4b0b8)

3 years agoAdd argv_insert_head__empty_argv__head_only to argv tests
Arne Schwabe [Wed, 8 Dec 2021 17:06:14 +0000 (18:06 +0100)] 
Add argv_insert_head__empty_argv__head_only to argv tests

The unit test argv_insert_head__empty_argv__head_only was defined
but never used. Add it to the array of unit tests.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211208170614.3404821-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23359.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit cc39fc7f3bddc6567507406cf8a389418e101bf8)

3 years agoDefine have_blowfish variable in ncp unit tests
Max Fillinger [Wed, 8 Dec 2021 14:41:01 +0000 (15:41 +0100)] 
Define have_blowfish variable in ncp unit tests

The previous commit was backported from master and needs this variable
to exist.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211208144101.19166-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23356.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoDon't use BF-CBC in unit tests if we don't have it
Max Fillinger [Wed, 8 Dec 2021 13:46:55 +0000 (14:46 +0100)] 
Don't use BF-CBC in unit tests if we don't have it

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211208134655.28905-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23354.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 0e075c0e1b7b1d55a837d98b7a6c2bc8c7d65375)

3 years agovcpkg/pkcs11-helper: compatibility with latest vcpkg
Lev Stipakov [Wed, 24 Nov 2021 10:08:38 +0000 (12:08 +0200)] 
vcpkg/pkcs11-helper: compatibility with latest vcpkg

Starting from commit 21b2dbd3 "[scripts-audit] nmake buildsystem"
vcpkg has removed NO_DEBUG support from nmake buildsystem
and now builds debug variant unconditionally. Debug flags contradict
build options hardcoded in pkcs11 nmake script (like /O2).

Remove hardcoded release options and other options which
are (also) set by vcpkg nmake buildsystem.

Bump vcpkg commit in GitHub actions.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211124100838.861-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23253.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e832658a6d7a78c97fc53a78faeda31419583529)

3 years agossh_openssl.h: remove unused declaration
Lev Stipakov [Wed, 1 Dec 2021 09:20:02 +0000 (11:20 +0200)] 
ssh_openssl.h: remove unused declaration

Commit 95993a1df3 ("Refactored SSL initialisation functions")
has declared openssl_set_mydata_index(void) function but
hasn't added definition.

There hasn't been need in this function for 10 years,
so it can be safely removed.

Found by MSVC.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211201092002.162-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23269.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b939fdcfb669bdd57b33e70fd2a2718fcfa626c9)

3 years agoring_buffer.h: fix GCC warning about unused function
Lev Stipakov [Wed, 24 Nov 2021 16:03:47 +0000 (18:03 +0200)] 
ring_buffer.h: fix GCC warning about unused function

With register_ring_buffers() being declared as "static" in header file,
all translation units, which include that header, got a copy of that
function.
This causes GCC warning

  warning: "register_ring_buffers" defined but not used [-Wunused-function]

when compiling C files which include header, but don't use function.

Add "inline" keyword to silence this warning.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211124160347.1245-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23260.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 71371f04afa6eba3ea02a67590a70e018cf203e5)

3 years agoBUILD: enable CFG and Spectre mitigation for MSVC
Ilya Shipitsin [Wed, 22 Sep 2021 09:57:55 +0000 (14:57 +0500)] 
BUILD: enable CFG and Spectre mitigation for MSVC

found by BinSkim

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210922095756.1929-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22870.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e80e36d75538abff0661b21392f541d946be6d29)

3 years agoLoad OpenSSL config on Windows from trusted location
Lev Stipakov [Fri, 19 Nov 2021 01:55:48 +0000 (03:55 +0200)] 
Load OpenSSL config on Windows from trusted location

Commits

 - 92535b6 ("contrib/vcpkg-ports: add openssl port with
             --no-autoload-config option set (CVE-2121-3606)")
 - 447cfb4 ("crypto_openssl.c: disable explicit initialization on Windows
             (CVE-2121-3606)")

disabled OpenSSL config loading functionality, which could be
exploited by loading config from untrusted locations.

This feature might be useful for some users. This brings it back
and sets OpenSSL enviroment variables

 OPENSSL_CONF, OPENSSL_ENGINES, OPENSSL_MODULES

which are used to load config, engines and modules, to a trusted location.
The location is constructed based on installation path, read from registry
on startup.
If installation path cannot be read, Windows\System32 is used as a
fallback.

While on it, remove unused "bool impersonate_as_system();" declaration.

Trac: #1296

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20211119015548.687-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23248.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 23e6aaef149bd31a7e80af28ee1e3658d2810d4f)

3 years agodoc/man (vpn-network-options): fix foreign_option_{n} typo
Todd Zullinger [Mon, 22 Nov 2021 11:41:04 +0000 (12:41 +0100)] 
doc/man (vpn-network-options): fix foreign_option_{n} typo

In 2da29362 (Improve the documentation for --dhcp-option, 2020-08-16),
`foreign_option_{n}` became plural between the first and second versions
of the patch.  Correct it.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211122114104.4814-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23217.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit aee54a47142c13a29c2b59142e944fd448a406d9)

3 years agoUpdate IRC information in CONTRIBUTING.rst
Todd Zullinger [Mon, 22 Nov 2021 11:40:18 +0000 (12:40 +0100)] 
Update IRC information in CONTRIBUTING.rst

The developer IRC channel is now on libera.chat.  Update
CONTRIBUTING.rst to match the wiki.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211122114018.4708-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23218.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 072dabdb1bbc53b422929d33dc6c51ff6457d4e4)

3 years agodoc link-options.rst: Use free open-source dynamic-DNS provider URL
Richard T Bonhomme [Wed, 3 Nov 2021 20:20:14 +0000 (20:20 +0000)] 
doc link-options.rst: Use free open-source dynamic-DNS provider URL

Trac: #1417

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211103202014.1121244-2-tincantech@protonmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23095.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2c2e13d9ecdd1364c6a05ad77cea2840c015aa56)

3 years agoInclude --push-remove in the output of --help.
Gert Doering [Wed, 17 Nov 2021 06:44:42 +0000 (07:44 +0100)] 
Include --push-remove in the output of --help.

"push-remove" has been in OpenVPN since 2.4, but managed to stay hidden
from the "--help" output.  Add.

Reported-by: mike tancsa <mike@sentex.net>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20211117064442.15899-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23194.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2a555c3aafcc8cf238a803d25971938ed75b518d)