]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
6 years agoPreparing OpenVPN 2.3.18 release release/2.3 115/head 95/head v2.3.18
David Sommerseth [Mon, 25 Sep 2017 21:42:48 +0000 (23:42 +0200)] 
Preparing OpenVPN 2.3.18 release

Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoFix bounds check in read_key()
Steffan Karger [Tue, 15 Aug 2017 08:04:33 +0000 (10:04 +0200)] 
Fix bounds check in read_key()

The bounds check in read_key() was performed after using the value, instead
of before.  If 'key-method 1' is used, this allowed an attacker to send a
malformed packet to trigger a stack buffer overflow.

Fix this by moving the input validation to before the writes.

Note that 'key-method 1' has been replaced by 'key method 2' as the default
in OpenVPN 2.0 (released on 2005-04-17), and explicitly deprecated in 2.4
and marked for removal in 2.5.  This should limit the amount of users
impacted by this issue.

CVE: 2017-12166
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <80690690-67ac-3320-1891-9fecedc6a1fa@fox-it.com>
URL: https://www.mail-archive.com/search?l=mid&q=80690690-67ac-3320-1891-9fecedc6a1fa@fox-it.com
Signed-off-by: David Sommerseth <davids@openvpn.net>
(backport of git master commit 3b1a61e9fb27213c46f76312f4065816bee8ed01)

6 years agoOpenSSL: Always set SSL_OP_CIPHER_SERVER_PREFERENCE flag
Szilárd Pfeiffer [Mon, 4 Sep 2017 08:10:12 +0000 (10:10 +0200)] 
OpenSSL: Always set SSL_OP_CIPHER_SERVER_PREFERENCE flag

* safe bet to say that server admins are better at updating their configs
  than client users are and if client do want to restrict their ciphers,
  they should simply evict the ciphers they don't want from their cipher
  suite
* mbed TLS and OpenSSL behave more similar with the
  SSL_OP_CIPHER_SERVER_PREFERENCE flag

Signed-off-by: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170904081012.1975-1-coroner@pfeifferszilard.hu>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15356.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit 5fd8e94d311825571931414064e4d13ed808f9b5)

6 years agoDeprecate --ns-cert-type
Steffan Karger [Tue, 8 Aug 2017 20:00:47 +0000 (22:00 +0200)] 
Deprecate --ns-cert-type

This is a manual cherry-pick of commit 2dc33226 of the master branch,
for the release/2.3 branch.

The nsCertType x509 extension is very old, and barely used.  We already
have had an alternative for a long time: --remote-cert-tls uses the far
more common keyUsage and extendedKeyUsage extensions instead.

OpenSSL 1.1 no longer exposes an API to (separately) check the nsCertType
x509 extension.  Since we want be able to migrate to OpenSSL 1.1, we
should deprecate this option immediately.

Trac: #876

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1502222447-8186-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15180.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agocrypto: correct typ0 in error message
Antonio Quartulli [Tue, 27 Jun 2017 12:00:47 +0000 (20:00 +0800)] 
crypto: correct typ0 in error message

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170627120047.12304-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14975.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 778aca3d251b6a563ffbabef95816fab863825e1)

6 years agoPreparing for release v2.3.17 (ChangeLog, version.m4, Changes.rst) v2.3.17
Gert Doering [Mon, 19 Jun 2017 19:02:22 +0000 (21:02 +0200)] 
Preparing for release v2.3.17 (ChangeLog, version.m4, Changes.rst)

General cleanup help, UTF8 fixes, whitespace and quoting fixes for
ChangeLog and Changes.rst provided by David Sommerseth <davids@openvpn.net>

Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 years agoFix remotely-triggerable ASSERT() on malformed IPv6 packet.
Gert Doering [Tue, 13 Jun 2017 20:08:32 +0000 (22:08 +0200)] 
Fix remotely-triggerable ASSERT() on malformed IPv6 packet.

Correct sanity checks on IPv6 packet length in mss_fixup_ipv6(),
and change the ASSERT() check in mss_fixup_dowork() into a simple
"return" (= the TCP header will simply not be inspected further).

CVE-2017-7508 has been assigned due to the serious nature of the
bug: it can be used to remotely shutdown an openvpn server or
client, if IPv6 and --mssfix are enabled and the IPv6 networks used
inside the VPN are known.

Found by Guido Vranken <guidovranken@gmail.com>.

v2: style changes

CVE: 2017-7508
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170613200832.15027-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/search?l=mid&q=20170613200832.15027-1-gert@greenie.muc.de
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c3f47077a7756de5929094569421a95aa66f2022)

6 years agoPrevent two kinds of stack buffer OOB reads and a crash for invalid input data
Guido Vranken [Fri, 19 May 2017 12:04:25 +0000 (14:04 +0200)] 
Prevent two kinds of stack buffer OOB reads and a crash for invalid input data

Pre-authentication remote crash/information disclosure for clients

If clients use a HTTP proxy with NTLM authentication (i.e.
"--http-proxy <server> <port> [<authfile>|'auto'|'auto-nct'] ntlm2"),
a man-in-the-middle attacker between the client and the proxy can
cause the client to crash or disclose at most 96 bytes of stack
memory. The disclosed stack memory is likely to contain the proxy
password.

If the proxy password is not reused, this is unlikely to compromise
the security of the OpenVPN tunnel itself.  Clients who do not use
the --http-proxy option with ntlm2 authentication are not affected.

CVE: 2017-7520
Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-EJvHKid-zTj+hmFG_3Gv78ixqCayE9=C62DZaxN32WNtQ@mail.gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=CAO5O-EJvHKid-zTj+hmFG_3Gv78ixqCayE9=C62DZaxN32WNtQ@mail.gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7718c8984f04b507c1885f363970e2124e3c6c77)

6 years agoFix potential double-free in --x509-alt-username (CVE-2017-7521)
Steffan Karger [Mon, 19 Jun 2017 09:28:40 +0000 (11:28 +0200)] 
Fix potential double-free in --x509-alt-username (CVE-2017-7521)

We didn't check the return value of ASN1_STRING_to_UTF8() in
extract_x509_extension().  Ignoring such a failure could result in buf
being free'd twice.  An error in ASN1_STRING_to_UTF8() can be caused
remotely if the peer can make the local process run out of memory.

The problem can only be triggered for configurations that use the
--x509-alt-username option with an x509 extension (i.e. the option
parameter starts with "ext:").

This issue was discovered, analysed and reported to the OpenVPN team by
Guido Vranken.

Extensive testing by Guido Vranken gives confidence that this function
is very unlikely to fail in real-world usage (using subjectAltName or
issuerAltName extensions) for other reasons than memory exhaustion.

CVE: 2017-7521
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Acked-by: Guido Vranken <guidovranken@gmail.com>
Message-Id: <1497864520-12219-6-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/search?l=mid&q=1497864520-12219-6-git-send-email-steffan.karger@fox-it.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit cb4e35ece4a5b70b10ef9013be3bff263d82f32b)

6 years agoRestrict --x509-alt-username extension types
Steffan Karger [Mon, 19 Jun 2017 09:28:39 +0000 (11:28 +0200)] 
Restrict --x509-alt-username extension types

The code never supported all extension types.  Make this explicit by only
allowing subjectAltName and issuerAltName (for which the current code does
work).

Using unsupported extension fields would most likely cause OpenVPN to crash
as soon as a client connects.  This does not have a real-world security
impact, as such a configuration would not be possible to use in practice.

This bug was discovered, analysed and reported to the OpenVPN team by
Guido Vranken.

Note: small code changes in to avoid "variable declaration in the middle
of a code block" when backporting changes to extract_x509_extension(),
as 2.3 can not assume a C99 compiler.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Acked-by: Guido Vranken <guidovranken@gmail.com>
Message-Id: <1497864520-12219-5-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/search?l=mid&q=1497864520-12219-5-git-send-email-steffan.karger@fox-it.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d2a19185fd78030ce4a1bba6c9f83e0dac9e15a6)

6 years agoFix remote-triggerable memory leaks (CVE-2017-7521)
Steffan Karger [Mon, 19 Jun 2017 09:28:38 +0000 (11:28 +0200)] 
Fix remote-triggerable memory leaks (CVE-2017-7521)

