]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
11 years agoExtend t_lpback tests to test all ciphers reported by --show-ciphers
Steffan Karger [Sun, 8 Jun 2014 16:16:15 +0000 (18:16 +0200)] 
Extend t_lpback tests to test all ciphers reported by --show-ciphers

... instead of just BF-CBC. Should catch more mistakes.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1402244175-31462-5-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8777
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b2bff9fa15695f2850999688b0ca6047016fd7f5)

11 years agoImprove --show-ciphers to show if a cipher can be used in static key mode
Steffan Karger [Sun, 8 Jun 2014 15:04:32 +0000 (17:04 +0200)] 
Improve --show-ciphers to show if a cipher can be used in static key mode

Also remove the bulky warning from init_key_type() and add the information
to the --show-ciphers output.

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: <53BAEF65.2070509@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8852
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d344820faeae987f52e574e15812c86aa5c59ae6)

11 years agoAdd proper check for crypto modes (CBC or OFB/CFB)
Steffan Karger [Sun, 8 Jun 2014 16:16:13 +0000 (18:16 +0200)] 
Add proper check for crypto modes (CBC or OFB/CFB)

OpenSSL has added AEAD-CBC mode ciphers like AES-128-CBC-HMAC-SHA1, which
have mode EVP_CIPH_CBC_MODE, but require a different API (the AEAD API).
So, add extra checks to filter out those AEAD-mode ciphers.

Adding these made the crypto library agnostic function cfb_ofb_mode()
superfuous, so removed that on the go.

Also update all cipher mode checks to use the new cipher_kt_mode_*()
functions for consistency.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1402244175-31462-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8779
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a4b27b6481c7496f2a8705c993edfe150a3541cb)

11 years agoRename ALLOW_NON_CBC_CIPHERS to ENABLE_OFB_CFB_MODE, and add to configure.
Steffan Karger [Sun, 8 Jun 2014 16:16:12 +0000 (18:16 +0200)] 
Rename ALLOW_NON_CBC_CIPHERS to ENABLE_OFB_CFB_MODE, and add to configure.

Makes OFB/CFB compile time configurable, and fixes output of --show-ciphers
to also show OFB/CFB ciphers along the way (becasue crypto.h was not
included from crypto_openssl.c).

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1402244175-31462-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8781
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c353af2f474f79bfd7b2b67ecc02e91152500209)

11 years agorefine assertion to allow other modes than CBC
Heiko Hund [Thu, 16 Aug 2012 08:38:50 +0000 (10:38 +0200)] 
refine assertion to allow other modes than CBC

cipher_ctx_final() only returns an outlen in CBC mode. If CFB or OFB
are used the assertion outlen == iv_len is always false.

There's no CBC mode defined for the GOST 28147-89 block cipher. Hence
this patch is needed for it to work. It's needed for other ciphers like
BF-CFB as well, though.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <538A00AA.7090007@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8748
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit be46a2c083a6bd77754bc1674249eab583d25dac)

11 years agoFix socket-flag/TCP_NODELAY on Mac OS X
James Bekkema [Thu, 26 Jun 2014 11:40:39 +0000 (21:40 +1000)] 
Fix socket-flag/TCP_NODELAY on Mac OS X

Hi All,

OpenVPN 2.3.4 will currently throw a warning of "NOTE: setsockopt
TCP_NODELAY=1 failed (No kernel support) when attempting to use the
TCP_NODELAY socket option on Mac OS X/Darwin. Kernel support is there,
however the required header file where TCP_NODELAY is defined is not being
included. This patch simply alters syshead.h to include <netinet/tcp.h> on
Darwin platforms.

Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <A1005665-126D-45D5-A6F2-75ED0EAE30FE@sparklabs.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8809

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

11 years agoFix some typos in the man page.
Andris Kalnozols [Sat, 28 Jun 2014 17:45:48 +0000 (19:45 +0200)] 
Fix some typos in the man page.

Signed-off-by: Andris Kalnozols <andris@hpl.hp.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <53AF0D20.7020204@karger.me>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b443772bb6fa9177ab015e8b69fbd804cfffee6b)

11 years agoUpdate README.polarssl
Steffan Karger [Tue, 24 Jun 2014 20:03:25 +0000 (22:03 +0200)] 
Update README.polarssl

PolarSSL support has been extended and adjusted, but README.polarssl was
not accordingly adjusted. This updates README.polarssl to the current state
of affairs for OpenVPN 2.3.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1403640206-7024-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8804
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix bug that incorrectly refuses oid representation eku's in polar builds
Steffan Karger [Fri, 25 Apr 2014 08:41:17 +0000 (10:41 +0200)] 
Fix bug that incorrectly refuses oid representation eku's in polar builds

The return value of x509_get_numeric_string() was interpreted incorrectly
by ssl_verify_polarssl.c's x509_verify_cert_eku(). This patch enables the
usage of oid represenation in --remote-cert-eku options.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Message-Id: <1398415277-6880-1-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8627
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e238b806f5f3843b80d5b1b2b269679210faa7f6)

11 years agoImprove error reporting on file access to --client-config-dir and --ccd-exclusive
David Sommerseth [Fri, 2 May 2014 00:28:24 +0000 (02:28 +0200)] 
Improve error reporting on file access to --client-config-dir and --ccd-exclusive

OpenVPN will do some simple sanity checking at startup to ensure
the expected files and directories is in place.  However, with
--client-config-dir and --ccd-exclusive, things are slightly different.
In both cases it is perfectly fine that files does not exists, and we
cannot know any file names beforehand due to these filenames being based
upon the certificate's CN field.

The problem arises when OpenVPN cannot open files inside a directory
because the directory permissions are too restrictive, have wrong
ownership (triggered by the usage of --user/--group) or other security
mechanisms the OS uses.

When a client connects, the test_file() function is used to check if a
client config file has been prepared.  And if not, it continues without
trying to read it.  So, if the privileges of the running OpenVPN process
is not allowed to open and read an existing file, OpenVPN will treat this
as a non-existing file without saying anything.  This is clearly wrong.
So this patch adds an warning message in the OpenVPN log if it could
not open the file due to lack of permissions.

This will work fine on all *nix based OSes.  Windows however reports
'no such file or directory' (errno=2/-ENOENT) even on privilege access
errors when the directory this file resides is too restrictive.  But there
is no easy way to work around that.  However, I believe that the initial
sanity checking at startup will catch that one, as it will check if the
directories it needs exists.

This patch has only gone through simple basic testing, with both too few
privileges and with proper privileges to the CCD directory.  With wrong
privileges, the following error can be found if CN=Test client

  Fri May  2 00:00:10 2014 us=281993 127.0.0.1:41017 Could not access file
'/etc/clients/Test client': Permission denied (errno=13)

[v2 - use openvpn_errno() instead of errno, for better platform support]

Trac: #277
Trac-URL: https://community.openvpn.net/openvpn/ticket/277
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1398990504-4239-1-git-send-email-dazo@users.sourceforge.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8688
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 4978dadaed4ecf1b9dd256f57c6a5c895691580b)

11 years agoDrop incoming fe80:: packets silently now.
Gert Doering [Fri, 6 Jun 2014 18:43:55 +0000 (20:43 +0200)] 
Drop incoming fe80:: packets silently now.

IPv6 has the concept of "link local" addresses, fe80::<host id>, which
normally are present on every link, and are used for stuff like DHCPv6,
neighbor discovery, etc.

