]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
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)

3 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)

3 years agoUse network address for emulated DHCP server as a default
Lev Stipakov [Tue, 9 Nov 2021 01:59:27 +0000 (03:59 +0200)] 
Use network address for emulated DHCP server as a default

This is the rebase of original Selva Nair's patch
which hasn't been merged:

  https://sourceforge.net/p/openvpn/mailman/message/34674818/

and documentation change to reflect code changes, which
is basically a revert of another Selva's patch (which got merged):

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

For subnet topology use "offset 0" as default for
calculating DHCP server address, which makes it equal
to the network address.

There is no know reason why non-zero default offset
is needed. Besides, offset -1 breaks subnet /30 case,
which in some cases is pushed by OpenVPN Cloud product.

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

3 years agoFix error in example firewall.sh script
Adrian [Sun, 7 Nov 2021 17:40:00 +0000 (18:40 +0100)] 
Fix error in example firewall.sh script

The man page says:
[!] -s, --source address[/mask][,...]

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

3 years agoREADME.down-root: Fix plugin module name
Ville Skyttä [Sun, 7 Nov 2021 18:38:05 +0000 (19:38 +0100)] 
README.down-root: Fix plugin module name

The module name is openvpn-plugin-down-root.so, not openvpn-down-root.so.

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

3 years agoresolvconf fails with -p
Sergio E. Nemirowski [Sat, 29 May 2021 01:35:16 +0000 (04:35 +0300)] 
resolvconf fails with -p

resolvconf -p
resolvconf: Error: Command not recognized

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20210529013516.767555-1-sergio@outerface.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22467.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e739f41d05084c1bc9bfb6c5d49c74de37e53dc7)

3 years agoRequire EC key support in Windows builds
Selva Nair [Tue, 19 Oct 2021 16:50:53 +0000 (12:50 -0400)] 
Require EC key support in Windows builds

Do not support the use of OPENSSL_NO_EC on Windows.

We build Windows releases with EC key support enabled in
OpenSSL and there is no reason to disable it in OpenVPN.

ECDSA signature for cryptoapicert is handled only with OpenSSL
1.1.0 or later. That restriction is retained.

Same as commit ec9f698 in 2.6, except for context changes.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019165053.26345-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22968.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoEnsure the current common_name is in the environment for scripts
Selva Nair [Sat, 23 Oct 2021 00:07:06 +0000 (20:07 -0400)] 
Ensure the current common_name is in the environment for scripts

When username-as-common-name is in effect, the common_name
is "CN" from the certificate for auth-user-pass-verify. It gets
changed to "username" after successful authentication. This
changed value gets into the env when client-connect script is
called.