Several of our OpenSSL-specific certificate-parsing code paths did not
always clear all allocated memory.  Since a client can cause a few bytes
of memory to be leaked for each connection attempt, a client can cause a
server to run out of memory and thereby kill the server.  That makes this
a (quite inefficient) DoS attack.

When using the --x509-alt-username option on openssl builds with an
extension (argument prefixed with "ext:", e.g. "ext:subjectAltName"), the
code would not free all allocated memory.  Fix this by using the proper
free function.

If ASN1_STRING_to_UTF8() returns 0, it didn't fail and *did* allocate
memory.  So also free the returned buffer if it returns 0.

These issues were found, analysed and reported to the OpenVPN team by Guido
Vranken.

CVE: 2017-7521
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Acked-by: Guido Vranken <guidovranken@gmail.com>
Message-Id: <1497864520-12219-4-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/search?l=mid&q=1497864520-12219-4-git-send-email-steffan.karger@fox-it.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2d032c7fcdfd692c851ea2fa858b4c2d9ea7d52d)

6 years agoauth-token with auth-nocache fix broke --disable-crypto builds
David Sommerseth [Mon, 19 Jun 2017 13:05:07 +0000 (15:05 +0200)] 
auth-token with auth-nocache fix broke --disable-crypto builds

After adding commit 571165360db0392fa83e, it broke builds where
the --disable-crypto was used with ./configure.  This was due to
the delayed_auth_pass_purge() which requires the crypto code paths
being called from init.c without the proper #ifdef encapsulation.

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

6 years agobackport: Ignore auth-nocache for auth-user-pass if auth-token is pushed
David Sommerseth [Sat, 25 Feb 2017 13:10:29 +0000 (14:10 +0100)] 
backport: Ignore auth-nocache for auth-user-pass if auth-token is pushed

This is a backport to release/2.3 of the following commit:

commit 571165360db0392fa83ec8e6f8de145f623c53fe
Author: Antonio Quartulli <a@unstable.cc>
Date:   Sat Feb 25 08:40:14 2017 +0800

    When the auth-token option is pushed from the server to the client,
    the latter has to ignore the auth-nocache directive (if specified).

    The password will now be substituted by the unique token, therefore
    it can't be wiped out, otherwise the next renegotiation will fail.

    Trac: #840
Cc: David Sommerseth <openvpn@sf.lists.topphemmelig.net>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
    Message-Id: <20170225004014.28638-1-a@unstable.cc>
    URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14194.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-By: Arne Schwabe <arne@rfc2549.org>
Message-Id: <f7ac719e-0b28-4c4d-5e8a-2932827789b6@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14201.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoFix potential 1-byte overread in TCP option parsing.
Gert Doering [Sun, 18 Jun 2017 19:41:04 +0000 (21:41 +0200)] 
Fix potential 1-byte overread in TCP option parsing.

A malformed TCP header could lead to a one-byte overread when
searching for the MSS option (but as far as we know, with no
adverse consequences).

Change outer loop to always ensure there's one extra byte available
in the buffer examined.

Technically, this would cause OpenVPN to ignore the only single-byte
TCP option available, 'NOP', if it ends up being the very last
option in the buffer - so what, it's a NOP anyway, and all we
are interested is MSS, which needs 4 bytes.
(https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml)

Found and reported by Guido Vranken <guidovranken@gmail.com>.

Trac: #745

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

6 years agoFix a null-pointer dereference in establish_http_proxy_passthru()
Guido Vranken [Fri, 16 Jun 2017 00:58:56 +0000 (02:58 +0200)] 
Fix a null-pointer dereference in establish_http_proxy_passthru()

Prevents that the client crashes if the peer does not specify
the 'realm' and/or 'nonce' values. These pointers are
dereferenced in DigestCalcHA1() and DigestCalcResponse();
hence, if not set, a null-pointer dereference would occur.

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1497574736-2092-1-git-send-email-gv@guidovranken.nl>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14844.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 14865773ad64d861128bc80ad44c37bdc307c996)

6 years agoopenssl: fix overflow check for long --tls-cipher option
Steffan Karger [Mon, 22 May 2017 13:54:13 +0000 (15:54 +0200)] 
openssl: fix overflow check for long --tls-cipher option

The length check in tls_ctx_restrict_ciphers() did not check for overflow,
which could lead to a stack buffer overflow.

This has no real-world impact, because --tls-cipher can only be specified
by entities that are allowed to supply config settings.  Since those
entities can also change --script-security and call scripts and/or
plugins, these users already have code execution at the level of the
openvpn process.  In other words: the attacker would not gain any
capabilities.  Nevertheless, a nasty bug that we should fix.

This bug was discovered and reported to the OpenVPN security team by
Guido Vranken.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1495461253-20111-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14716.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e6bf7e033d063535a4414a4cf49c8f367ecdbb4f)

6 years agoEnsure option array p[] is always NULL-terminated
Guido Vranken [Wed, 7 Jun 2017 23:02:38 +0000 (01:02 +0200)] 
Ensure option array p[] is always NULL-terminated

Add one element (a terminating NULL pointer) to the array into
which parse_line() stores the arguments. This prevents that options
that traverse this array until a terminator is seen (for instance
options that call no_more_than_n_args) will peek beyond buffer bounds.
In the worst case this might lead to a crash (stack overflow, not
likely in practice).

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-EKCLjPpdKUH6cCoqoZDAfekSafpc7Ga55H2_5Hs4rBopg@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14757.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 8b03d3d9307b407b0da98ebefb052b1fa87aefe7)

6 years agoMissing include for socket-flags TCP_NODELAY on OpenBSD
Jérémie Courrèges-Anglas [Sat, 10 Jun 2017 17:31:21 +0000 (19:31 +0200)] 
Missing include for socket-flags TCP_NODELAY on OpenBSD

Signed-off-by: Jeremie Courreges-Anglas <jca@wxcvbn.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <87fuf7u455.fsf@ritchie.wxcvbn.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14772.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e5b236eaba4512f86da917a0a63dd0f84e1b02db)

6 years agoFix an unaligned access on OpenBSD/sparc64
Jérémie Courrèges-Anglas [Sat, 10 Jun 2017 14:48:44 +0000 (16:48 +0200)] 
Fix an unaligned access on OpenBSD/sparc64

The pointer to the packet content doesn't seem to be word-aligned,
resulting in a SIGBUS when accessing it as a pointer to struct ip that
contains bit fields.

Replace with struct openvpn_iphdr and OPENVPN_IPH_GET_VER, which only
does a one byte access and thus isn't affected by alignement.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <87ink3vpcs.fsf@ritchie.wxcvbn.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14769.html

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

6 years agoFix memory leak in add_option() for option 'connection'
Guido Vranken [Thu, 8 Jun 2017 22:04:36 +0000 (00:04 +0200)] 
Fix memory leak in add_option() for option 'connection'

This patch ensures that if an error occurs while processing
the 'connection' directive of an options specification,
the variable 'struct options sub', which is initialized
with init_options(), is properly freed with uninit_options().

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-E+HdfHNAK=--55054AB374U-Ky4q_-3M114makfPdSnBw@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14764.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d89e14d92623731d2fa6343a11072caab32e13cd)

6 years agoFix 2 memory leaks in proxy authentication routine
Guido Vranken [Thu, 8 Jun 2017 14:36:54 +0000 (16:36 +0200)] 
Fix 2 memory leaks in proxy authentication routine

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-EL11jDxO+c1Gu0FvunqwUTW2uxjy910+A-s63Nr5O3NWw@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14758.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 8d606cd3f6bce304874b1d7745d40d11f64ea17d)

6 years agorefactor my_strupr
Guido Vranken [Wed, 7 Jun 2017 22:44:15 +0000 (00:44 +0200)] 
refactor my_strupr

Refactor my_strupr such that it will not check and possibly alter bytes
after the string's null terminator for strings of length 0.

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAO5O-ELXwXgGtRFou=FY1TAhW4W4BHPZF4=rqSY877njtXNMJg@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14756.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 69162924de3600bfe8ae9708a1d6e3f4515ef995)