OpenVPN point-to-multipoint mode currently does neither configure them on
tun interfaces, nor are they handled in a meaningful way if a client OS
always has them (like Windows or Solaris) - so the log fills with many
lines of "MULTI: bad source address from client [fe80::...]", serving
no useful purpose.

This patch just recognizes IPv6 LL packets and silently drops them.

Further patches can build on this and add full link-local support, which
would require address learning (as the addresse are based on host IDs, not
assigned by the server).

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1402080235-24409-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8773
(cherry picked from commit 70f1864188ad00451683cabf51e56b7730250c40)

11 years agoRemove unneeded wrapper functions in crypto_openssl.c
Steffan Karger [Sun, 25 May 2014 22:08:33 +0000 (00:08 +0200)] 
Remove unneeded wrapper functions in crypto_openssl.c

Both EVPCipherInit_ov() and EVPCipherUpdate_ov() wrapped OpenSSL functions
without any changes, so lets just use the functions directly.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401055713-9891-3-git-send-email-steffan@karger.me>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoRemove function without effect (cipher_ok() always returned true).
Steffan Karger [Sun, 25 May 2014 22:08:32 +0000 (00:08 +0200)] 
Remove function without effect (cipher_ok() always returned true).

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401055713-9891-2-git-send-email-steffan@karger.me>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFixed some compile issues with show_library_versions()
James Yonan [Thu, 8 May 2014 22:50:36 +0000 (16:50 -0600)] 
Fixed some compile issues with show_library_versions()

* Refactored show_library_versions to work around the fact
  that some compilers (such as MSVC 2008) can't handle #ifdefs
  inside of macro references.

* Declare show_library_versions() in options.h because it's
  referenced by other files such as openvpn.c.

* Declare get_ssl_library_version() as returning const char *,
  to avoid loss of const qualifier in ssl_openssl.c.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-7-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8711
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoDefine PATH_SEPARATOR for MSVC builds.
James Yonan [Thu, 8 May 2014 22:50:35 +0000 (16:50 -0600)] 
Define PATH_SEPARATOR for MSVC builds.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-6-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8714
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoMSVC 2008 doesn't support dimensioning an array with a const var nor using %z as...
James Yonan [Thu, 8 May 2014 22:50:34 +0000 (16:50 -0600)] 
MSVC 2008 doesn't support dimensioning an array with a const var nor using %z as a printf format specifier.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-5-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8710
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoExplicitly cast the third parameter of setsockopt to const void * to avoid warning.
James Yonan [Thu, 8 May 2014 22:50:33 +0000 (16:50 -0600)] 
Explicitly cast the third parameter of setsockopt to const void * to avoid warning.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-4-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8708
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoIn socket.c, fixed issue where uninitialized value (err) is being passed to to gai_st...
James Yonan [Thu, 8 May 2014 22:50:32 +0000 (16:50 -0600)] 
In socket.c, fixed issue where uninitialized value (err) is being passed to to gai_strerror.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-3-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8713
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFixed several instances of declarations after statements.
James Yonan [Thu, 8 May 2014 22:50:31 +0000 (16:50 -0600)] 
Fixed several instances of declarations after statements.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-2-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8709
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoPreparing for release v2.3.4 (ChangeLog, version.m4) v2.3.4
Gert Doering [Wed, 30 Apr 2014 11:37:57 +0000 (13:37 +0200)] 
Preparing for release v2.3.4 (ChangeLog, version.m4)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoMake serial env exporting consistent amongst OpenSSL and PolarSSL builds.
Steffan Karger [Mon, 28 Apr 2014 19:50:22 +0000 (21:50 +0200)] 
Make serial env exporting consistent amongst OpenSSL and PolarSSL builds.

This changes the representation of the tls_serial_{n} environment variable
from hex to decimal for PolarSSL builds, to match OpenSSL build behaviour.

Because hex representation for serials makes sense too, and to ease
transition for PolarSSL users, added tls_serial_hex_{n} that exports the
serial in hex represenation for both crypto library backends.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <535EB49E.5090809@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8664
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoWhen tls-version-min is unspecified, revert to original versioning approach.
James Yonan [Mon, 28 Apr 2014 20:52:11 +0000 (22:52 +0200)] 
When tls-version-min is unspecified, revert to original versioning approach.

For OpenSSL, this means to use TLSv1_(client|server)_method rather
than SSLv23_(client|server)_method combined with SSL_OP_NO_x flags
for specific TLS versions to disable.

For PolarSSL, this means to implicitly control the TLS version via allowed
ciphersuites.

Point out off-by-default-now setting in the openvpn(8) man page.

This patch is only included in the release/2.3 branch, because it's a
stopgap measure.  2.4 will have it on-by-default, when the remaining
handshake problems are fully debugged and solved.

Signed-off-by: James Yonan <james@openvpn.net>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: <535EC5FE.6060302@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8665
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoConditionalize calls to print_default_gateway on !ENABLE_SMALL
Gert Doering [Tue, 29 Apr 2014 21:09:39 +0000 (23:09 +0200)] 
Conditionalize calls to print_default_gateway on !ENABLE_SMALL

Calls to print_default_gateway() depended on #ifdef ENABLE_DEBUG, but
the actual function wasn't compiled in #ifdef ENABLE_SMALL, so the
combination "configure --enable-small --enable-debug" didn't work. Fix.

Fix trac #397

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1398805779-29376-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8670
(cherry picked from commit c29e08a2f33234fb705a8323c0d9e1e07b0773fd)

11 years agoFix is_ipv6 in case of tap interface.
Dmitrij Tejblum [Sat, 8 Feb 2014 15:33:49 +0000 (19:33 +0400)] 
Fix is_ipv6 in case of tap interface.

While checking a packet on a TAP interface, is_ipv_X() in proto.c
insist that the ethertype must be OPENVPN_ETH_P_IPV4, even if
the protocol is IPv6. So the protocol never match, and, thus,
mssfix doesn't work for IPv6 on TAP interface. Fix that.

Signed-off-by: Dmitrij Tejblum <dt@yandex.ru>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1391873629-14388-1-git-send-email-dt@yandex.ru>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8259
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit db037c20086587a609ef33127c15de080270f2cb)

11 years agoFix build system to accept non-system crypto library locations for plugins.
Steffan Karger [Mon, 21 Apr 2014 11:37:18 +0000 (13:37 +0200)] 
Fix build system to accept non-system crypto library locations for plugins.

Flags like {OPEN,POLAR}SSL_CFLAGS were used by the core build, but not by
the plugins. However, all plugins include openvpn-plugin.h, which need
crypto/ssl headers.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1398080238-19662-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8576
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit ea31bc680fc83946b2cc8d0c93544a1ab2a01d63)

11 years agoMore IPv6-related updates to the openvpn man page.
Gert Doering [Sat, 26 Apr 2014 11:30:54 +0000 (13:30 +0200)] 
More IPv6-related updates to the openvpn man page.

Point to correct kernel version for --multihome and IPv4-mapped
addresses (3.15, Tore Anderson).

Remove old reference to http://www.greenie.net/ from the IPv6 section,
as the code and documentation in here is more current than on that site.
Some more additions and clarifications.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Tore Anderson <tore@fud.no>
Message-Id: <1398511854-3609-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8642
(cherry picked from commit 2a97e69e71d4afb9c32268890e13db19cb73196b)

11 years agoFix OCSP_check.sh to also use decimal for stdout verification.
Steffan Karger [Sun, 27 Apr 2014 08:49:21 +0000 (10:49 +0200)] 
Fix OCSP_check.sh to also use decimal for stdout verification.

