0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00
Commit Graph

954 Commits

Author SHA1 Message Date
Gert Doering
53fb2c5c46 work around inet_ntop/inet_pton problems for MSVC builds on WinXP
always use our built-in replacement functions now, even if building
on Win7 (which has inet_ntop/inet_pton in the system libraries) because
the resulting binary will then fail on WinXP.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-25 17:21:35 +01:00
David Sommerseth
0f2bc0dd92 Do some file/directory tests before really starting openvpn
OpenVPN can handle over 30 different files and directories, and it is easy
to misconfigure some of them.  In many situations OpenVPN will even start
running, even with a wrong file path or without the proper permissions, and
then it will complain much later on.  In some cases the error being seen at
this late point might even be difficult to relate to a configuration option.

This patch tries to catch as many of these files as soon as possible, kind of
to "smoke-test" the files and directories to avoid the most likely errors.

Trac-ticket: 73
Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
2011-11-25 14:27:46 +01:00
Gert Doering
03ab4ead82 log error message and exit for "win32, tun mode, tap driver version 9.8"
(driver is known-buggy for small IPv4 packets in tun mode)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-23 12:57:10 +01:00
Gert Doering
1523d11012 bump tap driver version from 9.8 to 9.9
(bugfixed tapdrvr.c regarding small IPv4 packets)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-23 12:57:10 +01:00
David Sommerseth
9f6ac06b6d Make '--win-sys env' default
Without this patch, the default path used by OpenVPN is hard coded
to C:\WINDOWS.  As users might install Windows in a different directory,
this approach will cause OpenVPN to malfunction in some configurations.

OpenVPN have supported using the system path, by adding --win-sys env.
This patch removes the hard coded approach and uses the --win-sys env
approach by default instead.

Trac-ticket: 66
URL: http://thread.gmane.org/gmane.network.openvpn.user/32508
Signed-off-by: David Sommerseth <davids@redhat.com>
Tested-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
2011-11-23 11:53:22 +01:00
David Sommerseth
93626f2cf7 Fix FreeBSD/OpenBSD/NetBSD compiler warnings in get_default_gateway()
On these platforms (including DragonFly), get_default_gateway() would in some
cases return false.  As get_default_gateway() is defined as a void function, and
none of the callers expect a return value -> just return without any value.

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
2011-11-21 13:19:55 +01:00
Samuli Seppänen
354bc04286 Fixed a regression causing VS2008/Python build failure
Patch "Added options to switch between OpenSSL and PolarSSL and PKCS11" caused a
regression when building OpenVPN with Visual Studio 2008/Python build system.
The underlying cause was a wrong path to lzo2.lib.

Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:53:31 +01:00
Adriaan de Jong
b6a8bada51 Fixed a typo when initialising cryptoapi certs
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Heiko Hund <heiko.hund@sophos.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:40 +01:00
Adriaan de Jong
be960aad88 Minor cleanup to enable warning-free Windows build:
- Changed int32_t to size_t
- Removed some unused variables
- Added missing include files
- changed ordering to ensure variable declarations are before asserts

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Tested-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Adriaan de Jong
1d90851ed0 Moved from strsep to strtok, for Windows compatibility
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Adriaan de Jong
7a8d707237 Added options to switch between OpenSSL and PolarSSL and PKCS11...
at compile time. Also included the option to enable/disable PKCS11.

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Adriaan de Jong
7ac7170d0a Reordered functions to ensure warning-free Windows build
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Adriaan de Jong
9009aa464b Moved CryptoAPI header include to the ssl_openssl.c
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Adriaan de Jong
54628d1ac1 Moved prng_uninit out of crypto_uninit_lib
Since prng_uninit is SSL-library agnostic, but crypto_uninit_lib isn't,
the function was moved up a level.

Also removed one unused variable (j) in tls1_P_hash().

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-21 11:51:39 +01:00
Gert Doering
10b99726a3 add missing break between "case IPv4" and "case IPv6", leading to the
minimum-size for IPv6 being applied to IPv4 packets, subsequently
leading to drop of small-sized IPv4 packets.

Bug found & fixed by Christian Niessner.

Signed-off-by: Christian Niessner <bug-report@secadm.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-10 20:25:59 +01:00
David Sommerseth
93ee3932aa Fix PolarSSL and --pkcs12 option issues
PolarSSL does not support PKCS#12 certificate/key bundles, but had a
typo where #ifdef USE_POLARSSL was used, and it should have been #ifndef
instead.

