]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
11 years agoMove #include "ssl_verify.h" from ssl.h to the source files that need it.
Steffan Karger [Sun, 1 Jun 2014 17:58:54 +0000 (19:58 +0200)] 
Move #include "ssl_verify.h" from ssl.h to the source files that need it.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401645536-27849-4-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8749
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix ssl.c, ssl_verify_* includes
Steffan Karger [Sun, 1 Jun 2014 17:58:53 +0000 (19:58 +0200)] 
Fix ssl.c, ssl_verify_* includes

* ssl.c: remove three unneeded includes
* ssl_verify_polarssl.h: remove two unneeded includes
* ssl_verify_openssl.c: add missing ssl_verify_openssl.h and error.h
  includes, and reorder includes.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401645536-27849-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8753
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoUse generic openvpn_x509_cert_t in ssl_verify_polarssl.c
Steffan Karger [Sun, 1 Jun 2014 17:58:52 +0000 (19:58 +0200)] 
Use generic openvpn_x509_cert_t in ssl_verify_polarssl.c

For symmetry with ssl_verify_openssl.c and release/2.3 branch.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401645536-27849-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8752
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix merge error in a6c573d, the ssl ctx is now abstracted.
Steffan Karger [Wed, 28 May 2014 19:40:34 +0000 (21:40 +0200)] 
Fix merge error in a6c573d, the ssl ctx is now abstracted.

Between the origin patch submission (2011) and now the cipher abstraction
layer has been added. This patch slipped through without proper adjustment.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <53863C41.1020408@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8745
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoMerge get_default_gateway() implementation for all 4+1 BSD variants.
Gert Doering [Tue, 14 Jan 2014 13:33:18 +0000 (14:33 +0100)] 
Merge get_default_gateway() implementation for all 4+1 BSD variants.

This was 3 times mostly the same code, with the 4 traditional BSDs
only differing in a single line, while MacOS X had more refined code
to do not only gateway determination, but also netmask, interface name
and MAC address.

The MacOS X code works perfectly well on the other BSDs *if* one macro
is #ifdef'ed to use "(uint32_t)" on MacOS X and "(long)" on all other
BSDs, 32 and 64 bit variants.  API change by OSX when going to 64bit.

Tested on FreeBSD 8.3/i386, FreeBSD 9.1/amd64, NetbSD 5.1/amd64,
OpenBSD 4.9/i386, OpenBSD 5.4/amd64 (= all affected platforms except
DragonFly BSD).

See also trac#42 and trac#340.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Lazy-Ack-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1389706398-26922-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8233

11 years agoRemove unneeded defines (were needed for pre-0.9.7 OpenSSL).
Steffan Karger [Sun, 25 May 2014 19:18:21 +0000 (21:18 +0200)] 
Remove unneeded defines (were needed for pre-0.9.7 OpenSSL).