This is an extra fix needed on top of 959d607, which already changes the
serial parameter to correctly use decimal representation.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1398588561-18964-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8650
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6ea78cbef6367590567156a20106c620fec224c9)

11 years agoChange signedness of hash in x509_get_sha1_hash(), fixes compiler warning.
Steffan Karger [Sun, 27 Apr 2014 07:55:48 +0000 (09:55 +0200)] 
Change signedness of hash in x509_get_sha1_hash(), fixes compiler warning.

hash was cast from char * to unsigned char * at the return of the function.
This patch removes the implicit cast by declaring hash as unsigned char * .

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1398585348-7969-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8647
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d4309c21d9cde43c777985e373242afa78afefa1)

11 years agoRewrite manpage section about --multihome
Gert Doering [Fri, 25 Apr 2014 19:19:15 +0000 (21:19 +0200)] 
Rewrite manpage section about --multihome

Part of the information was confusing, part was outdated, and part was
just not making sense.  Pointed out in trac#348.

Also add note about Linux IPv4-mapped issues as per trac#306.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1398453555-19706-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8635
(cherry picked from commit abe18c69a61b42e5ac68b77f66198fc15be99e31)

11 years agoRepair --multihome on FreeBSD for IPv4 sockets.
Gert Doering [Sun, 19 Jan 2014 20:51:37 +0000 (21:51 +0100)] 
Repair --multihome on FreeBSD for IPv4 sockets.

The code in link_socket_write_udp_posix_sendmsg() for the IP_RECVDESTADDR
case was sending a too-large control message (sizeof openvpn_pktinfo,
which is a union for IPv4+IPv6) instead of just openvpn_in4_pktinfo,
leading to sendmsg() refusing to send the packet.

Use RFC 2292 macros for alignment + size calculation.

Fix trac#327

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Lazy-Ack-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1390164697-1590-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8250
(cherry picked from commit 661d914c8732a208580b1eab167255c85da162c9)

11 years agoFix man page and OSCP script: tls_serial_{n} is decimal
Arne Schwabe [Fri, 28 Mar 2014 10:07:01 +0000 (11:07 +0100)] 
Fix man page and OSCP script: tls_serial_{n} is decimal

Commit 7d5e26cbb53 fixed extracting serial but did not change the format,
which always has been decimal. This patch fixes the manpage and
OSCP.sh script to conform with the implementation.
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1396001222-5033-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8409

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

11 years agoMinor t_client.sh cleanups
Gert Doering [Sun, 20 Apr 2014 18:41:01 +0000 (20:41 +0200)] 
Minor t_client.sh cleanups

- remove built tests/t_client.sh script on "make clean"
- ignore Linux iproute2 "ssthresh <n>" output that sometimes shows up
  in "ip -6 route show" and breaks before/after comparison

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1398019261-30180-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8557
(cherry picked from commit 1e3a1786a80e4afac37133ce5d6a1dcff779a4ce)

11 years agoUse native strtoull() with MSVC 2013.
James Yonan [Mon, 21 Apr 2014 07:10:03 +0000 (01:10 -0600)] 
Use native strtoull() with MSVC 2013.

MSVC 2013 C library now defines strtoull() function,
so use the native implementation when available.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1398064204-26476-3-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8561
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6b8e2f4a8143a7260a06b6999dcb21c4c72fc620)

11 years agoAdd SSL library version reporting.
Gert Doering [Sun, 13 Apr 2014 15:29:32 +0000 (17:29 +0200)] 
Add SSL library version reporting.

Print the version of the SSL and LZO library (if any) used.

SSL library version is also sent as IV_SSL=<version> to the server if
--push-peer-info is enabled.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20140416152456.GI16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8537
(cherry picked from commit 1ec984b154aa3247ef58c9d44e7e477880b632b1)

11 years agoIPv6 address/route delete fix for Win8
Gert Doering [Sun, 13 Apr 2014 11:12:02 +0000 (13:12 +0200)] 
IPv6 address/route delete fix for Win8

Use "store=active" for IPv6 address and route deletion - seems to be
required on Windows 8 and up, and not doing it will break OpenVPN
reconnection (old addresses are not properly deleted, thus address can
not be configured on connect).

Reported-by: Cedric <cedric+openvpn@bgtn.net>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Cedric Tabary <cedric+openvpn@bgtn.net>
Message-Id: <20140413170648.GU16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8499
(cherry picked from commit 4b4fac9184fcea1eab4f4223309211780cee188a)

11 years agoFix SOCKSv5 method selection
Yawning Angel [Mon, 10 Mar 2014 03:47:58 +0000 (03:47 +0000)] 
Fix SOCKSv5 method selection

So, RFC 1928 doesn't say anything about the METHODS field in the Method
Selection message being ordered in terms of preference or anything, and
the server is free to pick any of the METHODS offered by the client.

Always sending a Method Selection message with NO AUTHENTICATION REQUIRED
and USERNAME/PASSWORD set is broken on two fronts:

 * If the OpenVPN client can't handle the server picking USERNAME/PASSWORD
   due to the credentials being missing, it shouldn't offer it to the
server.

 * If the OpenVPN client has credentials, then it should always attempt to
   authenticate.  This is a security product.  "You can misconfigure it and
   it will work" is not acceptable.  Setting a username/password when the
   SOCKS server doesn't require/support that as an option is the user not
   configuring it correctly, and should be treated as such.

Also verify that the SOCKS server returned the auth that was requested.

URL: https://github.com/OpenVPN/openvpn/pull/14
Fix trac #377, trac #148
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20140413130102.GR16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8488

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

11 years agoFix typo in sample build script to use LDFLAGS
kangsterizer [Sun, 13 Apr 2014 11:15:00 +0000 (13:15 +0200)] 
Fix typo in sample build script to use LDFLAGS

Came in as github pull request #15

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-By: Arne Schwabe <arne@rfc2549.org>
(cherry picked from commit a95358af543b9106f4ef481e4556d1d03459d058)

11 years agoPreparing for v2.3.3 (ChangeLog, version.m4) v2.3.3
Gert Doering [Tue, 8 Apr 2014 15:02:39 +0000 (17:02 +0200)] 
Preparing for v2.3.3 (ChangeLog, version.m4)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoAdd openssl-specific common cipher list names to ssl.c.
Steffan Karger [Sat, 1 Mar 2014 14:36:14 +0000 (15:36 +0100)] 
Add openssl-specific common cipher list names to ssl.c.

This adds a number of commonly used cipher list names to ssl.c, which makes
OpenVPN not give a "translation not found" warning when using these.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1393684575-28112-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8316
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 0146fd00c3bd70a470290be7be27ee75db2db63b)

11 years agoWorkaround missing SSL_OP_NO_TICKET in earlier OpenSSL versions
Gert Doering [Sun, 23 Mar 2014 12:19:08 +0000 (13:19 +0100)] 
Workaround missing SSL_OP_NO_TICKET in earlier OpenSSL versions

058e889d introduced using SSL_OP_NO_TICKET, leading to build failures on
systems that could build 2.3.2 fine.  Inside the 2.3 release train, we
do not want to change requirements, so for those build environments, ignore
missing SSL_OP_NO_TICKET.  2.4 will require more recent OpenSSL, though.

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20140322183508.GZ16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8384

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoSet SSL_OP_NO_TICKET flag in SSL context for OpenSSL builds, to disable TLS stateless...
James Yonan [Mon, 17 Mar 2014 00:49:36 +0000 (18:49 -0600)] 
Set SSL_OP_NO_TICKET flag in SSL context for OpenSSL builds, to disable TLS stateless session resumption.