6 years agoPreparing for release v2.3.16 (ChangeLog, version.m4) v2.3.16
Gert Doering [Thu, 18 May 2017 18:47:46 +0000 (20:47 +0200)] 
Preparing for release v2.3.16 (ChangeLog, version.m4)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 years agoFix gateway detection with OpenBSD routing domains
Steven McDonald [Thu, 13 Apr 2017 17:31:29 +0000 (03:31 +1000)] 
Fix gateway detection with OpenBSD routing domains

When OpenVPN is started using a non-default routing table on OpenBSD
(e.g., with 'route -T10 exec openvpn ...'), it hangs forever trying to
read its default gateway from a PF_ROUTE socket. This is because
rtm_tableid is not being initialised after bzeroing the rt_msghdr we
write to the socket, so we end up asking the kernel for the default
route in routing table 0.

By default, the OpenBSD kernel will not respond to requests for routing
table 0 from a process running in a different routing table, and even
if it did, it would give us the wrong default gateway.

The solution here is to set rtm_tableid to the value returned by
getrtable(2), which always succeeds and returns the calling process's
current routing table.

This patch makes the test suite (without a t_client.rc) pass when run
in a non-default routing table, where it would fail previously. It has
also been successfully tested in client mode against both git master
and OpenVPN 2.4.1 from ports on an OpenBSD -current system.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170413173129.87367-1-steven@steven-mcdonald.id.au>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14461.html

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

6 years agofix redirect-gateway behaviour when an IPv4 default route does not exist
Antonio Quartulli [Tue, 9 May 2017 15:24:22 +0000 (23:24 +0800)] 
fix redirect-gateway behaviour when an IPv4 default route does not exist

When no IPv4 default route exists, the "redirect-gateway" routine
aborts even if the sub-option "local" was specified or if we are
connecting to the remote host using IPv6.

This is not expected because in either case OpenVPN should not
bother checking the existence of the default route as it is not
required at all.

Therefore, skip the IPv4 default route check when "local" is
specified or we are connecting to an IPv6 remote host.

(This is a cherry-pick of 14670a9d654b (master), adapted to 2.3 code)

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170509152422.12606-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14602.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 years agoAvoid a 1 byte overcopy in x509_get_subject (ssl_verify_openssl.c)
Guido Vranken [Sat, 13 May 2017 10:37:50 +0000 (12:37 +0200)] 
Avoid a 1 byte overcopy in x509_get_subject (ssl_verify_openssl.c)

Trac: #890

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <CAO5O-EKGgpYAsJC5j+osB_LAteoUDbOwVYVqkB2=cA3a6VVHoA@mail.gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14649.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 years agoCheck for errors in the return value of GetModuleFileNameW()
Selva Nair [Sun, 14 May 2017 22:16:36 +0000 (18:16 -0400)] 
Check for errors in the return value of GetModuleFileNameW()

Also replace MAX_PATH by _countof(openvpnpath) as the latter
is arguably more robust.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1494800196-8144-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14654.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 years agoPrepare v2.3.15 release v2.3.15
David Sommerseth [Thu, 11 May 2017 00:12:55 +0000 (02:12 +0200)] 
Prepare v2.3.15 release

Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoDon't assert out on receiving too-large control packets (CVE-2017-7478)
Steffan Karger [Thu, 11 May 2017 09:00:57 +0000 (11:00 +0200)] 
Don't assert out on receiving too-large control packets (CVE-2017-7478)

Commit 358f513c changed the maximum size of accepted control channel
packets.  This was needed for crypto negotiation (which is needed for a
nice transition to a new default cipher), but exposed a DoS
vulnerability.  The vulnerability was found during the OpenVPN 2.4 code
audit by Quarkslab (commisioned by OSTIF).

To fix the issue, we should not ASSERT() on external input (in this case
the received packet size), but instead gracefully error out and drop the
invalid packet.

CVE: 2017-7478
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494493257-8125-1-git-send-email-steffan.karger@fox-it.com>
URL: http://www.mail-archive.com/search?l=mid&q=1494493257-8125-1-git-send-email-steffan.karger@fox-it.com
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoDrop packets instead of assert out if packet id rolls over (CVE-2017-7479)
Steffan Karger [Tue, 9 May 2017 19:30:07 +0000 (21:30 +0200)] 
Drop packets instead of assert out if packet id rolls over (CVE-2017-7479)

Previously, if a mode was selected where packet ids are not allowed to roll
over, but renegotiation does not succeed for some reason (e.g. no password
entered in time, certificate expired or a malicious peer that refuses the
renegotiaion on purpose) we would continue to use the old keys.  Until the
packet ID would roll over and we would ASSERT() out.

Given that this can be triggered on purpose by an authenticated peer, this
is a fix for an authenticated remote DoS vulnerability.  An attack is
rather inefficient though; a peer would need to get us to send 2^32
packets (min-size packet is IP+UDP+OPCODE+PID+TAG (no payload), results in
(20+8+1+4+16)*2^32 bytes, or approx. 196 GB).

This is a fix for finding 5.2 from the OSTIF / Quarkslab audit.

CVE: 2017-7479
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494358209-4568-1-git-send-email-steffan.karger@fox-it.com>
URL: http://www.mail-archive.com/search?l=mid&q=1494358209-4568-1-git-send-email-steffan.karger@fox-it.com
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoIntroduce and use secure_memzero() to erase secrets
Steffan Karger [Wed, 10 May 2017 20:56:15 +0000 (22:56 +0200)] 
Introduce and use secure_memzero() to erase secrets

This is a cherry-pick of commit 009521ac (master).

As described in trac #751, and shortly after reported by Zhaomo Yang, of
the University of California, San Diego, we use memset() (often through
the CLEAR() macro) to erase secrets after use.  In some cases however, the
compiler might optimize these calls away.

This patch replaces these memset() calls on secrets by calls to a new
secure_memzero() function, that will not be optimized away.

Since we use CLEAR() a LOT of times, I'm not changing that to use
secure_memzero() to prevent performance impact.  I did annotate the macro
to point people at secure_memzero().

This patch also replaces some CLEAR() or memset() calls with a zero-
initialization using "= { 0 }" if that has the same effect.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494449775-22199-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14628.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoDocument that OpenVPN 2.3 does not check the CRL signature
Steffan Karger [Wed, 10 May 2017 19:50:44 +0000 (21:50 +0200)] 
Document that OpenVPN 2.3 does not check the CRL signature

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494445844-8327-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14626.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agocleanup: merge packet_id_alloc_outgoing() into packet_id_write()
Steffan Karger [Tue, 9 May 2017 19:10:36 +0000 (21:10 +0200)] 
cleanup: merge packet_id_alloc_outgoing() into packet_id_write()

The functions packet_id_alloc_outgoing() and packet_id_write() were
always called in tandem.  Instead of forcing the caller to allocate a
packet_id_net to do so, merge the two functions.  This simplifies the API
and reduces the chance on mistakes in the future.

This patch adds unit tests to verify the behaviour of packet_id_write().
Verifying that we assert out correctly required the change to mock_msg.c.

This patch was cherry-picked from a87e1431 (master).

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494357036-3529-1-git-send-email-steffan.karger@fox-it.com>
URL: http://www.mail-archive.com/search?l=mid&q=1494357036-3529-1-git-send-email-steffan.karger@fox-it.com
Signed-off-by: David Sommerseth <davids@openvpn.net>
6 years agoAdd missing includes in error.h
Steffan Karger [Tue, 9 May 2017 18:52:42 +0000 (20:52 +0200)] 
Add missing includes in error.h

error.h depends on these, but is apparently never used by files that do
not include them.  Cherry-picked from b7e51b13 (master).

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1494355962-21545-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14612.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoMake --cipher/--auth none more explicit on the risks
David Sommerseth [Mon, 10 Apr 2017 22:28:28 +0000 (00:28 +0200)] 
Make --cipher/--auth none more explicit on the risks

The warning provided to --cipher and --auth using the 'none' setting may
not have been too clearly understandable to non-developers or people not
fully understanding encryption and cryptography.  This tries to improve
that.

While at it, also break up the long source lines.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170410222828.23612-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14436.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit 7a1b6a0dd706a81897457b0456a951c0b30bbcfb)