Since we now require OpenSSL 0.9.8, we don't need these anymore.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1401045501-12343-4-git-send-email-steffan@karger.me>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoRemove unneeded wrapper functions in crypto_openssl.c
Steffan Karger [Sun, 25 May 2014 19:18:20 +0000 (21:18 +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: <1401045501-12343-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 19:18:19 +0000 (21:18 +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: <1401045501-12343-2-git-send-email-steffan@karger.me>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoUse SSL_MODE_RELEASE_BUFFERS if available
Cristian Rodriguez [Sun, 25 May 2014 13:52:58 +0000 (15:52 +0200)] 
Use SSL_MODE_RELEASE_BUFFERS if available

Sets SSL_MODE_RELEASE_BUFFERS if available, to keep openSSL memory
usage as low as possible.

For more info, see
http://www.imperialviolet.org/2010/06/25/overclocking-ssl.html
https://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html

See also trac #157

Signed-off-by: Cristian Rodriguez <crrodriguez@opensuse.org>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <5381FEFF.1040609@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>
(cherry picked from commit a91a2d6ad7b139ec78d61c8616b8447847e9ecc6)

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>
(cherry picked from commit 3e8e496008f6634234d5867a22d7a1c03a5bf164)

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

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

11 years agoMake serial env exporting consistent amongst OpenSSL and PolarSSL builds.
Steffan Karger [Sun, 27 Apr 2014 08:49:20 +0000 (10:49 +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: <1398588561-18964-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8649
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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>
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>
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

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

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>
11 years agoAdd an elliptic curve testing cert chain to the sample keys
Steffan Karger [Wed, 23 Apr 2014 22:43:38 +0000 (00:43 +0200)] 
Add an elliptic curve testing cert chain to the sample keys

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1398293018-8581-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8601
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoAdd support for elliptic curve diffie-hellmann key exchange (ECDH)
Steffan Karger [Wed, 23 Apr 2014 22:31:08 +0000 (00:31 +0200)] 
Add support for elliptic curve diffie-hellmann key exchange (ECDH)

This patch is based on Jan Just Keijser's patch from Feb 7, 2012.

When OpenSSL 1.0.2+ or PolarSSL is used, lets the crypto library do the
heavy lifting. For OpenSSL builds, if a user specifies a curve using
--ecdh-curve, it first tries to override automatic selection using that
curve.

For older OpenSSL, tries the following things (in order of preference):
 * When supplied, use the ecdh curve specified by the user.
 * Try to extract the curve from the private key, use the same curve.
 * Fall back on secp384r1 curve.

Note that although a curve lookup might succeed, OpenSSL 1.0.0 and older do
*not* support TLSv1.1 or TLSv1.2, which means no that no EC-crypto can be
used.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <53597BEA.6080408@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8625
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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

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>
11 years agoUpdate openvpn-plugin.h for PolarSSL 1.3.
Steffan Karger [Mon, 21 Apr 2014 09:52:51 +0000 (11:52 +0200)] 
Update openvpn-plugin.h for PolarSSL 1.3.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <5354F0F2.5080200@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8567
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoImprove error reporting during key/cert loading with PolarSSL.
Steffan Karger [Tue, 4 Feb 2014 12:58:05 +0000 (13:58 +0100)] 
Improve error reporting during key/cert loading with PolarSSL.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: <53528943.3090205@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8555
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoUpgrade to PolarSSL 1.3
Steffan Karger [Tue, 4 Feb 2014 12:57:15 +0000 (13:57 +0100)] 
Upgrade to PolarSSL 1.3

This removes support for PolarSSL 1.2. The mimimum version of PolarSSL
required is now 1.3.3. The upgrade brings OpenVPN-with-PolarSSL:

* Support for EC-crypto in TLS (but not yet for external
  pkcs11/management keys)
* Support for AES-NI (if PolarSSL is compiled with AES-NI support)

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: <53528943.3090205@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8555
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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

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

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>
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>
11 years agoWork around Solaris getaddrinfo() returing ai_protocol=0
Arne Schwabe [Mon, 7 Apr 2014 20:12:05 +0000 (22:12 +0200)] 
Work around Solaris getaddrinfo() returing ai_protocol=0

Create_socket() and sub-functions assume that the ai_protocol value
returned by getaddrinfo() is IPPROTO_UDP or IPPROTO_TCP.  On Solaris,
it is "0", because Solaris's socket() call will then "select the right
protocol" - but it breaks our code.  So remove ASSERT()s on ai_protocol,
and also accept properly set ai_socktype (SOCK_DGRAM/SOCK_STREAM) values
if ai_protocol is not set.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20140407201711.GN16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8428

11 years agofix route struct name
Heiko Hund [Tue, 1 Apr 2014 10:06:43 +0000 (12:06 +0200)] 
fix route struct name

This slipped in with commit d0085293.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1396346803-31772-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8421
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoconfigure.ac: use CPPFLAGS for SSL_OP_NO_TICKET check
Steffan Karger [Mon, 31 Mar 2014 22:33:55 +0000 (00:33 +0200)] 
configure.ac: use CPPFLAGS for SSL_OP_NO_TICKET check

AC_EGREP_CPP uses CPPFLAGS, not CFLAGS. Make sure the macro can find
OpenSSL by temporarily adding OPENSSL_CRYPTO_FLAGS to CPPFLAGS.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Heiko Hund <heiko.hund@sophos.com>
Message-Id: <5339EFFC.6090908@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8419
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix crash when using --inetd.
Gert Doering [Sun, 30 Mar 2014 12:09:36 +0000 (14:09 +0200)] 
Fix crash when using --inetd.

Change "local" argument to socket_do_listen() to avoid calling
"local->ai_addr" in the caller for the "do_listen == FALSE" case,
in which case it could be NULL.

Also, ensure "ai" is always initialized in socket_listen_accept() for
the "!remote_dynamic" case - otherwise it will sometimes(!) crash in
addrlist_match() later on.

Get rid of spurious operator precedence warning concerning
GETADDR_CACHE_MASK.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1396181376-32022-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8412

11 years agoFix assert when using port-share
Arne Schwabe [Fri, 21 Mar 2014 13:18:44 +0000 (14:18 +0100)] 
Fix assert when using port-share

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-12-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8369

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoClean up of socket code.
Arne Schwabe [Fri, 21 Mar 2014 13:18:43 +0000 (14:18 +0100)] 
Clean up of socket code.

Let socket_create take struct addrinfo as argument and use the entries of
addrinfo to create the socket.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-11-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8370

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoconfigure.ac: check for SSL_OP_NO_TICKET flag in OpenSSL
Steffan Karger [Sun, 23 Mar 2014 13:07:47 +0000 (14:07 +0100)] 
configure.ac: check for SSL_OP_NO_TICKET flag in OpenSSL

SSL_OP_NO_TICKET tells OpenSSL to disable "stateless session resumption".
This is something we do not want nor need, but could potentially be used
for a future attack. OpenVPN 2.4 requires the flag to be set and will fail
configure if the flag is not present.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <CAA1AbxJh17KYmVU1BVa5kp4iJsUJT+xnXp0rVU_3g3c5hPnqDQ@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8389

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoDisable unsupported TLS cipher modes by default, cleans --show-tls output.
Steffan Karger [Sat, 1 Mar 2014 14:36:15 +0000 (15:36 +0100)] 
Disable unsupported TLS cipher modes by default, cleans --show-tls output.

This explicitly disables a number of tls ciphers that OpenVPN has currently
no support for. OpenSSL will automatically detect this during negotiation,
but --show-tls would erroneously show a number of unsupported ciphers.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1393684575-28112-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8318
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>
11 years agoBump minimum OpenSSL version to 0.9.8
Steffan Karger [Sun, 23 Mar 2014 13:53:01 +0000 (14:53 +0100)] 
Bump minimum OpenSSL version to 0.9.8

OpenSSL 0.9.7 and older are considered obsolete (see
http://www.openssl.org/news/news.html). This patch updates configure.ac to
require OpenSSL 0.9.8 or newer, and removes a number of #ifdefs that are
now no longer needed.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1395582781-27966-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8392
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoAdd gateway and device to android control messages
Arne Schwabe [Fri, 21 Mar 2014 13:18:41 +0000 (14:18 +0100)] 
Add gateway and device to android control messages

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-9-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8368

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoDon't show the connection profile store in options->ce if there is a connection_list...
Arne Schwabe [Fri, 21 Mar 2014 13:18:40 +0000 (14:18 +0100)] 
Don't show the connection profile store in options->ce if there is a connection_list defined.

Entries in options->ce are never used and overwritten by the first usable
connection profile on initialisation.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-8-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8377

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix for server selecting address family
Arne Schwabe [Fri, 21 Mar 2014 13:18:39 +0000 (14:18 +0100)] 
Fix for server selecting address family

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-7-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8371

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoIntroduce an option to resolve dns names in advance for --remote, --local and --http...
Arne Schwabe [Sun, 23 Mar 2014 12:13:06 +0000 (13:13 +0100)] 
Introduce an option to resolve dns names in advance for --remote, --local and --http-proxy

Also introduce x_gc_addspeical function that allows to add objects with a
custom free function to the gc.

Some additional addrinfo cleanup

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoAdjusted autotools files to build more cleanly on newer autoconf/automake versions
David Sommerseth [Wed, 15 Jan 2014 16:36:04 +0000 (17:36 +0100)] 
Adjusted autotools files to build more cleanly on newer autoconf/automake versions

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1389803764-5879-1-git-send-email-davids@redhat.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8239
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoImplement an easy parsable log output that allows access to flags of the log message
Arne Schwabe [Fri, 21 Mar 2014 13:18:37 +0000 (14:18 +0100)] 
Implement an easy parsable log output that allows access to flags of the log message

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-5-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8374

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoWorkaround broken Android 4.4 VpnService API for persist-tun mode
Arne Schwabe [Fri, 21 Mar 2014 13:18:36 +0000 (14:18 +0100)] 
Workaround broken Android 4.4 VpnService API for persist-tun mode

In Android 4.4 it is not possible to open a new tun device and then close
the old tun device without breaking the whole VPNService stack until the
device is rebooted.

Add new management method to ask the UI what method should be taken to
ensure the optimal solution for the situation.  Then do open-before-close
or close-before-open inside open_tun() as requested.

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoMove the initialization of the environment to the top so c2.es is initialized
Arne Schwabe [Fri, 21 Mar 2014 13:18:35 +0000 (14:18 +0100)] 
Move the initialization of the environment to the top so c2.es is initialized

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-3-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8372

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix connecting to localhost on Android
Arne Schwabe [Fri, 21 Mar 2014 13:18:34 +0000 (14:18 +0100)] 
Fix connecting to localhost on Android

Do not protect the link socket when connecting to localhost. Also only
call the protect function on valid socket
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395407925-25518-2-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8375

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>
11 years agoFix warning for max-routes: do not quit when parsing an old configuration. Format...
Arne Schwabe [Mon, 17 Mar 2014 12:45:45 +0000 (13:45 +0100)] 
Fix warning for max-routes: do not quit when parsing an old configuration. Format the message to be more like the other deprecated options

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
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>
11 years agogrow route lists dynamically
Heiko Hund [Tue, 18 Feb 2014 17:59:55 +0000 (18:59 +0100)] 
grow route lists dynamically

This removes the need for the --max-routes option. Instead of
allocating a fixed size array for the route(-option)s they are
managed in linked lists instead.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1392746395-19246-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8295
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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>
11 years agoAdd "test-driver" and "compile" to .gitignore
Gert Doering [Mon, 20 Jan 2014 20:13:57 +0000 (21:13 +0100)] 
Add "test-driver" and "compile" to .gitignore

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
11 years agoconvert struct signal_info element
Heiko Hund [Fri, 17 Jan 2014 15:30:38 +0000 (16:30 +0100)] 
convert struct signal_info element

This one place was forgotten when the elements type was changed
from bool to int in the dual stack patch 23d61c56.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389972638-8006-2-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8243
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agomake sure sa_family_t is defined
Heiko Hund [Fri, 17 Jan 2014 15:30:37 +0000 (16:30 +0100)] 
make sure sa_family_t is defined

On Windows there's no sa_family_t. This patch defines it in
syshead.h is configure did not find it in the system headers.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389972638-8006-1-git-send-email-heiko.hund@sophos.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8242
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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

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

11 years agoFix compiler warnings in ssl_polarssl.c
Steffan Karger [Sun, 12 Jan 2014 19:39:32 +0000 (20:39 +0100)] 
Fix compiler warnings in ssl_polarssl.c

* Made some type casts explicit.
* Changed type of sha256_hash to unsigned char[], because polar expects
that.
* Added missing error.h include.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1389555572-6210-4-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8225
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoRemove unused variables from ssl_verify_polarssl.c's x509_get_serial()
Steffan Karger [Sun, 12 Jan 2014 19:39:31 +0000 (20:39 +0100)] 
Remove unused variables from ssl_verify_polarssl.c's x509_get_serial()

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1389555572-6210-3-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8222
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoFix compiler warning for unused result of write()
Steffan Karger [Sun, 12 Jan 2014 19:39:30 +0000 (20:39 +0100)] 
Fix compiler warning for unused result of write()

Issue a warning instead of ignoring a failed write() completely.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1389555572-6210-2-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8223
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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

11 years agoCleanup ir6->netbits handling.
Gert Doering [Fri, 10 Jan 2014 16:25:42 +0000 (17:25 +0100)] 
Cleanup ir6->netbits handling.

Get rid of all "if (ir6->netbits>=0)" checks, as those are always true
(unlike ir->netbits for IPv4, we don't do the special case for "if it's
a host, put -1 in there" for IPv6).

Merge mroute_helper_{add,del}_iroute and mroute_helper_{add,del}_iroute6
into unified mroute_helper_{add,del}_iroute46() function as they did the
same thing anyway, just with slightly different parameters.

Make Arne happy.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389371142-26705-2-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8198

11 years agoremove some 'unused variable' warnings
Gert Doering [Fri, 10 Jan 2014 16:25:41 +0000 (17:25 +0100)] 
remove some 'unused variable' warnings

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389371142-26705-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8197

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

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

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>
11 years agoDocument "lz4" argument to "compress" config option.
Gert Doering [Mon, 6 Jan 2014 12:49:47 +0000 (13:49 +0100)] 
Document "lz4" argument to "compress" config option.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1389012640-24174-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8178

11 years agoProvide LZ4 sources in src/compat/ and use if no system lz4 library found.
Gert Doering [Wed, 1 Jan 2014 21:57:59 +0000 (22:57 +0100)] 
Provide LZ4 sources in src/compat/ and use if no system lz4 library found.

Bundle lz4.c and lz4.h from http://code.google.com/p/lz4/ (r109) as
src/compat/compat-lz4.[ch], and use that (via #define NEED_COMPAT_LZ4)
if autoconf cannot find lz4.h or -llz4 in the system.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1388613479-22377-2-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8154

11 years agoImplement LZ4 compression.
Gert Doering [Wed, 1 Jan 2014 21:57:58 +0000 (22:57 +0100)] 
Implement LZ4 compression.

Implement LZ4 compression, similar to the existing snappy / push-peer-info
model: a LZ4 capable client will send IV_LZ4=1 to the server, and the
algorithm is selected by pushing "compress lz4" back.

LZ4 does not compress as well as LZO or Snappy, but needs far less CPU
and is much faster, thus better suited for mobile devices.  See
https://code.google.com/p/lz4/ for more details.

LZ4 include and library path can be specified by specifying LZ4_LIBS=...
and LZ4_CFLAGS=... on the configure command line.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1388613479-22377-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8153

11 years agoDisable export ciphers by default for OpenSSL builds.
Steffan Karger [Wed, 1 Jan 2014 20:10:26 +0000 (21:10 +0100)] 
Disable export ciphers by default for OpenSSL builds.

Export ciphers are deliberately weak ciphers, and not fully supported by
OpenVPN since ephemeral RSA support has been removed a few commits ago.
This commit removes them from the default cipher list to avoid confusion.

PolarSSL does not support export ciphers, so no action required there.

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-7-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8146
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoMake tls_ctx_restrict_ciphers accept NULL as char *cipher_list.
Steffan Karger [Fri, 3 Jan 2014 20:03:02 +0000 (21:03 +0100)] 
Make tls_ctx_restrict_ciphers accept NULL as char *cipher_list.

This adds some ifs to check for NULL in tls_ctx_restrict_ciphers() to
prepare
for disabling export ciphers by default in OpenVPN 2.4+.

Also let tls_ctx_restrict_ciphers always be called, also when *cipher_list
is
NULL.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <52C8922E.3030607@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8173
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoUpdate IPv6 related readme files
Arne Schwabe [Fri, 3 Jan 2014 14:49:40 +0000 (15:49 +0100)] 
Update IPv6 related readme files

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoRemove OpenSSL tmp_rsa_callback. Removes support for ephemeral RSA in TLS.
Steffan Karger [Wed, 1 Jan 2014 20:10:24 +0000 (21:10 +0100)] 
Remove OpenSSL tmp_rsa_callback. Removes support for ephemeral RSA in TLS.

This code would not really generate ephemeral keys every time it is called,
but a single key that would be reused during process lifetime and returned
each time the function was called; probably not what users would expect.

TLS allowes ephemeral keys to be used only when no other key exchange, such
as (ephemeral) Diffie-Hellman, is performed. The end result is that it was
only used by a number of (weak) export ciphers, which could give users a
false sense of security.

So, instead of fixing a weak cipher mode, we'll just remove support for it
completely. Plenty of better alternatives are available in TLS.

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-5-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8152
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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>
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>
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>
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>
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>
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>
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 IPv6_V6ONLY logic.
Gert Doering [Sat, 30 Nov 2013 21:38:28 +0000 (22:38 +0100)] 
Fix IPv6_V6ONLY logic.

The "ipv6only" setsockopt logic introduced by 8832c6c4cf was inverted,
fix.  Also add a msg() to show what value is set, as that makes strange
v4/v6 connectivity problems much easier to spot.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1385847508-32248-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8079

11 years agoImplement listing on IPv4/IPv6 dual socket on all platform
Arne Schwabe [Mon, 25 Nov 2013 12:31:18 +0000 (13:31 +0100)] 
Implement listing on IPv4/IPv6 dual socket on all platform

With this patch OpenVPN will listen on Ipv4 as well as IPv6 when an IPv6
socket is used. Using bind ipv6only will disable this behavior
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-7-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8052

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoImplement dual stack client support for OpenVPN
Arne Schwabe [Mon, 25 Nov 2013 12:31:17 +0000 (13:31 +0100)] 
Implement dual stack client support for OpenVPN

This patch contains a number of changes. I did not further spit this since some changes make only sense being changed together.

Always use connection_list, simplifies the reconnection logic.

Change meaning of --connect-retry-max and --connect-retry to be used
all connections. This now allows OpenVPN to quit after n unsuccessful
udp connection attempts

Remove the tcp reconnection logic. Failing a TCP connection will now
cause a USR1 like a UDP connection. Also extend sig->source from bool to
int to specify signal source. This allows a finer grained reconnection
logic if necessary in the future.

Dual-Stack support: if an address resolves to multiple records each
address is tried in sequential order. Then proceed to next connection
entry. Introduce the field current_remote to represent the current
connecting remote. Also change some fields to struct addrinfo* form
openvn_addr to store multiple addresses needed for the dual stack support.

Change meaning from udp and tcp to allow both IPv4 and IPv6. Introducue
new udp4 and tcp4 to force IPv4.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-6-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8058

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Message-ID: <20131129194258.GL161@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8071

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoWhen resolving fails print the error message from socket layer
Arne Schwabe [Mon, 25 Nov 2013 12:31:16 +0000 (13:31 +0100)] 
When resolving fails print the error message from socket layer

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-5-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8059

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agochange the type of 'remote' to addrinfo*, and rename to 'remote_list'.
Arne Schwabe [Mon, 25 Nov 2013 12:31:15 +0000 (13:31 +0100)] 
change the type of 'remote' to addrinfo*, and rename to 'remote_list'.

Warning: this is work in progress, preparing for the full dual-stack
client patch.  With this commit in place, connecting via "--proto udp" or
"--proto tcp-client" to a host that has IPv4+IPv6 in place, on an OS that
will prefer IPv6 to IPv4 will always fail.  The remote_list will have IPv6
in it's first entry, while the socket will try to do AF_INET, and that
will not work.  This will be fixed by the upcoming change to handle
multiple remote IP addresses (as returned by getaddrinfo()) as multiple
<connection> blocks, with appropriate retry and AF selection logic.

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoRemove the ip-remote-hint option.
Arne Schwabe [Mon, 25 Nov 2013 12:31:14 +0000 (13:31 +0100)] 
Remove the ip-remote-hint option.

The ip-remote-hint option overrides the remote hostname of every
remote/connection entry unless management-query-remote is also defined and
the management interfaces overrides the option with remote MOD.

The remote name is even overridden when when management interface issues
remote ACCEPT after being presented with the non overridden remote.

Overriding all remote options can also be done by  management-query-remote
and issuing remote MOD or by changing alll remote statements in the
configuration.

Also: remove unused variable newcycle

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-3-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8057
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoChange proto_remote() function to return a constant string
Arne Schwabe [Mon, 25 Nov 2013 12:31:13 +0000 (13:31 +0100)] 
Change proto_remote() function to return a constant string

Instead of using the implicit protocol string that is returned by the
proto/af to names function return a constant string. The strings have
become part of the wire protocl and we do not want them to change if
the printing of proto/af changes.

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-2-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8055

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoSplit link_socket_init_phase1 and link_socket_init_phase2 into
Arne Schwabe [Mon, 25 Nov 2013 12:31:12 +0000 (13:31 +0100)] 
Split link_socket_init_phase1 and link_socket_init_phase2 into
smaller more managable/readable functions. No functional changes

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-1-git-send-email-arne@rfc2549.org>
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>
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

11 years agoFix two instances of asserting AF_INET
Arne Schwabe [Thu, 21 Nov 2013 20:08:07 +0000 (21:08 +0100)] 
Fix two instances of asserting AF_INET

The http-proxy and socks-proxy work fine with IPv6 but assert having IPv4
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385064495-25877-6-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8010

Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoSplit the PROTO_UDP_xx options into AF_INET/AF_INET6 and PROTO_TCP/PROTO_UDP part.
Arne Schwabe [Sat, 23 Nov 2013 19:57:04 +0000 (20:57 +0100)] 
Split the PROTO_UDP_xx options into AF_INET/AF_INET6 and PROTO_TCP/PROTO_UDP part.

Splitting will make the code a little bit cleaner and prepares for dual
stack

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385236624-3776-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8043
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 years agoSimplify print_sockaddr_ex function, merge duplicate ipv4/ipv6 logic.
Arne Schwabe [Thu, 21 Nov 2013 20:08:03 +0000 (21:08 +0100)] 
Simplify print_sockaddr_ex function, merge duplicate ipv4/ipv6 logic.

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

Signed-off-by: Gert Doering <gert@greenie.muc.de>
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>
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>