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

31 Commits

Author SHA1 Message Date
Selva Nair
b4fc8bbd6b Enable dhcp on tap adapter using interactive service
Currently, if dhcp on the TAP interface is disabled, OpenVPN
on Windows tries to enable it using netsh but that succeeds only when
run with admin privileges.

When interactive service is available, delegate this task to the
service.

Trac: #1111
Tested on Windows 7

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1538510474-27602-2-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17517.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2018-10-05 15:03:21 +02:00
Selva Nair
da0a42ca98 Bump version of openvpn plugin argument structs to 5
This was missed in commit 6690769f78
that exported base64_encode and base64_decode() functions.

Also check the version is >= 5 in auth-pam plugin to ensure
that the base64_decode function pointer can be referenced.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1533696271-21799-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=1533696271-21799-1-git-send-email-selva.nair@gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2018-08-08 09:02:54 +02:00
David Sommerseth
6690769f78 plugin: Export base64 encode and decode functions
This patch builds on the "Export secure_memzero() to plug-ins" patch and
adds export of openvpn_base64_encode() and openvpn_base64_decode()

This also ships with a very simple plug-in which demonstrates how to use
the new exported functions.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20170505214624.11675-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14558.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2018-08-05 22:23:58 +02:00
Selva Nair
a2f43c2d6f Correct the declaration of handle in 'struct openvpn_plugin_args_open_return'
- This is an opaque pointer so the change should not affect
  existing plugins. But it makes the code consistent and clears up
  the documentation as the handle pointer is treated as of type
  "openvpn_plugin_handle_t" in the rest of the code.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <1511228605-23207-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15908.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2018-08-05 20:50:51 +02:00
David Sommerseth
499794596d Update copyright to include 2018 plus company name change
The autumn of 2017, OpenVPN Technologies, Inc changed name to just
OpenVPN Inc.  Otherwise, extend the copyright to cover 2018 as well.

With the exception of the company name change, all changes have been
performed by the dev-tools/update-copyright.sh script.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20180131140314.11103-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16418.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2018-02-01 08:29:21 +01:00
Antonio Quartulli
c7ca91332d Remove ENABLE_CRYPTO
The crypto engine cannot be disabled anymore, therefore get
rid of all the related ifdefs in the code.

This change makes the code simpler and reduces our the
number of config combinations we have to test after a new
change is applied.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20171204010110.22091-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16004.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2017-12-04 19:12:27 +01:00
David Sommerseth
caa54ac398 copyright: Update GPLv2 license texts
The COPYRIGHT.GPL file was slightly out-of-sync with the last GPLv2
license from Free Software Foundation, Inc.

The changes are primarily a new address, which required touching almost
all the project files.

Except of that, it is just minor adjustments to formatting, removal of
form-feed characters and referencing "GNU Lesser General Public License"
instead of "GNU Library General Public License".

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170329093648.10156-1-davids@openvpn.net>
URL: https://www.mail-archive.com/search?l=mid&q=20170329093648.10156-1-davids@openvpn.net
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2017-06-16 10:38:03 +02:00
Matthias Andree
cf9deedf42 Make openvpn-plugin.h self-contained again.
2.4.2 introduced a declaration that references size_t, so use the C99
way of declaring it, and add #include <stddef.h>.

Note this may break on non-C99-compliant versions of MS Visual Studio.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1494884925-12539-1-git-send-email-matthias.andree@gmx.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14658.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2017-05-18 12:53:25 +02:00
David Sommerseth
f018dfcc36
plugin: Export secure_memzero() to plug-ins
The provides plug-ins with a safe and secure way to santize sensitive
information such as passwords, by re-using the secure_memzero()
implementation in OpenVPN.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20170505184622.24520-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14546.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-05-09 19:12:01 +02:00
David Sommerseth
26e3427cfa plugin: Fix documentation typo for type_mask
The v3 plug-in API was slightly misleading, as that interface does not
need to use an int pointer to setting the type_mask from the plug-in.

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20170508141939.31224-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14576.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-05-09 12:16:15 +02:00
Christian Hesse
631812fe29
plugin: Remove GNUism in openvpn-plugin.h generation
The plugin path handling cleanup (4590c383) introduced GNUism and broke
builds on system not using GNU Make (like *BSD).

Revert back to let configure generate the header file. Instead let make
add an extra CFLAG that defines PLUGIN_LIBDIR.

Signed-off-by: Christian Hesse <mail@eworm.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170127084927.21040-1-list@eworm.de>
URL: http://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13966.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-01-27 15:43:40 +01:00
Christian Hesse
4590c3831d
Clean up plugin path handling
Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This puts a define into include/openvpn-plugin.h.in which has the plugin
directory.

The configure script does not know about the final plugin path. Thus we
have to make Make generate the final header file for us.