7 years agoDocument --proto udp6, tcp6, etc.
Gert Doering [Sun, 19 Mar 2017 19:34:51 +0000 (20:34 +0100)] 
Document --proto udp6, tcp6, etc.

Trac #793

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20170319193451.24289-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14283.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agogit: Merge .gitignore files into a single file
David Sommerseth [Fri, 20 Jan 2017 21:04:57 +0000 (22:04 +0100)] 
git: Merge .gitignore files into a single file

We already track a lot of files over the whole directory structure
in the main .gitignore file.  But a few additional ones had been
added into some of the subdirectories.

This unifies all these files into a master file for the whole project,
making it easier to know where to look at and edit if changes needs
to be done.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <20170120210457.3383-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13916.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit d14b3c60c7796736e07bc3cddb0ab3a58475793e)

7 years agoFix implicit declarations when HAVE_OPENSSL_ENGINE is unset
Julien Muchembled [Fri, 16 Dec 2016 16:32:18 +0000 (17:32 +0100)] 
Fix implicit declarations when HAVE_OPENSSL_ENGINE is unset

This fixes a regression in commit 8e95e20913:
on amd64, an implicit declaration of ERR_error_string leads to segfaults
if the returned pointer does not fit in an 'int'.

Trac: #792

Signed-off-by: Julien Muchembled <jm@nexedi.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20161216163218.25449-1-jm@nexedi.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13591.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agodocs: Further improve --reneg-bytes and SWEET32 information
David Sommerseth [Wed, 21 Dec 2016 20:54:50 +0000 (21:54 +0100)] 
docs: Further improve --reneg-bytes and SWEET32 information

There are still some support tickets related to SWEET32 and
our defult enforced --reneg-bytes 64 when using weaker ciphers
(less than 128-bits cipher blocks).  Try to clarify this even
more.

Also fix a few mistakes, saying less than 128-bits and not 128-bits
and less.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1482353691-27088-2-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13662.html

7 years agoUpdate copyrights
David Sommerseth [Wed, 21 Dec 2016 20:00:53 +0000 (21:00 +0100)] 
Update copyrights

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1482350454-27280-3-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13656.html

7 years agodev-tools: Added script for updating copyright years in files
David Sommerseth [Mon, 19 Dec 2016 18:52:12 +0000 (19:52 +0100)] 
dev-tools: Added script for updating copyright years in files

Very simple tool which modifies the Copyright lines in all git checked-in
files with an updated year.  Lines only listing a single year (2016) will
be modified to list a range instead.

Only the Copyright lines owners of specific owners will be modified.  The
script will need to be slightly updated to cover more owners.  See the
UPDATE_COPYRIGHT_LINES line in the script for the currently set owners.

v2 - On-the-fly-commit-update: use vendor/ instead of cmocka and
     add @sophos.com to the list of copyright holders to update

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1482173532-25132-1-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13645.html
(cherry picked from commit da8f11f895bb78174d4412d82a6992c398da495a)

7 years agoPreparing release of v2.3.14 v2.3.14
Gert Doering [Tue, 6 Dec 2016 20:38:58 +0000 (21:38 +0100)] 
Preparing release of v2.3.14

Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoCorrectly state the default dhcp server address in man page
Selva Nair [Fri, 2 Dec 2016 19:42:09 +0000 (14:42 -0500)] 
Correctly state the default dhcp server address in man page

Also correct the default ifconfig-pool end in docs and comments

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1480707729-19578-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13387.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 251cc8f2042cc0cb8281230f7fb33f2cdec5b809)

7 years agoMap restart signals from event loop to SIGTERM during exit-notification wait
Selva Nair [Wed, 30 Nov 2016 01:48:55 +0000 (20:48 -0500)] 
Map restart signals from event loop to SIGTERM during exit-notification wait

Commit 63b3e000c9.. fixed SIGTERM getting lost during exit notification
by ignoring any restart signals triggered during this interval. However,
as reported in Trac 777, this could result in repeated triggering of
restart signals when the event loop cannot continue without restart due
to IO errors or timeout.

Avoid by converting soft SIGUSR1 and SIGHUP signals received during
exit-notify wait period to SIGTERM.

cherry-picked from commit f25a0217e35f53c3110ebb226e1d1f3528152cb5
with (c->sig->source == SIG_SOURCE_HARD) changed to c->sig->hard

Trac: #777

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1480470535-6287-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13310.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoWhen parsing '--setenv opt xx ..' make sure a third parameter is present
Selva Nair [Wed, 30 Nov 2016 01:53:14 +0000 (20:53 -0500)] 
When parsing '--setenv opt xx ..' make sure a third parameter is present

When no parameters are present, set it to "setenv opt" to trigger a
descriptive error message. And, thus get rid of the pesky NULL pointer
dereferencing.

Trac: #779

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1480470794-6349-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13311.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 997795353916ffcb413a2da02dc7f210fd621954)

7 years agoupdate year in copyright message
Christian Hesse [Mon, 28 Nov 2016 17:08:20 +0000 (18:08 +0100)] 
update year in copyright message

This line has not been touched in a long time... Let's update the
copyright message with recent year.

Signed-off-by: Christian Hesse <mail@eworm.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20161128170820.20371-1-list@eworm.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13270.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7f7d6b2eb0f69f0e8952028488d7aa02619ad76f)

7 years agoClean up format_hex_ex()
Steffan Karger [Mon, 28 Nov 2016 16:55:07 +0000 (17:55 +0100)] 
Clean up format_hex_ex()

Cherry-pick of commit 29404010 from master, slightly reworked to match the
2.3 codebase (no flags inside space_break here), and pulled in the new
static_assert() fallback we also have in master now.

Fix a potential null-pointer dereference, and make the code a bit more
readable while doing so.

The NULL dereference could not be triggered, because the current code
never called format_hex_ex() with maxouput == 0 and separator == NULL.
But it's nicer to not depend on that.

Our use of int vs size_t for lengths needs some attention too, but I'm
not pulling that into this patch.  Instead I decided to just make the
(previously existing) assumption that INT_MAX <= SIZE_MAX explicit by
adding a static_assert().

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1480352107-19652-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13269.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoDocument the --auth-token option
David Sommerseth [Sat, 17 Sep 2016 13:20:15 +0000 (16:20 +0300)] 
Document the --auth-token option

This isn't an option to be used directly in any configuration files,
but to be used via --client-connect scripts or --plugin making use of
OPENVPN_PLUGIN_CLIENT_CONNECT or OPENVPN_PLUGIN_CLIENT_CONNECT_V2.

 [v2 - Added lacking .B styling of options
     - Clarified the token life time ]

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1474118415-14666-1-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12506.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f8a367f7c51af5482013fa3d783cade376b047ed)

7 years agoSupport --block-outside-dns on multiple tunnels
Selva Nair [Sat, 17 Sep 2016 04:10:39 +0000 (00:10 -0400)] 
Support --block-outside-dns on multiple tunnels

v2: Simplified "add sublayer" code

Currently each instance of openvpn adds WFP filters into an independent
sublayer. As a block in one sublayer can over-ride a permit in another,
this causes all DNS traffic to block when --block-outside-dns is used
in multiple tunnels.

Fix using a common sublayer for adding firewall rules (filters) from all
instances of openvpn and interactive service.
- The sublayer is added in a persistent session so that it could be
  accessed from multiple sessions.
- The sublayer is identified by a fixed UUID defined in block_dns.c
- Permit filters for tun/tap interfaces are added with explicitly higher
  priority than filters that block all DNS traffic. This is not strictly
  necessary as WFP assigns higher priority to specific filters over generic
  ones, but it may be safer not to rely on that feature.
- All filters are added in dynamic sessions as before. They get
  automatically removed when the process exits. The sublayer will,
  however, persist until reboot.

Resolves Trac 718

- While at it also make sure the WFP session is closed on error in
  win_wfp_block_dns().
- Also fix the function prototype typedefs in win32_wfp.h for
  run-time-resolved fwpm functions

Tested on Windows 7, 10

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1474085439-28766-2-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12466.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoRepair topology subnet on OpenBSD
Gert Doering [Wed, 9 Nov 2016 20:19:32 +0000 (21:19 +0100)] 
Repair topology subnet on OpenBSD