Also added a few extra exclusions of PKCS#12 messages where appropriate,
to avoid confusing users.

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
2011-11-08 17:06:25 +01:00
Adriaan de Jong
8d22a9905d Fixed missing comma in plugin.h
Fixed a bug where the wrong value was being passed to plugin_call_ssl, due to a missing comma.

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-11-07 15:06:26 +01:00
Adriaan de Jong
6e8b90ec0d Further removal of des_old.h based calls
Replaced des_set_key_unchecked and des_ecb_encrypt functions in cipher_des_encrypt_ecb

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-25 12:04:29 +02:00
Adriaan de Jong
899e9e4c24 Removed obsolete des_cblock and des_keyschedule
This is to allow building on NetBSD which does not install <des_old.h> anymore

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-24 16:00:23 +02:00
Adriaan de Jong
9788322b95 Got rid of a few magic numbers in ntlm.c
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-24 12:46:02 +02:00
Adriaan de Jong
31ea2ee4ca Fixed disabling crypto and SSL
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-24 12:35:51 +02:00
Adriaan de Jong
7c785a27bf Added missing #ifdef to allow --disable-managent to work again
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-24 12:20:23 +02:00
Adriaan de Jong
eaacf8d8f2 Moved to PolarSSL 1.0.0:
- Reversed des_key_check_weak output check, as the library changed this
 - Changed POLARSSL_MODE_CFB to POLARSSL_MODE_CFB128
 - Changed the bio write function to accept const input

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:21:13 +02:00
Adriaan de Jong
0e282134d5 Made SSL_CIPHER const in print_details, to fix warning
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:21:13 +02:00
Adriaan de Jong
58ddb7b892 Fixed a typo: print the subject instead of the serial for verification errors
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:21:13 +02:00
Adriaan de Jong
2e791e6577 Removed a stray Fox-IT tag
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:21:13 +02:00
Adriaan de Jong
8a840d832e Unified verification function return values:
- Now return either SUCCESS or FAILURE.
 - SUCCESS is defined as 0.

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:20:55 +02:00
Adriaan de Jong
4ce976fb28 Fixed a bug in the return value of ssl_verify when pre_verify failed
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:02:09 +02:00
Adriaan de Jong
b26341cdb7 Moved gc_new and gc_free to begin end of function
As a safety measure against future modifications

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:02:08 +02:00
Adriaan de Jong
c94eff3c2f Added back checks for ks->authenticated in verify_user_pass
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:02:08 +02:00
Adriaan de Jong
62242ed28d Moved HMAC prints back to main crypto module
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:02:08 +02:00
Adriaan de Jong
0d4ec3d8bb Moved print messages back to generic crypto.c from cipher backends
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:00:34 +02:00
Adriaan de Jong
1271be60c8 Fixed an unintentional change in the options calculated key size.
It is now in bits again.

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 18:00:34 +02:00
Adriaan de Jong
bcedab1f49 Further improvements to plugin support:
- Renamed struct entries to explicitly show them as disabled
 - Added a warning if USE_SSL is enabled, but neither ssl_verify_openssl.h or ssl_verify_polarssl.h is included
 - If neither of those files is included, disable ssl support for a plugin including openvpn-plugin.h

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 17:22:51 +02:00
Adriaan de Jong
1876ccd012 Fixes for the plugin system:
- Removed the dependency on an SSL library for USE_SSL when creating non-SSL plugins
 - Fixed example plugin code to include USE_SSL when needed

Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 17:22:51 +02:00
Adriaan de Jong
557624e0a7 Hardening: periodically reset the PRNG's nonce value
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 17:22:51 +02:00
Adriaan de Jong
7dd8bbf574 Disabled X.509 track and username selection for PolarSSL
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
88203950ef Added SSL library to title string
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
a9bf901c76 Added an extra define to allow building without PKCS#11
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
8bb72fbcba Refactored (and disabled for PolarSSL) support for writing external cert files in scripts
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
477127061a Removed stray X509_free from ssl.c
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
5fa82c550f Removed support for management external keys in PolarSSL
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
93c22ecc63 Disable CryptoAPI when not using OpenSSL, and document that fact.
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
8d26c253e8 Added warning that --capath is not available with PolarSSL
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
88133cdb96 Added a warning that the PolarSSL library does not support pkcs12 files.
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 16:00:49 +02:00
Adriaan de Jong
c2896b10c5 Fixed a compilation warning for size_t key sizes
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 15:18:53 +02:00
Adriaan de Jong
50d1fc0dd5 Updated ssl_polarssl.c to work with 0.99-pre5
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 14:35:16 +02:00
Adriaan de Jong
be0a08d452 Changed PolarSSL crypto backend to support v0.99-pre5
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 14:35:16 +02:00
Adriaan de Jong
7ce40d9931 Added SHA_DIGEST_SIZE definition
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 14:35:16 +02:00
Adriaan de Jong
f25d29c9b2 Fixed a bug in the hash generation in ssl_verify_openssl.c
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
2011-10-22 14:35:16 +02:00