OpenVPN doesn't want or need SSL session renegotiation or
resumption, as it handles renegotiation on its own.

For this reason, OpenVPN always disables the SSL session cache:

SSL_CTX_set_session_cache_mode (ctx, SSL_SESS_CACHE_OFF)

However, even with the above code, stateless session resumption
is still possible unless explicitly disabled with the
SSL_OP_NO_TICKET flag.  This patch does this.

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1395017376-24554-1-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8346

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

11 years agoIntroduce safety check for http proxy options
Arne Schwabe [Mon, 17 Mar 2014 12:56:53 +0000 (13:56 +0100)] 
Introduce safety check for http proxy options

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

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

11 years agoFix "." in description of utun.
Thomas Veerman [Thu, 23 Jan 2014 12:52:47 +0000 (13:52 +0100)] 
Fix "." in description of utun.

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

11 years agoReplace copied structure elements with including <net/route.h>
Gert Doering [Mon, 13 Jan 2014 21:54:34 +0000 (22:54 +0100)] 
Replace copied structure elements with including <net/route.h>

The code for FreeBSD, Dragonfly, OpenBSD and NetBSD contained copies
of structures from <net/route.h> (struct rt_msghdr in particular).

OpenBSD changed some structure elements, making OpenVPN incompatible,
depending on the specific OpenBSD version.  Clean up: remove copied
definitions, replace by including <net/route.h> directly - this could
not be done originally due to a conflict with "struct route" in OpenVPN
and <net/route.h>, cleaned up by the previous commit.

Tested on FreeBSD 9.1-RELEASE, NetBSD 5.1, OpenBSD 4.9 (route.c compiles
with no warnings, and "openvpn --show-gateway" works, which is the only
part of the code that uses the structures in question).

Fix trac #340

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389650074-18455-2-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8230
(cherry picked from commit 615fb9ef36310f85fd6171301128a12740444455)

11 years agoRename 'struct route' to 'struct route_ipv4'
Gert Doering [Mon, 13 Jan 2014 21:54:33 +0000 (22:54 +0100)] 
Rename 'struct route' to 'struct route_ipv4'

To fix trac #340, we need to rename our "struct route" to avoid a
collision with "struct route" from <net/route.h> on *BSD.

No functional changes.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389650074-18455-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8231
(cherry picked from commit b57e005b8f232760081875937a53e8e7d235faa6)

11 years agoDocument issue with --chroot, /dev/urandom and PolarSSL.
Gert Doering [Sat, 11 Jan 2014 11:50:36 +0000 (12:50 +0100)] 
Document issue with --chroot, /dev/urandom and PolarSSL.

See trac#218

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1389441036-12538-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8213
(cherry picked from commit b238a1f2d4b2cdcfc844689b33fd3ac43ed31c1c)

11 years agoReduce IV_OPENVPN_GUI_VERSION= to IV_GUI_VER=
Gert Doering [Thu, 9 Jan 2014 19:46:41 +0000 (20:46 +0100)] 
Reduce IV_OPENVPN_GUI_VERSION= to IV_GUI_VER=

Use shorter variable name to signal the same thing (see f3a2cd255a3bc73)
to save space in the buffer used by the collective IV_ info sent to server.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389296891-1487-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8183
(cherry picked from commit 7efaca734b8d633441ec3d7def2a2768864dedcf)

11 years agoMake code and documentation for --remote-random-hostname consistent.
Gert Doering [Sun, 17 Nov 2013 14:30:20 +0000 (15:30 +0100)] 
Make code and documentation for --remote-random-hostname consistent.

Documentation examples, description and code were disagreeing on what
this option actually does.  Now they will all agree that it will
*prepend* a random-byte string to the hostname name before resolving
to work around DNS caching (needs a "*" wildcard record in the zone).

Fix trac #143

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1384698620-27946-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7999
(cherry picked from commit 7de8f3f322c1a1c13022a0243267624930dac5c9)

11 years agoFix spurious ignoring of pushed config options (trac#349).
Jens Wagner [Tue, 7 Jan 2014 21:07:54 +0000 (22:07 +0100)] 
Fix spurious ignoring of pushed config options (trac#349).

The function incoming_push_message(...) in push.c uses a local variable
option_types_found, that gets passed to do_up(...).

If the server push got split into several parts, only the last part
(PUSH_MSG_REPLY) option_types_found is used for do_up (initilized as 0
locally), the previous ones (PUSH_MSG_CONTINUATION) are ignored.

So e.g. a ping config, pushed by the server in the first push, followed
by a lot of "push route" configs, causing a second push message, will
have the do_up() called, but without e.g. the OPT_P_TIMER flag, so those
options will be silently ignored.

The patch resolves that, by introducing "push_option_types_found" in
"c->options" and using that as storage.

Fix trac bug #349.

Acked-by: Gert Doering <gert@greenie.muc.de>
URL: https://community.openvpn.net/openvpn/ticket/349
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 1aac9a0b7a4046822a0134cd8693a828f2e16576)

11 years agoIf --tls-cipher is supplied, make --show-tls parse the list.
Steffan Karger [Wed, 1 Jan 2014 20:10:23 +0000 (21:10 +0100)] 
If --tls-cipher is supplied, make --show-tls parse the list.

This allows to check the available TLS ciphers for a specific configuration
by supplying both --tls-cipher and --show-tls options.

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: <1388607026-12297-4-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8150
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit cb03dca83e37fd65666bf776f39da902fb10acbc)

11 years agoUpdate TLSv1 error messages to SSLv23 to reflect changes from commit 4b67f98
Steffan Karger [Wed, 1 Jan 2014 20:10:22 +0000 (21:10 +0100)] 
Update TLSv1 error messages to SSLv23 to reflect changes from commit 4b67f98

Commit 4b67f98 changed call to TLSv1_{client,server}_method() to
SSLv23_{client,server}_method(), this commit updates the corresponding
error messages to match the changes in the code.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1388607026-12297-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8147
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 441be9f4f91a16218d40b401384ead51b5aac0cc)

11 years agoAlso update TLSv1_method() calls in support code to SSLv23_method() calls.
Steffan Karger [Wed, 1 Jan 2014 20:10:21 +0000 (21:10 +0100)] 
Also update TLSv1_method() calls in support code to SSLv23_method() calls.

Commit 4b67f98 changed calls to TLSv1_{sever,client}_method() to
SSLv23_{client,server}_method() to enable TLS version negotiation. This
commit does the same for two calls of TLSv1_method() from support code.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1388607026-12297-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8148
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit dd3e319c1d66c7da51b8555d745a1139e0b322f2)

11 years agoUse RSA_generate_key_ex() instead of deprecated, RSA_generate_key()
Steffan Karger [Sun, 15 Dec 2013 18:34:27 +0000 (19:34 +0100)] 
Use RSA_generate_key_ex() instead of deprecated, RSA_generate_key()

This patch moves from using the deprecated RSA_generate_key() to the 'new'
RSA_generate_key_ex() to generate ephemeral RSA keys. This patch does
not change OpenVPN's behaviour.

One note on the implementation though; the code generates one ephemeral
RSA key that is used during the entire lifetime of an OpenVPN process.
If OpenSSL requests a new (ephemeral) key, it will keep on returning the
same (usually rather small) key. Not the best solution.

To actually run this code, I had to force usage by selecting the
TLS-RSA-EXPORT-WITH-DES40-CBC-SHA tls-cipher. That generated a 512-bit
ephemeral RSA key, and uses the outdated DES encryption protocol.