Turns out that "topology subnet" never worked totally right on
OpenBSD - the "netmask" parameter to ifconfig is ignored, and one
needs to add a subnet route  (and this issue is hidden if an
encompassing route is pushed, like, by using --redirect-gateway).

While add it, apply the hack used for FreeBSD where "an arbitrary
address from the subnet" is used to set the "remote" end of the
tunnel, and point the route to that - so if OpenBSD decides to
change their kernel routing structure the same way, our code still
works (copying from commit 433b3813d8c38b4, trac #425 and commit
60fd44e501f2002, trac #481).

Tested on OpenBSD 6.0 and 4.9

Trac: #710
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20161109201932.80991-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12983.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit 7f444dee52321c0f0294e99695150a7f69522715)

7 years agoRepair topology subnet on FreeBSD 11
Gert Doering [Tue, 8 Nov 2016 12:45:06 +0000 (13:45 +0100)] 
Repair topology subnet on FreeBSD 11

We used to add "route for this subnet" by using our own address as
the gateway address, which used to mean "connected to the interface,
no gateway".  FreeBSD commit 293159 changed the kernel side of that
assumption so "my address" is now always bound to "lo0" - thus, our
subnet route also ended up pointing to "lo0", breaking connectivity
for all hosts in the subnet except the one we used as "remote".

commit 60fd44e501f200 already introduced a "remote address" we use
for the "ifconfig tunX <us> <remote>" part - extend that to be used
as gateway address for the "tunX subnet" as well, and things will
work more robustly.

Tested on FreeBSD 11.0-RELEASE and 7.4-RELEASE (client and server)
(this particular issue is not present before 11.0, but "adding the
subnet route" never worked right, not even in 7.4 - 11.0 just made
the problem manifest more clearly)

Trac #425
URL: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207831

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20161108124506.32559-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12950.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a433b3813d8c38b491d2baa7b433973f2d6cd7c6)

7 years agoDrop recursively routed packets
Lev Stipakov [Thu, 3 Nov 2016 21:28:23 +0000 (23:28 +0200)] 
Drop recursively routed packets

v4:
 - Account for IP header offset in TAP mode
 - Correct handle of non-IP protocols in TAP mode

v3: Use better way of figuring out IP proto version which
does not break TAP mode. Add an option to allow recursive
routing, could be useful when packets sent by openvpn itself
are not subject to the routing tables that would move packets
into the tunnel.

v2: better method naming

On certain OSes (Windows, OS X) when network adapter is
disabled (ethernet cable pulled off, Wi-Fi hardware switch disabled),
operating system starts to use tun as an external interface.
Outgoing packets are routed to tun, UDP encapsulated, given to
routing table and sent to.. tun.

As a consequence, system starts talking to itself on full power,
traffic counters skyrocket and user is not happy.

To prevent that, drop packets which have gateway IP as
destination address.

Tested on Win7/10, OS X, Linux.

Trac #642

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1478208503-25929-1-git-send-email-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12894.html

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

7 years agoPreparing release of v2.3.13 v2.3.13
David Sommerseth [Wed, 2 Nov 2016 22:27:41 +0000 (23:27 +0100)] 
Preparing release of v2.3.13

Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoman: Improve the --keepalive section
David Sommerseth [Tue, 1 Nov 2016 13:38:09 +0000 (14:38 +0100)] 
man: Improve the --keepalive section

Just minor clarifications and corrections of the --keepalive option.

  v2 - Changed from ps/pto to interval/timeout
     - Rephrased the server-side timeout doubling parapgraph

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1478007489-17163-1-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12866.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit beaa6564a7ce3e48473a8bde7b4f9291df490d62)

7 years agoAdd a revoked cert to the sample keys
Steffan Karger [Wed, 26 Oct 2016 19:29:19 +0000 (21:29 +0200)] 
Add a revoked cert to the sample keys

Allows for easier testing of the revocation functionality.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1477510159-5067-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12784.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit a64d76e246042fde40189033b87b126627db5b6b)

7 years agoLimit --reneg-bytes to 64MB when using small block ciphers
Steffan Karger [Fri, 28 Oct 2016 12:10:07 +0000 (14:10 +0200)] 
Limit --reneg-bytes to 64MB when using small block ciphers

Following the earlier warning about small block ciphers, now limit the
--reneg-bytes value when using a cipher that susceptible to SWEET32-like
attacks.  The 64 MB value has been selected with the researchers who
published the SWEET32 paper.

Note that this will not change a user-set --reneg-bytes value, to allow a
user to align a gun with his feet^w^w^w^w^w^w override this behaviour if
really needed.

Furthermore, in contrast with the patch for master, this will not limit
--reneg-bytes on the client side.  This allows server administrators to
revert to the old behaviour, or increase --reneg-bytes to something they
believe is workable, without having to change client configs.  (The master
branch provides cipher negotiation as a real solution, so we can be
stricter there.)

v2: obey user-set --reneg-bytes 0 to revert to old behaviour, use more firm
    language in warning message, add URL to man page, and only limit at the
    server side.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <1477656607-7440-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12799.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoFix compilation in pedantic mode
Lev Stipakov [Tue, 4 Oct 2016 20:42:16 +0000 (23:42 +0300)] 
Fix compilation in pedantic mode

Replace C++ style comments, which are not allowed in ISO C90 standard,
with C style comments

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1475613736-1529-1-git-send-email-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12600.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoExclude peer-id from pulled options digest
Lev Stipakov [Tue, 4 Oct 2016 19:53:06 +0000 (22:53 +0300)] 
Exclude peer-id from pulled options digest

v2:
 - Use md5_* methods
 - Move digest update to separate method

Peer-id might change on restart and this should not trigger reopening
tun.

Trac #649
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1475610786-25781-1-git-send-email-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12598.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoFix --multihome for IPv6 on 64bit BSD systems.
Gert Doering [Sun, 9 Oct 2016 10:09:29 +0000 (12:09 +0200)] 
Fix --multihome for IPv6 on 64bit BSD systems.

The old code only worked if "struct openvpn*pktinfo" happened to use
the same structure packing as the CMSG_SPACE() / CMSG_LEN() macros
(which are part of the official API, see RFC 2292).

Get rid of "struct openvpn_*_pktinfo" definitions, replace them by
an opaque buffer sized large enough to fit IPv4 and IPv6 packet info
messages, as defined by CMSG_SPACE(sizeof(struct ...)).

On 32 bit platforms, the net result is the same.  On 64 bit platforms,
the new buffer is bigger than openvpn_pktinfo was, fixing an overflow
with ipi6_ifindex corruption on reception, and EINVAL on sendmsg().

The IPv4 related changes are only side effects of using the new buffer.

Fixes: FreeBSD 10.3/amd64, FreeBSD 9.3/sparc64, OpenBSD 6.0/amd64,
       NetBSD 7.0.1/i386.

Note: --multihome for IPv4 on NetBSD is still broken and non-fixable(!)
       as NetBSD lacks the necessary kernel code for the sendmsg() side.

Verified that "--multihome works as well as before" on FreeBSD 7.4/amd64,
       NetBSD 5.1/amd64, OpenBSD 4.9/i386, Linux/x86_64, Linux/i386,
       OpenSolaris 10 (--multihome needs -D_XPG4_2, see trac #750)

See also: ip(4), ip6(4), recv(2)

Trac #634, #327, #28

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

7 years agoadd POSTINIT_CMD_suf to t_client.sh and sample config
Gert Doering [Tue, 4 Oct 2016 11:38:54 +0000 (13:38 +0200)] 
add POSTINIT_CMD_suf to t_client.sh and sample config

We have pre-init and cleanup commands, but some test cases might need
or want to run a shell script after openvpn has initialized, but before
executing any tests (ifconfig comparison and ping).

Example: POSTINIT_CMD_4="sleep 5" on MacOS X for tap tests (IPv6 DAD)

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

7 years agot_client.sh: Add prepare/cleanup possibilties for each test case
David Sommerseth [Sat, 16 Nov 2013 15:17:54 +0000 (16:17 +0100)] 
t_client.sh: Add prepare/cleanup possibilties for each test case

By adding PREPARE_$NUM and CLEANUP_$NUM variables containing command lines
to execute before and after the test case is run.

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1384615074-22345-1-git-send-email-dazo@users.sourceforge.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7990
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 8fedf86abaf8fca8d0e9e81f70d7a5888a98b9ee)