However, "common_name" goes through the cycle of being
"CN", then "username" during every reauth (renegotiation).
As the client-connect script is not called during reneg, the changed
value never gets back into the env. The end result is that the
disconnect script gets "common_name=<CN>" instead of the username.
Unless no reneg steps have happened before disconnect.
(For a more detailed analysis see
https://community.openvpn.net/openvpn/ticket/1434#comment:12)

Fix by adding common_name to env whenever it changes.

Trac: #1434
Very likely applies to #160 as well, but that's too old and
some of the relevant code path has evolved since then.

Same as commit fa5ab2438a in master, except for the context change
due to PF.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211023000706.25016-2-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23050.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoGitHub Actions: use latest working lukka/run-vcpkg
Lev Stipakov [Fri, 15 Oct 2021 20:38:47 +0000 (23:38 +0300)] 
GitHub Actions: use latest working lukka/run-vcpkg

Latest lukka/run-vcpkg@v10 seem to break non-manifest
mode with custom triplets, so revert to latest working version.

While on it, bump vcpkg commit.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211015203847.465-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22959.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agocontrib/vcpkg-ports: remove openssl port
Lev Stipakov [Mon, 28 Jun 2021 08:08:32 +0000 (11:08 +0300)] 
contrib/vcpkg-ports: remove openssl port

MSFT has merged PR to vcpkg which
added OPENSSL_NO_AUTOLOAD_CONFIG option

  https://github.com/microsoft/vcpkg/pull/18389

This means that we don't need to have our own openssl port
and instead we just add

  set(OPENSSL_NO_AUTOLOAD_CONFIG ON)

to our custom triplets.

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

3 years agoFix some more wrong defines in config-msvc.h
Selva Nair [Fri, 15 Oct 2021 18:47:33 +0000 (14:47 -0400)] 
Fix some more wrong defines in config-msvc.h

Not sure where these came from, but here goes:

S_IRUSR = 0 --> _S_IREAD
S_IWUSR = 0 --> _S_IWRITE

ENABLE_DEBUG is on, but I do not think we want it in production build
(removed).

S_IRGRP is not defined but seems to be used. I have added it, remove if
not required.
This define is based on mingw and matches MS docs on <filesystem>
(https://docs.microsoft.com/en-us/cpp/standard-library/filesystem-enumerati
ons?view=msvc-160)

Trac: #1430

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20211015184733.16988-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22943.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoconfig-msvc.h: fix OpenSSL-related defines
Lev Stipakov [Wed, 13 Oct 2021 23:04:42 +0000 (02:04 +0300)] 
config-msvc.h: fix OpenSSL-related defines

Commit 2778443 ("msvc: OpenSSL 1.1.x support") added OpenSSL-related
defines to config-msvc.h, which in Linux/MinGW are set during configure
step.

Turns out that OPENSSL_NO_EC was added by mistake - it breaks loading EC
keys. Also few others were missing.

Compare with MinGW-generated config.h, which uses the same OpenSSL version.
Remove unneeded defines and add missing ones.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211013230442.305-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22933.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agomsvc: add missing header to project file
Lev Stipakov [Wed, 13 Oct 2021 23:04:17 +0000 (02:04 +0300)] 
msvc: add missing header to project file

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211013230417.252-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22932.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agomsvc: fix product version display
Lev Stipakov [Wed, 13 Oct 2021 23:02:27 +0000 (02:02 +0300)] 
msvc: fix product version display

PRODUCT_VERSION_PATCH, defined in version.m4, already includes dot (like
".4"),
so no need to include it here.

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

3 years agoconfigure: remove useless -Wno-* from default CFLAGS
Antonio Quartulli [Tue, 5 Oct 2021 12:27:36 +0000 (14:27 +0200)] 
configure: remove useless -Wno-* from default CFLAGS

Historically we always had -Wno-unused-parameter and
-Wno-unused-function enabled along with -Wall.

When we made -Wall a default option, we carried the other two along and
made them default too (in 2018).

Now the code is much cleaner compared to the past and we do not really
require -Wno-unused-parameter and -Wno-unused-function anymore.

Actually they may hide really unused functions that we'd need to
cleanup.

For this reason remove -Wno-unused-parameter and -Wno-unused-function
for good from the default CFLAGS.

Any new warning should rather be fixed than hidden.

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

3 years agoFix loading PKCS12 files on Windows
Lev Stipakov [Wed, 6 Oct 2021 09:07:09 +0000 (12:07 +0300)] 
Fix loading PKCS12 files on Windows

Starting from 2.5.4 we have switched to MSVC builds,
including dependencies such as OpenSSL.

When we link with natively-built OpenSSL .DLLs
(not cross compiled with MinGW), we are expected to include
applink.c, which provides glue between OpenSSL BIO layer
and compiler run-time. This doesn't apply to ARM64.

Failure to do that results in "no OPENSSL_Applink" fatal error
when calling, for example, d2i_PKCS12_fp(), which we do when
loading PKCS12 files.

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

3 years agoPreparing release 2.5.4 v2.5.4
Gert Doering [Mon, 4 Oct 2021 11:01:33 +0000 (13:01 +0200)] 
Preparing release 2.5.4

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 years agoGitHub Actions: remove Ubuntu 16.04 environment
Lev Stipakov [Sun, 26 Sep 2021 06:10:46 +0000 (09:10 +0300)] 
GitHub Actions: remove Ubuntu 16.04 environment

Starting from 20th of September, GitHub has removed Ubuntu 16.04
environment from Actions. Safely remove it from our build script
where we already have Ubuntu 18.04 and 20.04.

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

3 years agonetworking: add networking API net_addr_ll_set() and use it on Linux
Antonio Quartulli [Fri, 3 Sep 2021 16:11:12 +0000 (18:11 +0200)] 
networking: add networking API net_addr_ll_set() and use it on Linux

When running in TAP mode we may need to set the LL address of the
interface, if requested by the user.

This operation was overlooked when implementing the networking API and
it still relies on iproute/net-tools being installed.

Basically this means that when compiling OpenVPN on a system without
iproute2/net-tools and the user uses the "lladdr" config directive,
OpenVPN will fail to se the LL address of the interface.

With this patch a new API is introduced, it is implemented for both
SITNL and iproute2 backends, and called on Linux (this is a combination
of three patches in master).

Reported-by: Jan Hugo Prins <jprins@betterbe.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Tested-by: Jan Hugo Prins <jprins@betterbe.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210903161113.30498-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22792.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 98f524cbd58d24d09dee26160d7386d710c3564f)
(cherry picked from commit cb5d29461e6e734a2250b984b8423d39f7b9ddaa)
(cherry picked from commit 7205cdd8508be0ec9a83ea2e012e2a495157cad0)