Using this mode could lead to a false sense of security. Then again, one
should be using (Ephemeral) Diffie-Hellman anyway, and OpenVPN requires
a tls-server to supply dh parameters. A user would need to deliberately
choose a weak tls-cipher like TLS-RSA-EXPORT-WITH-DES40-CBC-SHA, which
would be aligning a gun with his foot anyway. If one would decide this
implementation is not good enough anymore, I'd suggest to just strip out
support for this completely.

Code has been tested using the TLS-RSA-EXPORT-WITH-DES40-CBC-SHA tls-cipher
which uses this to create ephemeral RSA keys.

This should resolve trac#197.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <52ADF633.8040003@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8110

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoAdd warning for using connection block variables after connection blocks
Arne Schwabe [Tue, 17 Dec 2013 10:22:47 +0000 (11:22 +0100)] 
Add warning for using connection block variables after connection blocks

In 2.3  some options that were allowed only in global config before have
been moved to connection blocks. This changes the behaviour if the
variables were defined after connection block. This patch adds a warning
to catch these mistakes.

Also let warnings errors show [CONNECTION-OPTIONS] instead of [CMD-LINE]
for connection blocks
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1387275767-10303-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8117

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

11 years agoFix file checks when --chroot is being used
David Sommerseth [Mon, 25 Nov 2013 12:32:58 +0000 (13:32 +0100)] 
Fix file checks when --chroot is being used

Commit 0f2bc0dd92f43c9 started to introduce some file sanity
checking before OpenVPN started to avoid harder to explain issues
due to missing files or directories later on.  But that commit
did not consider --chroot at all.  Which would basically cause
OpenVPN to complain on non-missing files, because it would not
consider that the files where inside a chroot.

This patch is based on the thoughts in a patch by Josh Cepek [1],
but trying to simplify it at bit.

[1] <http://thread.gmane.org/gmane.network.openvpn.devel/7873>,
    (Message-ID: l142b7$15v$1@ger.gmane.org)

[v2 - Simplify the changes in check_cmd_access(), let the chroot
      tackling happen only in check_file_access_chroot() only]

Trac-ticket: 330
Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1385382778-4723-1-git-send-email-dazo@users.sourceforge.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8060
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b77bffe8186647c6fd1f2f76aac41fd45719edb8)

11 years agopkcs11: use generic evp key instead of rsa
Alon Bar-Lev [Mon, 11 Nov 2013 22:36:06 +0000 (00:36 +0200)] 
pkcs11: use generic evp key instead of rsa

Enables DSA, ECDSA key usages with newer pkcs11-helper.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Tested-By: Sanaullah <sanaullah82@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1384209366-26170-1-git-send-email-alon.barlev@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7960
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6575ad483702dd53c0f683093b5f26a87518c6a8)

11 years agoSupport non-ASCII characters in Windows tmp path
Heiko Hund [Tue, 19 Nov 2013 17:36:14 +0000 (18:36 +0100)] 
Support non-ASCII characters in Windows tmp path

Get the temporary path from the system as UCS-2 and convert it to
UTF-8 and return that for internal use.

Fix trac#278.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1384882574-28242-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8002
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix assertion when SIGUSR1 is received while getaddrinfo is successful
Arne Schwabe [Thu, 21 Nov 2013 20:08:05 +0000 (21:08 +0100)] 
Fix assertion when SIGUSR1 is received while getaddrinfo is successful

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385064495-25877-4-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8019

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

11 years agot_client.sh: ignore fields from "ip -6 route show" output that distort results.
Gert Doering [Sun, 24 Nov 2013 16:13:04 +0000 (17:13 +0100)] 
t_client.sh: ignore fields from "ip -6 route show" output that distort results.

"ip -6 route show" prints stuff like "rtt 38ms rttvar 38ms cwnd 10", which
sometimes changes while an OpenVPN test is running, resulting in spurious
failures in the "ifconfig/route must be restored identically after
OpenVPN ends" test in t_client.sh.  Not all fields are there all the time,
so use "sed" to get rid of whatever is printed this time.

Only relevant for "make check" on linux builds with "--enable-iproute2".

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1385309584-23209-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8047
(cherry picked from commit 8c19087034cb1076874075b9e2896ea3f7be59cf)

11 years agoFix compile error in ssl_openssl introduced by polar external-management patch
Arne Schwabe [Sat, 23 Nov 2013 12:40:34 +0000 (13:40 +0100)] 
Fix compile error in ssl_openssl introduced by polar external-management patch

Acked-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385210434-28364-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8039

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

11 years agoexternal_pkcs1_sign: Support non-RSA_SIG_RAW hash_ids
Joachim Schipper [Thu, 19 Sep 2013 10:47:29 +0000 (12:47 +0200)] 
external_pkcs1_sign: Support non-RSA_SIG_RAW hash_ids

For TLSv1.2, we need to support various hashes. (GPL) code taken from
PolarSSL pkcs11_sign().

Signed-off-by: Joachim Schipper <joachim.schipper@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1379587649-25506-4-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7887
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 32f07c8e5b0f6ec66cfa8566cb8e97b4a6238037)

11 years ago--management-external-key for PolarSSL
Joachim Schipper [Thu, 19 Sep 2013 10:47:28 +0000 (12:47 +0200)] 
--management-external-key for PolarSSL

Add --management-external-key support, compatible with the OpenSSL
implementation. Needs the flexibility of ssl_set_own_cert_alt(), which
is new in PolarSSL-1.2.

Signed-off-by: Joachim Schipper <joachim.schipper@fox-it.com>
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1379587649-25506-3-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7886
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 38ace48c6820c611e689bc69b0cf5380bf7a8891)

11 years agoRefactor tls_ctx_use_external_private_key()
Joachim Schipper [Thu, 19 Sep 2013 10:47:27 +0000 (12:47 +0200)] 
Refactor tls_ctx_use_external_private_key()

OpenSSL's tls_ctx_load_cert_file() had a parameter in which a copy of the
context's certificate chain was stored on return, used by
tls_ctx_use_external_private_key() only and free()d immediately thereafter.

PolarSSL also supported this output parameter, but returned a pointer to
the
context's certificate chain (rather than to a copy of the certificate, as
OpenSSL does) - which meant that we would have to #ifdef the free().

PolarSSL cannot make a copy of a certificate chain, and OpenSSL cannot
store a
pointer to (instead of a copy of) the cert.

So remove the output parameter from tls_ctx_load_cert_file() and
incorporate
the needed functionality directly into tls_ctx_use_external_private_key()
(which is straightforward for both OpenSSL and PolarSSL, as long as you
don't
try to support both at once.)

Signed-off-by: Joachim Schipper <joachim.schipper@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1379587649-25506-2-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7888
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c3b2d487bc5089c8c0cf65df8e6cc2232d84b05b)

11 years agoRemove duplicate cipher entries from TLS translation table.
Max Muster [Wed, 20 Nov 2013 17:36:16 +0000 (18:36 +0100)] 
Remove duplicate cipher entries from TLS translation table.

Patch from trac#304 - the translation table OpenSSL<->IANA contained
duplicates for four IANA names, causing translation backwards to fail.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-By: Steffan Karger <steffan.karger@fox-it.com>
URL: https://community.openvpn.net/openvpn/ticket/304
(cherry picked from commit e85d87523af43c5fe5188f7ee1e2fdd2861dcffc)

11 years agoFix slow memory drain on each client renegotiation.
Gert Doering [Wed, 23 Oct 2013 15:54:05 +0000 (17:54 +0200)] 
Fix slow memory drain on each client renegotiation.