As the path is always available remove the compile time condition (and
dead code) from src/openvpn/plugin.c.

v2: The configure script can not evaluate the final $libdir path. So
    use make to create a header file on the containing the final path.

v3: Fix whitespace errors and gitignore location.

v4: No extra header file, generate src/openvpn/plugin.h on the fly.
    Remove condition and dead code.

v5: Move the define to include/openvpn-plugin.h.in and let make generate
    the final header file.

Signed-off-by: Christian Hesse <mail@eworm.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20170125201947.17197-1-list@eworm.de>
URL: http://www.mail-archive.com/search?l=mid&q=20170125201947.17197-1-list@eworm.de
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-01-25 22:10:43 +01:00
David Sommerseth
5871697964 Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1482350454-27280-2-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13653.html
2016-12-21 21:57:58 +01:00
David Sommerseth
81d882d530
The Great Reformatting - first phase
This is the first commit of the big reformatting task.  This
is performed by running the ./dev-tools/reformat-all.sh script.

This is based upon the v3 reformat-all.sh/uncrustify.conf version
which is now applied to git master.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2016-12-14 22:33:49 +01:00
Selva Nair
c098016a22 Set IPv6 DNS servers using interactive service
- Any existing addresses are deleted before adding
- On close_tun all addresses are deleted (only if any were added)

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1479958527-29491-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13222.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-11-24 11:58:57 +01:00
Gert Doering
445b192a7c Replace WIN32 by _WIN32
With c99, "WIN32" is no longer automatically defined when (cross-)building
for Windows, and proper compilation relies on including <windefs.h>,
before checking the macro.  "_WIN32" is the official define that is
guaranteed to be defined by the compiler itself, no includes are needed.

So, mechanically change all occurrances of "WIN32" to "_WIN32".

While at it, get rid of unused WIN32_0_1 #define in syshead.h

See also:
http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefi
ned_macros_detect_operating_system#WindowsCygwinnonPOSIXandMinGW

Trac #746

v2: rebased to master, merge the console[_builtin].c changes

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20161113195228.74090-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13035.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-11-15 09:38:06 +01:00
Selva Nair
3e42a55810 Add support for register-dns through interactive service
The call to the service returns promptly after delegating the job to
a thread, before the task is completed. In the thread, "net stop dnscache",
"net start dnscache", "ipconfig /flushdns" and "ipconfig /register-dns"
are executed in that order.

Parallel execution of these commands is prevented by a lock that is
common to all connections started by the service.

Note: "net stop .." is used instead of "sc stop.." as the latter can
return before the service has fully stopped (in STOP_PENDING state),
causing the subsequent start to fail.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1457671646-4322-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11354
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-05-16 17:44:45 +02:00
Steffan Karger
86d8cd6860 Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.

This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'.  A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.

This patch intends to not change any behaviour.

The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
 * In ssl_polarssl.c: the debug callback prototype changed, so our
   implementation changed a bit too.
 * in ssl_polarssl.c: the old polarssl ssl_context is now split into a
   mbedtls_ssl_config and mbedtls_ssl_context.  The intention is that
   mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
   contains the per-connection state.  That doesn't work for us, because
   we use per-connection verify callback data, while the verify callback
   is registered on mbed_tls_config.  Therefore we still need to init a
   mbed_tls_config struct for each connection.
 * in ssl_polarssl.c: the mbed bio handling changed, so our
   implementation changed a bit too.
 * in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
   functions now fail if we don't provide a NUL-terminated string, so use
   strlen()+1 as the length argument to include the terminating NUL.

I tested this patch to work with:
 * 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
 * static key mode
 * TLS mode with PEM key file
 * TLS mode with password protected PEM key file
 * TLS mode with management-external-key
 * TLS mode with PKCS#11
 * TLS mode with inline ca/key/cert/dh

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-28 14:31:01 +02:00
Selva Nair
2282b1be79 Add support for block-outside-dns through the interactive service
- Add a new message type in openvpn-msg.h
- Pass msg_channel HANDLE to win_wfp_block_dns and win_wfp_uninit
- Add a handler in interactive.c for block_dns request

The service build now depends on block_dns.[ch] in src/openvpn

v2 changes:
- Make CmpEngine non-nested (be nice with non-gcc compilers)
- Print error code in hex

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1456457091-3872-2-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11265
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-03-06 19:28:25 +01:00
Heiko Hund
a24dd2e31f interactive service v3
v1: Heiko Hund
 - Message-ID: <2215306.x9ci9DhAZ9@de-gn-40970>
 - extend openvpn service to provide "automatic service" and "interactive
   service" (which is used by GUI and OpenVPN to run openvpn non-privileged
   and still be able to install routes and configure IPv6 addresses)
 - add --msg-channel <n> option to openvpn to tell it which pipe to use
   to talk to the interactive service (used in tun.c for ifconfig + ARP
   flush, and route.c for routing)
 - add openvpn-msg.h with message definitions for talking to interactive
   service
 - routing in openvpn uses message-pipe automatically if --msg-channel <n>
   is configured, no other option needed
 - today, the integration in route.c and tun.c is windows-only, but could
   be adapted to other platforms