7 years agoUpdate cipher-related man page text
Steffan Karger [Sun, 11 Sep 2016 14:51:17 +0000 (16:51 +0200)] 
Update cipher-related man page text

As reported in trac #732, the man page text for --cipher is no longer
accurate.  Update the text to represent current knowledge, about NCP and
SWEET32.

This does not hint at changing the default cipher, because we did not make
a decision on that yet.  If we do change the default cipher, we'll have to
update the text to reflect that.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1473605477-20908-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12440.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agomake t_client robust against sudoers misconfiguration
Gert Doering [Sun, 2 Oct 2016 13:19:23 +0000 (15:19 +0200)] 
make t_client robust against sudoers misconfiguration

Instead of testing (and priming) sudo with "true", prime with
"kill -0 $$" (just test signalling ourselves).  If this fails,
we won't be able to kill the openvpn process we're going to
start later on -> thus, SKIP on failure.

This helps with misconfigured setups (especially on the buildbots)
that can correctly start openvpn but then not stop it later on -
leaving openvpn processes dangling around, requiring manual
intervention.

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

7 years agoAutomatically cache expected IPs for t_client.sh on the first run
Samuli Seppänen [Mon, 3 Oct 2016 10:51:27 +0000 (13:51 +0300)] 
Automatically cache expected IPs for t_client.sh on the first run

Previously one had to manually define correct values for the
EXPECT_IFCONFIG* variables based on what IPv4 and IPv6 addresses
the test VPN server handed out.

This was a tedious process especially with large number of tests,
as the IPs changed for every test client and for every test. With this
patch t_client.sh figures out the correct IP addresses using an
--up script and caches them to a separate file for later use.

Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1475491887-740-1-git-send-email-samuli@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12587.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit df0b00c253e41cce9567be79dbd3faa14c60473b)

7 years agoFix t_client runs on OpenSolaris
Gert Doering [Tue, 20 Sep 2016 09:19:14 +0000 (11:19 +0200)] 
Fix t_client runs on OpenSolaris

"grep -q" is not portable to non-GNU grep.  Replace with ">/dev/null".

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: 20160920091914.37585-1-gert@greenie.muc.de
URL: http://www.mail-archive.com/search?l=mid&q=20160920091914.37585-1-gert@greenie.muc.de
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit 38f98fdccd3eb6995b972fabb0ce4e00d3e3cb76)

7 years agoIncorporate the Debian typo fixes where appropriate and make show_opt default message...
Arne Schwabe [Thu, 14 Jul 2016 11:25:19 +0000 (13:25 +0200)] 
Incorporate the Debian typo fixes where appropriate and make show_opt default message clearer

Debian also incorrectly changes that the default for route parameters can
be specified by using "nil" instead of "default. The confusion is probably
coming from show_opt printing "nil" instead of "default". Change show_opt
to show "default (not set)" instead of "nil"

Original author: Alberto Gonzalez Iniesta <agi@inittab.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1468495519-25102-1-git-send-email-arne@rfc2549.org>
URL: http://www.mail-archive.com/search?l=mid&q=1468495519-25102-1-git-send-email-arne@rfc2549.org

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

7 years agot_client.sh: Improve detection if the OpenVPN process did start during tests
David Sommerseth [Sat, 17 Sep 2016 11:18:05 +0000 (14:18 +0300)] 
t_client.sh: Improve detection if the OpenVPN process did start during tests

This will check the OpenVPN log file if the process initialized
successfully.

It will check the log file for 30 seconds before aborting the test run.
This also has the advantage of starting the testing quicker if the
initialization goes faster than 10 seconds (which was the old sleep time).

The umask is also set to a more permissive mode to ensure the test
script is capable of reading the OpenVPN PID file, as that will be
created by root.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1474111085-10678-1-git-send-email-davids@openvpn.net>
URL: http://www.mail-archive.com/search?l=mid&q=1474111085-10678-1-git-send-email-davids@openvpn.net
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 3712322ee1219e55640f2f4e5f822799edacd7cc)

7 years agot_client.sh: Add support for Kerberos/ksu
David Sommerseth [Sat, 17 Sep 2016 10:50:33 +0000 (13:50 +0300)] 
t_client.sh: Add support for Kerberos/ksu

If the t_client.rc have PREFER_KSU=1 configured, t_client.sh
will check if you have a valid Kerberos ticket and if so it will
do all execution via ksu instead of sudo.

If PREFER_KSU is not set or a Kerberos ticket is not found, it
will fallback to the configured RUN_SUDO approach.

When using ksu it needs the full path to the program being executed,
so there is also additional code to find the full path of true and kill.

[ v2 - Remove $* from RUN_SUDO for ksu config.  Old cruft which survived
       last review before patch submission.
     - Improve known state declaration of PREFER_KSU ]

[ v3 - Kick out bashism - '&>' redirect ]

This commit also includes commits f0892e6590cb247ef1012b0fe89f80eee2d56cc4
and f40f10ea9607934faeb2b8cd84aefff0e0790189 (via merge conflicts)

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1474109433-4710-1-git-send-email-davids@openvpn.net>
URL: http://www.mail-archive.com/search?l=mid&q=1474109433-4710-1-git-send-email-davids@openvpn.net
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6b25b99fe4b8bdf5cdba4a0fb247df40277d0525)

7 years agoskip t_lpback.sh and t_cltsrv.sh if openvpn configured --disable-crypto
Ilya Shipitsin [Sat, 17 Sep 2016 09:33:09 +0000 (14:33 +0500)] 
skip t_lpback.sh and t_cltsrv.sh if openvpn configured --disable-crypto

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1474104789-31735-1-git-send-email-chipitsine@gmail.com>
URL: http://www.mail-archive.com/search?l=mid&q=1474104789-31735-1-git-send-email-chipitsine@gmail.com

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

7 years agot_client.sh: Make OpenVPN write PID file to avoid various sudo issues
David Sommerseth [Sat, 17 Sep 2016 09:20:26 +0000 (12:20 +0300)] 
t_client.sh: Make OpenVPN write PID file to avoid various sudo issues

This resolves an issue where $! returns the PID of the sudo process instead
of the PID of OpenVPN and when sudo does not properly propagate signales
down to OpenVPN.

Trac: #738
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1474104026-20615-1-git-send-email-davids@openvpn.net>
URL: http://www.mail-archive.com/search?l=mid&q=1474104026-20615-1-git-send-email-davids@openvpn.net
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e0926ebfe55347843af701216be9598827a1367a)

7 years agocleanup: remove code duplication in msg_test()
Steffan Karger [Thu, 1 Sep 2016 19:13:27 +0000 (21:13 +0200)] 
cleanup: remove code duplication in msg_test()

Use check_debug_level() instead of writing out the exact same check in
msg_test().

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: 1472757207-17900-1-git-send-email-steffan@karger.me
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00192.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit d7ce876841d1d5b01940251f92780fdbb05b4df0)

7 years agoMake gnu89 support explicit
Steffan Karger [Fri, 16 Sep 2016 15:40:36 +0000 (17:40 +0200)] 
Make gnu89 support explicit

In the release/2.3 branch we support gnu89, basically to keep
pre-2015 MSVC happy.  Old gcc (<5) defaulted to gnu89.  But
gcc 5+ and clang default to gnu11/c11.  This patch makes our
gnu89 support explicit, such these newer compilers will also
point out gnu89 violations to developers.

v2: only set -std=gnu89 if no -std flag is present in $CFLAGS

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: 1474040436-9855-1-git-send-email-steffan@karger.me
URL: http://www.mail-archive.com/search?l=mid&q=1474040436-9855-1-git-send-email-steffan@karger.me
Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoDo not abort t_client run if OpenVPN instance does not start.
Gert Doering [Tue, 13 Sep 2016 20:04:58 +0000 (22:04 +0200)] 
Do not abort t_client run if OpenVPN instance does not start.