This reverts commit bee92b479414d12035b0422f81ac5fcfe14fa645 and parts
of commit dc7be6d078ba106f9b0de12f3e879c3561c3c537, as these introduced a
subtle memory drain on client renegotiations (es->gc got initialized,
which led to "unused" gc_entry records accumulating while a client is
connected).

Setting es->gc=NULL causes env_set_add_nolock() / remove_env_item() to
free() allocated and no longer used strings in the es, while an active
gc would leave them for cleanup with gc_free() at client disconnect time.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Conflicts:
src/openvpn/buffer.c
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Message-Id: <20131023162618.GP161@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7939
(cherry picked from commit 4368147972d61b598bbcd5d2904d891130d5e517)

11 years agoFix IPv6 examples in t_client.rc-sample
Gert Doering [Sat, 16 Nov 2013 17:53:21 +0000 (18:53 +0100)] 
Fix IPv6 examples in t_client.rc-sample

IPv6 documentation prefix is 2001:db*8*:: (not :dba:), and the second
test stanza variables need to end in _2, of course...

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Josh Cepek <josh.cepek@usa.net>
Message-Id: <1384624401-27943-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7992
(cherry picked from commit bbc3a6473c84ba7cdb87b359f016cd13773e42ec)

11 years agoDocument authfile for socks server
Davide Brini [Sun, 15 Sep 2013 12:31:49 +0000 (14:31 +0200)] 
Document authfile for socks server

It looks like it's possible to specify an optional authfile as third
argument of the "socks-proxy" directive. This patch updates the man page to
document that.

Signed-off-by: Davide Brini <dave_br@gmx.com>
Acked-by: Heiko Hund <heiko.hund@sophos.com>
Message-Id: <0MTjMy-1VU1I42Lo0-00QV4k@mail.gmx.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7875
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit e0a7471f250e25a384a23dfb9efd2ffef83be913)

11 years agotls_ctx_load_ca: Improve certificate error messages
Klee Dienes [Sat, 6 Jul 2013 21:00:02 +0000 (17:00 -0400)] 
tls_ctx_load_ca: Improve certificate error messages

If a CA certificate file includes intermediate certificates, and any
of them fail to verify, the current code will file with "Cannot load
CA certificate file".  Instead, generate a more specific error message
identifying the specific sub-certificate(s) which did not validate.

Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <CAK6ywbLVtSgRZEt4N+02fz+vQ0GNp==5KdsbqWtZ+fgUzrZq+g@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7837

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

11 years agoAdd reporting of UI version to basic push-peer-info set.
Arne Schwabe [Fri, 31 May 2013 12:59:35 +0000 (14:59 +0200)] 
Add reporting of UI version to basic push-peer-info set.

If a GUIs sets IV_OPENVPN_GUI_VERSION the version will be pushed to the
server.

Usage convention for IV_OPENVPN_GUI_VERSION is "<gui_id><space><version>",
for example "de.blinkt.openvpn 0.5.47" for the ICS Android version.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: <1370005175-14871-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7646
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f3a2cd255a3bc73a546a5e2d09fa30a16cce0d7d)

11 years agoRequire a 1.2.x PolarSSL version
Josh Cepek [Thu, 14 Nov 2013 18:02:59 +0000 (12:02 -0600)] 
Require a 1.2.x PolarSSL version

Upstream policy on PolarSSL API compatibility does not guarantee
stability between point-releases. For OpenVPN, we must verify a 1.2.x
version with the current codebase.

This fixes bug#343.

Signed-off-by: Josh Cepek <josh.cepek@usa.net>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <5284F32D.3000206@usa.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7968
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7fc9245f5d97c7d76c635f8a3e38ab55ab27b27b)

11 years agoRequire polarssl >= 1.2.10 for polarssl-builds, which fixes CVE-2013-5915.
Steffan Karger [Tue, 22 Oct 2013 12:45:17 +0000 (14:45 +0200)] 
Require polarssl >= 1.2.10 for polarssl-builds, which fixes CVE-2013-5915.

PolarSSL 1.2.9 fixes a possible timing attack in PolarSSL's RSA-CRT
implementation. See CVE-2013-5915 for details. This commit bumps the
minimum polarssl version required by configure.ac to 1.2.10, because 1.2.9
also introduced a memory leak, which is fixed in 1.2.10.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1382445917-2974-1-git-send-email-steffan.karger@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7925
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 92d21e3fed33aad966b7b0ca6568e0cda8c7a8b5)

11 years agoSupport non-ASCII TAP adapter names on Windows
Heiko Hund [Tue, 15 Oct 2013 09:23:42 +0000 (11:23 +0200)] 
Support non-ASCII TAP adapter names on Windows

Currently the TAP adapter name is fetched as an OEM string, which
is problematic if it contains non-ASCII characters and is to used
with netsh. The logfile also contains these non UTF-8 characters.

This patch fetches the name from the registry as UCS-2 and converts
it right into UTF-8 before it's used.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Josh Cepek <josh.cepek@usa.net>
Message-Id: <1381829022-15244-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7913
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f2e40082349098d3c22981bf1e6d305826f1173f)

11 years agoFix configure interaction with static OpenSSL libraries
Peter Sagerson [Fri, 23 Aug 2013 09:02:05 +0000 (11:02 +0200)] 
Fix configure interaction with static OpenSSL libraries

Add "-lcrypto" to configure OpenSSL "-lssl" test (if no pkg-config
found), otherwise linking with static OpenSSL libraries will fail.

Trac ticket #305

Message-Id: <521668C9.5070003@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7835
URL: https://community.openvpn.net/openvpn/ticket/305
Acked-By: Heiko Hund <heiko.hund@sophos.com>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 30e358e5de352c8de04a955dc89f33e1710e9b97)

11 years agoCorrect error text when no Windows TAP device is present
Josh Cepek [Wed, 21 Aug 2013 21:20:30 +0000 (16:20 -0500)] 
Correct error text when no Windows TAP device is present

Starting with the 2.3-series, the TAP-Windows driver/utilities and
OpenVPN are separately installed components. The error message given to
users without available TAP devices uses the pre-2.3 path that does not
exist. The path should be listed under the TAP-Windows program group
that the tap-windows project installer uses.

Resolves bug #320

Signed-off-by: Josh Cepek <josh.cepek@usa.net>
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Message-Id: <kv4ece$s8s$1@ger.gmane.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7825
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2d34628af995676c8ecddb953897c334b96a6a6b)

11 years agoAlways load intermediate certificates from a PKCS#12 file
Heikki Hannikainen [Thu, 20 Jun 2013 11:06:25 +0000 (14:06 +0300)] 
Always load intermediate certificates from a PKCS#12 file

Load intermediate certificates from a PKCS#12 file and place them in the
extra certs chain, when trusted CA certs are loaded from an external PEM
file with the --ca option, and the CA certs in PKCS#12 are not to be trusted.

Required when client PKCS#12 file is provided by a different CA
than the server CA, the PKCS#12 file contains intermediate certificates
required for client auth, but the server CA is not in the PKCS#12 file.

When --ca is set, the PKCS#12 provided CA certs are not trusted. Without
this patch, they were ignored completely - with this patch, they're loaded
in the extra certs chain which makes them available for chain verification
but still does not make them trusted if --ca is set. Unless when, of
course, a trusted root is found from the --ca file.

Acked-by: James Yonan <james@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <alpine.DEB.2.02.1306201400320.10116@jazz.he.fi>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7721

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