v2: Steffan Karger
 - Message-ID: <548D9046.5000600@karger.me>
 - include "openvpn-msg.h" not "include/openvpn-msg.h"
 - add $(top_srcdir)/include to openvpnsrv build for out-of-tree builds

v3: Gert Doering, rebasing and integrating review feedback
 - rebased to 417fe4a72c
 - r->metric_defined is now r->flags & RT_METRIC_DEFINED (c3ef2d2333)
 - move "openvpn-msg.h" include inside #ifdef WIN32 (windows-only right now)
 - hide "msg_channel" extra option inside tt->tuntap_options, so we do not
   need an extra argument to all the add/del_route...() functions
 - do_route_ipv6_service(): use r->adapter index (if set) for RGI6 routes

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Acked-by: Selva Nair <selva.nair@gmail.com>        (Service changes)
Acked-by: Arne Schwabe <arne@rfc2549.org>          (OpenVPN changes)
Message-Id: <1453835508-26119-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11027
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-02-05 09:07:54 +01:00
Gert Doering
710c439817 Fix build on OpenSolaris (non-gmake)
Was broken in commit 9de35d4, missing backslash in include/Makefile.am

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1438030010-953-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9967
2015-07-27 23:06:50 +02:00
David Sommerseth
6a40276c75 Provide OpenVPN runtime version information to plug-ins
Also updated the log_v3 sample-plugin to demonstrate how this
works.

  $ openvpn --plugin log_v3.so --dev tun
  Fri Jul 10 15:17:28 2015 OpenVPN 2.3_git
[git:dev/plugin-version/f05d8623a29078bf+].....
  ...more.openvpn.logging...
  log_v3: OpenVPN 2.3_git  (Major: 2, Minor: 3, Patch:
git:dev/plugin-version/f05d8623a29078bf+)
  ...more.openvpn.logging...
  $

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1436534548-21507-3-git-send-email-openvpn.list@topphemmelig.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9904
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-07-27 21:02:02 +02:00
David Sommerseth
9de35d4633 Provide compile time OpenVPN version information to plug-ins
This is to provide more fine grained information to plug-ins
about the OpenVPN environment when OpenVPN was built.

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1436534548-21507-2-git-send-email-openvpn.list@topphemmelig.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9905
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-07-27 20:48:46 +02:00
Steffan Karger
ec828db63f Remove ENABLE_SSL define (and --disable-ssl configure option)
Remove the --disable-ssl configure option and accompanying ENABLE_SSL
defines in the master/2.4 branch, to reduce the code and testing
complexity a bit.

This does not remove to runtime option to run without SSL, just the compile
time option to not include any SSL-related code.

During the community meeting in November 2014 there were no objections
amongst he developers present. Also, this has been announced on the -users
and -devel mailing lists two weeks ago, without any response whatsoever.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <54A4248A.1090501@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9371
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2014-12-31 17:36:54 +01:00
Steffan Karger
cc1cee74c6 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>
2014-04-21 12:37:46 +02:00
David Sommerseth
587df08abd 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>
2013-07-03 21:20:59 +02:00
Heiko Hund
be532e0d15 add API for plug-ins to write to openvpn log
Some plugins want to add messages to the openvpn log file. The
plugin_log() and plugin_vlog() APIs provide ways for them to do so.

OPENVPN_PLUGINv3_STRUCTVER is not incremented as the v3 plugin API
is new in 2.3 and this is merged during alpha phase.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: 1343920822-29161-1-git-send-email-heiko.hund@sophos.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6946
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
2012-08-06 12:16:12 +02:00
Alon Bar-Lev
13663f206d cleanup: plugin: support C++ plugin
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Fabian Knittel <fabian.knittel@lettink.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2012-04-26 20:17:32 +02:00
Alon Bar-Lev
0e4b6c455e build: use tap-windows.h as external dependency
tap-windows.h is provided by the tap project

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
2012-03-24 00:14:23 +01:00
Alon Bar-Lev
9b33b5a4b1 build: proper crypto detection and usage
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2012-03-22 22:53:39 +01:00
Alon Bar-Lev
34cb9132ef build: standard directory layout
Suitable for mature project.

root   - administrative stuff
doc    - documents
src    - sources
tests  - tests
distro - distro specific files
sample - samples

SIDE EFFECT: many changes to rpm spec.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
2012-03-22 22:07:08 +01:00