Basically, an oversight - if one test instance does not start at all
(due to "tap driver not loaded") the whole script would exit, instead
of logging the failing instance and proceeding to the next test run.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: 20160913200458.9906-1-gert@greenie.muc.de
URL: http://www.mail-archive.com/search?l=mid&q=20160913200458.9906-1-gert@greenie.muc.de
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit a7b02f7f660707f765881f35867b4d23d89b390f)

7 years agoUse AES ciphers in our sample configuration files and add a few modern 2.4 examples
Arne Schwabe [Tue, 12 Jul 2016 09:14:08 +0000 (11:14 +0200)] 
Use AES ciphers in our sample configuration files and add a few modern 2.4 examples

Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: 1468314848-11820-1-git-send-email-arne@rfc2549.org
URL: http://www.mail-archive.com/search?l=mid&q=1468314848-11820-1-git-send-email-arne@rfc2549.org
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit 6d036ebc221d933c0751107cea9efe4692c9d559)

7 years agoFix unittests for out-of-source builds
Steffan Karger [Mon, 15 Aug 2016 18:02:36 +0000 (20:02 +0200)] 
Fix unittests for out-of-source builds

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Matthias Andree <matthias.andree@gmx.de>
Message-Id: 1471284156-2324-1-git-send-email-steffan@karger.me
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00027.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit ee4f37c3533667aee87fd39ba131e80f3c1cfde7)

7 years agoPreparing release of v2.3.12 v2.3.12
David Sommerseth [Tue, 23 Aug 2016 13:08:23 +0000 (15:08 +0200)] 
Preparing release of v2.3.12

Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoRevert "Drop recursively routed packets"
David Sommerseth [Tue, 23 Aug 2016 14:01:40 +0000 (16:01 +0200)] 
Revert "Drop recursively routed packets"

Need to revert this patch as it breaks TAP interfaces.

This reverts commit 122469f5ad30b563cbefbc753d2a55af4227bb74.

Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoDrop recursively routed packets
Lev Stipakov [Mon, 4 Jan 2016 12:43:44 +0000 (14:43 +0200)] 
Drop recursively routed packets

v2: better method naming

On certain OSes (Windows, OS X) when network adapter is
disabled (ethernet cable pulled off, Wi-Fi hardware switch disabled),
operating system starts to use tun as an external interface.
Outgoing packets are routed to tun, UDP encapsulated, given to
routing table and sent to.. tun.

As a consequence, system starts talking to itself on full power,
traffic counters skyrocket and user is not happy.

To prevent that, drop packets which have gateway IP as
destination address.

Tested on Win7/10, OS X.

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
Trac: 642
Tested-by: ValdikSS <iam@valdikss.org.ru>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1451911424-12970-1-git-send-email-lstipakov@gmail.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/34737757/
Signed-off-by: David Sommerseth <davids@openvpn.net>
(cherry picked from commit e9d64bc03742c96a3d7fe2a473c43d40e5ba2001)

7 years agoDiscourage using 64-bit block ciphers
Steffan Karger [Tue, 16 Aug 2016 14:46:01 +0000 (16:46 +0200)] 
Discourage using 64-bit block ciphers

As discussed with the development team, we should start moving away from
ciphers with a small block size.  For OpenVPN in particular this means
moving away from 64-bit block ciphers, towards 128-bit block ciphers.
This patch makes a start with that by moving ciphers with a block
size < 128 bits to the bottom of the --show-ciphers output, and printing
a warning in the connection phase if such a cipher is used.

While touching this function, improve the output of --show-ciphers by
ordering the output alphabetically, and changing the output format
slightly.

[DS: Fixed C89 issues in patch, moving 'int nid' and 'size_t i' declaration
     to begining of function instead of in the for-loops.  This is also
     required to not break building on stricter compiler setups where C99
     must be enabled explicitly ]

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1471358761-8828-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00030.html
CVE: 2016-6329
Signed-off-by: David Sommerseth <davids@openvpn.net>
7 years agoFix '--cipher none --cipher' crash
Steffan Karger [Tue, 26 Jul 2016 13:57:13 +0000 (15:57 +0200)] 
Fix '--cipher none --cipher' crash

As reported in trac #699, OpenVPN crashes when an "--cipher none" option
is followed by "--cipher" (without arguments).  Fix the crash, and print a
warning to indicate that using --cipher of --auth without an argument is
deprecated.

This is a (partly) backport of the patch I sent for the master branch
yesterday.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1469541433-1671-1-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/12107
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoPromptly close the netcmd_semaphore handle after use
Selva Nair [Tue, 14 Jun 2016 02:34:49 +0000 (22:34 -0400)] 
Promptly close the netcmd_semaphore handle after use

If more than one openvpn processes are running and one aborts
without releasing the semaphore, subsequent processes fail to get
a lock for the semaphore. This may be avoided by not keeping open
handles to the semaphore so that Windows can destroy it when no
open handles remain.

See also: http://article.gmane.org/gmane.network.openvpn.devel/11913

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465871689-13533-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11919
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6aa4c9091300f62fae0bf7a9198de0edd2d8b7c7)

7 years agoRemove NOP function and callers
David Sommerseth [Thu, 7 Jul 2016 11:03:16 +0000 (13:03 +0200)] 
Remove NOP function and callers

multi_release_io_lock() and the calls to this function are not providing
anything at all.  Lets remove it and make the overall code less suprising.

Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1467889519-8193-1-git-send-email-openvpn@sf.lists.topphemmelig.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/12058
(cherry picked from commit 365506d1704f91f827f6e063dc87b325c40e9f29)

7 years agoMove ASSERT so external-key with OpenSSL works again
Arne Schwabe [Fri, 29 Nov 2013 12:32:40 +0000 (13:32 +0100)] 
Move ASSERT so external-key with OpenSSL works again

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1385728360-32127-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8069

trac #693

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

7 years agoComplete push-peer-info documentation and allow IV_PLAT_VER for other platforms than...
Arne Schwabe [Tue, 16 Feb 2016 12:04:40 +0000 (13:04 +0100)] 
Complete push-peer-info documentation and allow IV_PLAT_VER for other platforms than Windows if the client UI supplies it.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1455624280-3165-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11175

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

7 years agoDon't limit max incoming message size based on c2->frame
Steffan Karger [Wed, 8 Jun 2016 12:20:39 +0000 (14:20 +0200)] 
Don't limit max incoming message size based on c2->frame

"Be conservative in what you send, be liberal in what you accept"

When receiving packets, the real limitation of how much data we can accept
is the size of our internal buffers, not the maximum size we expect
incoming packets to have.

I ran into this while working on cipher negotiation, which will need
separate bookkeeping for the required internal buffer size, and the
link/tun MTU.  Basing this code on the buffer size instead of c2->frame
makes that easier.  A nice side-effect of this change is that it
simplifies the code.

This should also reduce the impact of using asymmetric tun/link MTU's,
such as in trac ticket #647.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465388443-15484-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11850
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 3c1b19e04745177185decd14da82c71458442b82)
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Conflicts:
src/openvpn/socket.c

7 years agoIgnore SIGUSR1/SIGHUP during exit notification
Selva Nair [Tue, 7 Jun 2016 04:44:20 +0000 (00:44 -0400)] 
Ignore SIGUSR1/SIGHUP during exit notification

This allows exit notification to complete and finally trigger SIGTERM.
The current practice of allowing a restart in this state clears
the exit notification timer data and thus loses the SIGTERM.

Trac #687

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465274660-11009-2-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11814
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 63b3e000c9141f4ca03a374354da26334257bc18)

7 years agoAnother fix related to unit test framework
David Sommerseth [Fri, 3 Jun 2016 16:56:20 +0000 (18:56 +0200)] 
Another fix related to unit test framework

Continuing to fix breakage caused by commit 40cb4cfc5d011102.

It seems it was a conflict in vendor/Makefile.am's distdir target,
confusing autotools so it wouldn't actually parse that directory
properly.  The result was that 'make distcheck' would fail and
tarballs created would just ship with an empty vendor/ directory.

Also remove the 'foreign' AUTOMAKE_OPTIONS flag, as we don't use
that many places at all.  Things work well without this flag.