11 years agoAdd a note what setenv opt does for OpenVPN < 2.3.3
Arne Schwabe [Fri, 16 Aug 2013 08:11:20 +0000 (10:11 +0200)] 
Add a note what setenv opt does for OpenVPN < 2.3.3

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

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

11 years agoAdd support to ignore specific options.
Arne Schwabe [Fri, 16 Aug 2013 08:11:04 +0000 (10:11 +0200)] 
Add support to ignore specific options.

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

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

11 years agoAdded "setenv opt" directive prefix. If present, and if the
James Yonan [Tue, 11 Jun 2013 06:25:05 +0000 (00:25 -0600)] 
Added "setenv opt" directive prefix.  If present, and if the
directive that follows is recognized, it will be processed
as if the "setenv opt" prefix was absent.  If present and if
the directive that follows is not recognized, the directive
will be ignored rather than cause a fatal error.

For example, suppose you are distributing a client
configuration file and want to set the minimum TLS version
that the client requires from the server to 1.2.

By using the following directive,

  setenv opt tls-version-min 1.2 or-highest

only newer clients that understand the tls-version-min directive
would process it, while older clients would ignore it.

(cherry picked from commit 27713761e4110bb92f1c6dfe85db291e8c6e0f56)

Signed-off-by: James Yonan <james@openvpn.net>
URL: http://thread.gmane.org/gmane.network.openvpn.devel/7771
URL: http://thread.gmane.org/gmane.network.openvpn.devel/7744
URL: https://github.com/jamesyonan/openvpn/commit/27713761e4110bb92f1c6dfe85db291e8c6e0f56
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit 2a92fba756d4c1e73300a12ff9e80028a6ab7c09)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoTLS version negotiation
James Yonan [Tue, 11 Jun 2013 04:59:30 +0000 (22:59 -0600)] 
TLS version negotiation

Updated the TLS negotiation logic to adaptively try to connect using
the highest TLS version supported by both client and server.
Previously, OpenVPN (when linked with OpenSSL) would always connect
using TLS 1.0.

Also added tls-version-min directive to force a higher TLS version
than 1.0:

tls-version-min <version> ['or-highest'] -- sets the minimum
TLS version we will accept from the peer.  Examples for version
include "1.0" (default), "1.1", or "1.2".  If 'or-highest' is
specified and version is not recognized, we will only accept
the highest TLS version supported by the local SSL implementation.

Examples:

tls-version-min 1.1 -- fail the connection unless peer can
  connect at TLS 1.1 or higher.

tls-version-min 1.2 or-highest -- require that the peer
  connect at TLS 1.2 or higher, however if the local SSL
  implementation doesn't support TLS 1.2 (as it wouldn't
  if linked with an older version of OpenSSL), reduce the
  minimum required version to the highest version supported
  by the local SSL implementation (such as TLS 1.0).  This
  is intended to allow client configurations to target higher
  TLS versions that are supported on the server, even if some
  older clients don't support these versions yet.

 [
    This is a merged patch from on the following commits
    on git://github.com/jamesyonan/openvpn.git

    03a5599202bdc3ba07983dc4efdae387fb8fb436
    d23005413b0e0f28a3c48a6342f494763d5c9b40
 ]

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
URL: http://thread.gmane.org/gmane.network.openvpn.devel/7743
URL: http://thread.gmane.org/gmane.network.openvpn.devel/7744
Message-Id: 51C77F12.1090802@openvpn.net
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit 4b67f9849ab3efe89268e01afddc7795f38d0f64)
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Conflicts:
src/openvpn/ssl_common.h

12 years agoautoconf: Fix typo
David Sommerseth [Fri, 7 Jun 2013 10:15:30 +0000 (12:15 +0200)] 
autoconf: Fix typo

In config.h, it would state:

      /* Enable systemd support */
      #define ENABLE_PLUGIN 1

instead of

      /* Enable plug-in support */
      #define ENABLE_PLUGIN 1

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

12 years agoplugin: Extend the plug-in v3 API to identify the SSL implementation used
David Sommerseth [Wed, 3 Jul 2013 19:17:10 +0000 (21:17 +0200)] 
plugin: Extend the plug-in v3 API to identify the SSL implementation used

OpenVPN would segfault unexpectedly if it would be compiled against
PolarSSL
and the plug-in would expect OpenSSL, or vice-versa.  This segfault would
not appear before the plug-in would try to access functions which would
be available if the plug-in and OpenVPN uses the same SSL implementation.

This patch adds a member to the plug-in initialisation function, which
identifies the SSL implementation.

The log_v3 plug-in is updated accordingly + a simple fix to make it
buildable again using the ./build script.

A minor documentation error in the openvpn-plugin.h was also
corrected, where it mentioned OPENVPN_PLUGIN_VERSION instead of
OPENVPN_PLUGINv3_STRUCTVER.

 v2 - add const ovpnSSLAPI ssl_api at the end of
      struct openvpn_plugin_args_open_in and not in the "middle"

 v3 - fix bug in plug-in init, as the SSLAPI was located wrong in the
      args struct sent to the openvpn_plugin_open_v3() function.

 v4 - Ensure SSLAPI got a sane/known value if SSL is disabled or unknown

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

12 years agoRemove the --disable-eurephia configure option
David Sommerseth [Fri, 7 Jun 2013 10:15:23 +0000 (12:15 +0200)] 
Remove the --disable-eurephia configure option

This "feature" has been enabled since OpenVPN 2.2 without any reports that
this has been causing issues.  All it does is to add an extra environment
variable 'tls_digest_{n}' with the certificate SHA1 fingerprint/digest
hash.

Lets just simplify things by removing the possibility to disable this
environment variable.

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

12 years agoman page: Update man page about the tls_digest_{n} environment variable
David Sommerseth [Fri, 7 Jun 2013 10:15:11 +0000 (12:15 +0200)] 
man page: Update man page about the tls_digest_{n} environment variable

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

12 years agoAdd support of utun devices under Mac OS X
Arne Schwabe [Fri, 21 Jun 2013 10:48:28 +0000 (12:48 +0200)] 
Add support of utun devices under Mac OS X

Mac OS X 10.7+ natively supports tun devices (called utun). The "standard"
utun.ko driver is sometimes problematic (e.g. VmWare Fusion 5 and tun.ko
do not work together).

When OpenVPN is compiled with utun support it will if no dev-node is given
first try to use utun and if that is not available will try the
traditional tun devices

v2: Fixed tap support, get device name via ioctl, add manage
v3.1: Fix compiling without if/utun.h, fix manage errors
v4/v5: Don't try open to dynamically open utun0 -255 when early utun
initialization fails, fix fallback to tun, give fatal error message when
utun fails but no tun fallback should be done
v6: add commit message change log, replace strstr with strncmp, move
v7: Throw error if a user does the strange combination of --dev tun
--dev-type tap and --dev-node utun

A lot good input on earlier patches by Jonathan K. Bullard
<jkbullard@gmail.com>

Parts of the patches are inspired from Peter Sagerson's
<psagers@ignorare.net> utun patch
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Tested-by: Jonathan K. Bullard <jkbullard@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1371811708-8528-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7739
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit fbc04bedbcce02fc625357b7475ddbc7164cabbf)

12 years agoAdd support for client-cert-not-required for PolarSSL.
Tamas TEVESZ [Sat, 8 Jun 2013 05:00:16 +0000 (07:00 +0200)] 
Add support for client-cert-not-required for PolarSSL.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: alpine.GSO.2.03.1306080732510.23277@extreme.hu
URL: http://article.gmane.org/gmane.network.openvpn.devel/7667
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit a781d6714758489a808b55cdefc1d1623194e318)