3 years agoAdd building man page on Windows
Lev Stipakov [Wed, 25 Aug 2021 16:47:52 +0000 (19:47 +0300)] 
Add building man page on Windows

Use rst2html to build html from rst. Ignore errors,
this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html
and add html man page to artifacts.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Message-Id: <20210825164752.808-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22771.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d814581a9375713a0a4d70f751f84e750a5d661a)

3 years agoconfigure: search also for rst2{man, html}.py
Antonio Quartulli [Fri, 27 Aug 2021 14:48:07 +0000 (16:48 +0200)] 
configure: search also for rst2{man, html}.py

On some systems the rst2{man,html} executables may have a slightly
different name, like rst2{man,html}.py.

Add this name variation to the Generic Programs check.

This specific variation is found on Gentoo Linux.

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

3 years agoroute.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED
Antonio Quartulli [Thu, 26 Aug 2021 06:17:25 +0000 (08:17 +0200)] 
route.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED

IN6_IS_ADDR_UNSPECIFIED on most systems is defined as a macro that
expects a struct in6_addr* argument.

In one instance we are passing the right address but using a wrong type.
Fix this invocation by properly passing the right pointer.

This issue might become more critical on systems implementing
IN6_IS_ADDR_UNSPECIFIED as a function rather than a macro.

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

3 years agoMinor doc correction: tls-crypt-v2 key generation
Selva Nair [Sun, 22 Aug 2021 15:28:20 +0000 (11:28 -0400)] 
Minor doc correction: tls-crypt-v2 key generation

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

4 years agoFix argv leaks in add_route() and add_route_ipv6()
David Korczynski [Wed, 14 Jul 2021 16:25:33 +0000 (17:25 +0100)] 
Fix argv leaks in add_route() and add_route_ipv6()

If a route structure is passed to add_route() or add_route_ipv6()
without the RT_DEFINED flag set, both functions leak an "argv"
structure allocation.

Add appropriate argv_free() calls.

Signed-off-by: David Korczynski <david@adalogics.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210714162533.10098-1-david@adalogics.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22637.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a11bea18b1c93b260352ec505db15be0ec9431ee)

4 years agoman: Clarify IV_HWADDR
David Sommerseth [Fri, 9 Jul 2021 13:48:49 +0000 (15:48 +0200)] 
man: Clarify IV_HWADDR