The comment had to be moved to a single line, otherwise the
white spaces between the end of the variable assignment and the
hash character got added to the variable.

 [v3 - Further improve white space issues, now 'make clean'
       should work too]
 [v2 - Fix white space issues in path variables]

Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1464976163-6162-1-git-send-email-openvpn@sf.lists.topphemmelig.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11778
(cherry picked from commit 41ab12f06253cadc34fc47da865178de3db0bbdc)

7 years agoMake block-outside-dns work with persist-tun
Selva Nair [Sat, 4 Jun 2016 15:54:08 +0000 (11:54 -0400)] 
Make block-outside-dns work with persist-tun

- Remove and recreate WFP filters during restart even when
  tun/tap is not re-opened. This is needed for resolving the remote.

See also: http://article.gmane.org/gmane.network.openvpn.user/36990

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465055649-13628-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11787
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoClarify the fact that build instructions in README are for release tarballs
Samuli Seppänen [Tue, 31 May 2016 06:53:55 +0000 (09:53 +0300)] 
Clarify the fact that build instructions in README are for release tarballs

URL: https://github.com/OpenVPN/openvpn/pull/51
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: David Sommerseth <dazo@privateinternetaccess.com>
Message-Id: <1464677635-24251-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11746
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
(cherry picked from commit fdc24f1e986c5d8ecdf37c3d0f913f3549087852)

7 years agoPlug memory leak in mbedTLS backend
Ivo Manca [Tue, 31 May 2016 11:42:33 +0000 (13:42 +0200)] 
Plug memory leak in mbedTLS backend

Signed-off-by: Ivo Manca <pinkel@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1464694953-3681-1-git-send-email-pinkel@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11752
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
7 years agoOnly build and run cmocka unit tests if its submodule is initialized
David Sommerseth [Tue, 31 May 2016 10:28:46 +0000 (12:28 +0200)] 
Only build and run cmocka unit tests if its submodule is initialized

Commit 40cb4cfc5d01110 added infrastructure to write unit tests using
cmocka.  This was implemented using a git submodule to fetch an
up-to-date cmocka test framework.

The issue which appeared was that 'make check' stopped working if
the cmocka submodule was not initialized and updated.  As we do not
want this to be a hard depenency, this patch makes running these
unit tests conditional.  If cmocka has not been initialized, skip
them or if it has been initialized all unit tests will be run.

 [v2 - Also check if cmake is available, as cmocka depends on that
       to be built ]

Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1464703645-26640-1-git-send-email-openvpn@sf.lists.topphemmelig.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11758
(cherry picked from commit 45f6e7991cfa3bb8a44f981b6cf1e794d617d51e)

7 years agoUpdate contrib/pull-resolv-conf/client.up for no DOMAIN
Jeffrey Cutter [Fri, 20 May 2016 09:25:10 +0000 (12:25 +0300)] 
Update contrib/pull-resolv-conf/client.up for no DOMAIN

When no DOMAIN is received from push/pull, do not add either domain or
search to the resolv.conf. Fix typo in comment resolv.con[f]. Only add
new line when using domain or search.

URL: https://github.com/OpenVPN/openvpn/pull/34
Acked-by: Steffan Karger <steffan@karger.me>
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1463736310-17846-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11682
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
(cherry picked from commit 4a506b9ca2d8bbfaa5d49c6fe9a073d8ff3e59d1)

7 years agoAdd link to bug tracker
Leon Klingele [Mon, 30 May 2016 19:54:58 +0000 (22:54 +0300)] 
Add link to bug tracker

URL: https://github.com/OpenVPN/openvpn/pull/25
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: David Sommerseth <dazo@privateinternetaccess.com>
Message-Id: <1464638098-19187-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11735
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
(cherry picked from commit ac2309b889552f2a0382414ff46b2682c2101674)

7 years agoAdd a test for auth-pam searchandreplace
Jens Neuhalfen [Wed, 25 May 2016 17:57:56 +0000 (19:57 +0200)] 
Add a test for auth-pam searchandreplace

No functional changes.

Utility functions of auth-pam are split into a dedicated file. This allows
the test programs to easily test these functions without adding
dependencies.

Add a minimal test for searchandreplace as a proof of concept.

[ Modified during commit: Enhanced documentation of functions in utils.h
  to comply with doxygen standards ]

Signed-off-by: Jens Neuhalfen <jens@neuhalfen.name>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <20160525175756.56186-3-openvpn-devel@neuhalfen.name>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11724
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
(cherry picked from commit 4507bb6cd11799f72f1ede602315a60e03bb449c)

7 years agoAdd unit testing support via cmocka
Jens Neuhalfen [Wed, 25 May 2016 17:57:55 +0000 (19:57 +0200)] 
Add unit testing support via cmocka

cmocka [1,2] is a testing framework for C. Adding unit test
capabilities to the openvpn repository will greatly ease the
task of writing correct code.

cmocka source code is added as git submodule in ./vendor. A
submodule approach has been chosen over a classical library
dependency because libcmocka is not available, or only
available in very old versions (e.g. on Ubuntu).

cmocka is build during 'make check' and installed in vendor/dist/.

[1] https://cmocka.org/
[2] https://lwn.net/Articles/558106/

Signed-off-by: Jens Neuhalfen <jens@neuhalfen.name>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <20160525175756.56186-2-openvpn-devel@neuhalfen.name>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11725
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
(cherry picked from commit 40cb4cfc5d011102daec61ab39583cba0eeb3077)

7 years agoUpdate CONTRIBUTING.rst to allow GitHub PRs for code review purposes
Samuli Seppänen [Thu, 19 May 2016 08:51:49 +0000 (11:51 +0300)] 
Update CONTRIBUTING.rst to allow GitHub PRs for code review purposes

Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1463647909-18383-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11679
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 698f0dab76741f4ce8c1a98236786d59eca338ef)

7 years agoPush an IPv6 CIDR mask used by the server, not the pool's size
Josh Cepek [Mon, 18 Aug 2014 10:51:01 +0000 (05:51 -0500)] 
Push an IPv6 CIDR mask used by the server, not the pool's size

Correctly handle CIDR masks when pushing clients addressing from an IPv6
pool. This change ignores the incorrectly used `bits` argument to the
--ifconfig-ipv6-pool option.

The code to save any provided CIDR mask after the pool IP is left in;
this may someday become useful when we move to allow IPv6 pools without
relying on an IPv4 pool assignment.

Signed-off-by: Josh Cepek <josh.cepek@usa.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <53F1DA95.7020701@usa.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8990
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c4ed931a70502a351ff1089aa1bfb8001586f788)

7 years agoMake error non-fatal while deleting address using netsh
Selva Nair [Sat, 14 May 2016 00:31:23 +0000 (20:31 -0400)] 
Make error non-fatal while deleting address using netsh

During windows power events such as sleep or suspend, the TUN/TAP
I/O aborts and openvpn signals SIGHUP so as to automatically reconnect
on resume (since commit ea66a2b5cdb2..). During the SIGHUP processing
operations such as address and route deletion are expected to fail. Such
failures should be treated as non-fatal to allow for this automatic
recovery logic to work. Currently, when the address deletion is handled
by netsh, errors are treated as M_FATAL. This patch changes the error
level to M_WARN.

Resolves Trac #71 (comments 37 to 43)

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1463185884-4355-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11655
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 years agoAdd CHACHA20-POLY1305 ciphersuite IANA name translations.
Dorian Harmans [Fri, 13 May 2016 16:44:52 +0000 (18:44 +0200)] 
Add CHACHA20-POLY1305 ciphersuite IANA name translations.

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1463157892-701-1-git-send-email-dorian@woohooyeah.nl>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11651

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

7 years agoFix polarssl / mbedtls builds
Steffan Karger [Fri, 13 May 2016 06:54:52 +0000 (08:54 +0200)] 
Fix polarssl / mbedtls builds

Commit 8a399cd3 hardened the OpenSSL default cipher list,
but also introduced a change in shared code that causes
polarssl / mbedtls builds to break when no --tls-cipher is
specified.

This fix is backported code from the master branch.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1463122492-701-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11647
Signed-off-by: Gert Doering <gert@greenie.muc.de>