12 years agoDo not pass struct tls_session* as void* in key_state_ssl_init().
Steffan Karger [Sun, 19 May 2013 08:01:29 +0000 (10:01 +0200)] 
Do not pass struct tls_session* as void* in key_state_ssl_init().

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: 51B1DBEF.1090705@fox-it.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/7664
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit b97e2c3c90afdbb1a24bc1357ec6b94d626defcd)

12 years agoPreparing for v2.3.2 (ChangeLog, version.m4) v2.3.2
Gert Doering [Fri, 31 May 2013 08:31:52 +0000 (10:31 +0200)] 
Preparing for v2.3.2 (ChangeLog, version.m4)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 years agoMove checking of script file access into set_user_script
Arne Schwabe [Thu, 30 May 2013 21:02:17 +0000 (23:02 +0200)] 
Move checking of script file access into set_user_script

At the moment script are only checked if P2MP_SERVER is defined. For
CLIENT_ONLY openvpn script were never checked.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1369947737-26081-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7635

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

12 years agoMove settings of user script into set_user_script function
Arne Schwabe [Thu, 30 May 2013 20:26:43 +0000 (22:26 +0200)] 
Move settings of user script into set_user_script function

This also fixes commit 567bfc06d051b60e9cdca1f5bb468631b899682a if not all
script options are available by setting options->user_script_used
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1369945603-17169-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7634

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

12 years agoProvide more accurate warning message
Davide Brini [Thu, 30 May 2013 14:20:55 +0000 (16:20 +0200)] 
Provide more accurate warning message

Very simple fix.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <0LzcMG-1ULZ4T0Fuc-014gq9@mail.gmx.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7628

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

12 years agoOnly print script warnings when a script is used. Remove stray mention of script...
Arne Schwabe [Thu, 30 May 2013 13:27:08 +0000 (15:27 +0200)] 
Only print script warnings when a script is used. Remove stray mention of script-security system.

Acked-by: Jan Just Keijser <janjust@nikhef.nl>
Message-Id: <1369920428-11350-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7625

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

12 years agoFix problem with UDP tunneling due to mishandled pktinfo structures.
Gert Doering [Thu, 30 May 2013 11:31:24 +0000 (13:31 +0200)] 
Fix problem with UDP tunneling due to mishandled pktinfo structures.

In link_socket_write_udp_posix_sendmsg(), pktinfo structures for ipv4 and
ipv6 are going out of scope before actually calling sendmsg(), so depending
on compiler optimization, garbage is passed to sendmsg() - fix by using
"union openvpn_pktinfo" and having that in scope all the time.

Problem reported and patch provided by "danta" in trac#297

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
URL: https://community.openvpn.net/openvpn/ticket/297
Message-ID: <20130530184427.GP20843@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7629
(cherry picked from commit 8c431f960357d776cfd0961192214ad1b0942bfb)

12 years agoAlways push basic set of peer info values to server.
James Yonan [Mon, 20 May 2013 10:13:21 +0000 (12:13 +0200)] 
Always push basic set of peer info values to server.

On the client, allow certain peer info fields to be pushed even if
push-peer-info isn't specified in the config.

This is needed to allow the compression handshake to work correctly
(i.e. where the client indicates its support for LZO and/or Snappy).

Fields that have privacy implications such as Mac Address and UV_*
environment variables will not be pushed to the server as before unless
push-peer-info is specified by client config.

v1: equivalent to OpenVPN SVN r8225 (2.1.21c)

v2: distinguish 3 levels of peer-info detail

  --push-peer-info specified --> send all we have
  --pull           specified --> send basic set, as per r8225
  default                    --> send nothing (do not leak from server)

v3: undo extra whitespace changes in v1 and v2

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1369044801-7594-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7604
(cherry picked from commit 598e03f0e7bce434e501a9895819f2af0714d5f6)

Conflicts:
src/openvpn/ssl.c

12 years agomake 'explicit-exit-notify' pullable again
Jan Just Keijser [Fri, 24 May 2013 12:36:32 +0000 (14:36 +0200)] 
make 'explicit-exit-notify' pullable again

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <519F5ED0.4070109@nikhef.nl>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7605

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

12 years agoFix Windows script execution when called from script hooks
Josh Cepek [Thu, 16 May 2013 14:09:23 +0000 (09:09 -0500)] 
Fix Windows script execution when called from script hooks

Console applications under Windows, such as batch scripts, require the
CREATE_NO_WINDOW process flag when run without an actual console window
present. This change allows such scripts to execute and impact the hook
status by way of their return code.

Fixes bug #240.

Signed-off-by: Josh Cepek <josh.cepek@usa.net>
Acked-by: Heiko Hund <heiko.hund@sophos.com>
Message-Id: <kn2pao$5sv$1@ger.gmane.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7594
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a19e35a95bf4a0177ae115535a3755d3acd894e9)

12 years agoFix NULL-pointer crash in route_list_add_vpn_gateway().
Gert Doering [Fri, 3 May 2013 19:13:24 +0000 (21:13 +0200)] 
Fix NULL-pointer crash in route_list_add_vpn_gateway().

Add ASSERT() check to route_list_add_vpn_gateway() to ensure that *rl
is valid (and if not, crash with a somewhat more meaningful message than
"segmentation violation").  For the actual bugfix, change init code to
always allocate a "struct route_list" for IPv4, even if no --route options
have been seen in the config.

Fix trac#281 and trac#258.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Josh Cepek <josh.cepek@usa.net>
Message-Id: <1367608404-2257-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7581
(cherry picked from commit eb95f367348f4c2aae301cfa7c3adc8e0f2e711e)

12 years agoFix segfault when enabling pf plug-ins
svimik [Thu, 29 Sep 2011 11:41:34 +0000 (13:41 +0200)] 
Fix segfault when enabling pf plug-ins

This fixes an issue where a segfault happens in pf_cn_test() if no
packet filtering rules have been parsed.  See the trac ticket for
more details.

Trac: 163
Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit 31e5f34f3c6cf3aa6f120d22c415ac74a5ba1639)

12 years agoFix proto tcp6 for server & non-P2MP modes
Josh Cepek [Thu, 2 May 2013 21:17:37 +0000 (16:17 -0500)] 
Fix proto tcp6 for server & non-P2MP modes

This fix adds support for using tcp6 as a proto in server or non-P2MP
modes, resolving a failed ASSERT in such cases.

Fixes the crash in trac#288.

Signed-off-by: Josh Cepek <josh.cepek@usa.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <klul5d$8ta$1@ger.gmane.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7578
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit d0ccb982e1714c8dfefd6eacf0c6f899eb71b582)

12 years agoFixed usage of stale define USE_SSL to ENABLE_SSL
Steffan Karger [Mon, 15 Apr 2013 08:45:28 +0000 (10:45 +0200)] 
Fixed usage of stale define USE_SSL to ENABLE_SSL

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <516BCEA2.6000608@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7509
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 1d561d4eaebe8652768270b6373023177b8d706d)

12 years agoFixed tls-cipher translation bug in openssl-build
Steffan Karger [Thu, 4 Apr 2013 19:53:07 +0000 (21:53 +0200)] 
Fixed tls-cipher translation bug in openssl-build

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1CED409804E2164C8104F9E623B08B9013BC28A538@FOXDFT02.FOX.local>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7480
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 0bcde52f6a96a19c28e035e2c562f8a66eaa416f)