The IV_HWADDR description was only partially correct, as there are more
implementations using other values than the MAC address of the default
gateway.

The intention of this value is to provide a unique identifier of the
client and on some platforms this is not possible to retrieve other than
to generate this information.

The 64 bytes limitation is an arbitrary value, it is not enforced by
OpenVPN 2.x.  But it was considered a good idea to at least have some
reasonable upper limit of how long this string can be, at least for
those implementing support for this information.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210709134849.161728-1-openvpn@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22625.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 51d85a9d287f44c373eaa514c6a52e1078c27c43)

4 years agoUpdate Fox e-mail address in copyright notices
Max Fillinger [Thu, 1 Jul 2021 17:14:58 +0000 (19:14 +0200)] 
Update Fox e-mail address in copyright notices

Replace openvpn@fox-it.com with openvpn@foxcrypto.com.

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

4 years agodoc: Use generic rules for man/html generation
David Sommerseth [Wed, 30 Jun 2021 18:51:34 +0000 (20:51 +0200)] 
doc: Use generic rules for man/html generation

Prior to this patch, the Makefile.am needs to be modified multiple
places to add a new man or HTML page to be generated.  Since it is not
too often we modify this, it is easy to miss these finer details.

This changes the man and HTML generator rules to be more generic and use
variables as many places as possible.  Also moved all the lines which
should not need to be changed as much towards the bottom-half of the
file.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210630185134.144826-1-openvpn@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22604.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 37cf98fa224a2ae5fc5cfa380bdb291e90d6413d)

4 years agoMove examples into openvpn-examples(5) man page
Arne Schwabe [Thu, 20 May 2021 15:09:31 +0000 (17:09 +0200)] 
Move examples into openvpn-examples(5) man page

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

4 years agoFix console prompts with redirected log
Lev Stipakov [Fri, 25 Jun 2021 01:04:05 +0000 (04:04 +0300)] 
Fix console prompts with redirected log

When openvpn needs to prompt user for a password
(for example, to set management interface password),
the prompt is written to standard error device.

When log is redirected to a file, that prompt is written
to that file and not to the "original" stderr. Moreover, on recent
Insider build (21390.2025) openvpn exits with fatal error

  get_console_input_win32(): unexpected error: No such device or address
  (errno=6)

while attempting to write that prompt.

When redirecting stdout/stderr, we use _dup2() to associate stderr
descriptor with a log file. This call closes file associated
with stderr descriptor, which might explain why it has stopped
working (original stderr is closed and WriteFile() fails) and on
older versions it appears to work "by accident" - not failing
but use redirected stderr instead of original one.

Fix by creating new file descriptor with _dup() for stderr
before redirect and use this descriptor for writing prompts.

While on it, make code a bit more C99-ish by moving variables
declaration from the beginning of the scope to the actual
initialisation.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210625010405.224-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=20210625010405.224-1-lstipakov@gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 480e4cc14ff34fac72406ab1dd66290a91cc09f0)

4 years agoAdd error reporting to get_console_input_win32().
Gert Doering [Fri, 18 Jun 2021 18:12:46 +0000 (20:12 +0200)] 
Add error reporting to get_console_input_win32().

When the function setup fails due to invalid file handles, or because
WriteFile(err, ...) fails (due to file handle corruption elsewhere),
the function used to silently "return false"

Change this to print a M_WARN|M_ERRNO message.

Also, change the function style to early-return style (= large diff, but
most are indent changes only).

v2: fix spurious "}" that was left over from change to early-return.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210618181246.30769-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22577.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 years agoPreparing release 2.5.3 v2.5.3
Gert Doering [Thu, 17 Jun 2021 09:01:55 +0000 (11:01 +0200)] 
Preparing release 2.5.3

version.m4, ChangeLog, Changes.rst

Signed-off-by: Gert Doering <gert@greenie.muc.de>