From 6149d88c5a2c58a9cc943ca02c36e8ee4e5d1751 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Iniesta Date: Tue, 30 Jun 2015 08:22:29 +0200 Subject: Imported Upstream version 2.3.7 --- .gitignore | 1 + ChangeLog | 102 ++- Makefile.in | 2 + aclocal.m4 | 10 +- build/Makefile.in | 6 +- build/msvc/Makefile.in | 6 +- build/msvc/msvc-generate/Makefile.in | 6 +- config.guess | 192 +---- config.h.in | 9 +- config.sub | 30 +- configure | 308 ++++++- configure.ac | 42 +- distro/Makefile.am | 2 + distro/Makefile.in | 7 +- distro/rpm/Makefile.in | 6 +- distro/rpm/openvpn.spec | 2 +- distro/systemd/openvpn-client@.service | 20 + distro/systemd/openvpn-server@.service | 19 + doc/Makefile.in | 6 +- doc/openvpn.8 | 1255 +++++++++++++++------------- include/Makefile.in | 6 +- ltmain.sh | 4 +- sample/Makefile.in | 6 +- sample/sample-config-files/client.conf | 17 +- sample/sample-config-files/loopback-client | 2 +- sample/sample-config-files/loopback-server | 3 +- sample/sample-config-files/server.conf | 6 +- sample/sample-config-files/tls-office.conf | 2 +- sample/sample-keys/.gitignore | 1 + sample/sample-keys/README | 21 +- sample/sample-keys/ca.crt | 48 +- sample/sample-keys/ca.key | 67 +- sample/sample-keys/client-ec.crt | 85 ++ sample/sample-keys/client-ec.key | 5 + sample/sample-keys/client-pass.key | 30 + sample/sample-keys/client.crt | 126 ++- sample/sample-keys/client.key | 43 +- sample/sample-keys/client.p12 | Bin 0 -> 4533 bytes sample/sample-keys/dh1024.pem | 5 - sample/sample-keys/dh2048.pem | 8 + sample/sample-keys/gen-sample-keys.sh | 75 ++ sample/sample-keys/openssl.cnf | 139 +++ sample/sample-keys/pass.crt | 65 -- sample/sample-keys/pass.key | 18 - sample/sample-keys/pkcs12.p12 | Bin 2685 -> 0 bytes sample/sample-keys/server-ec.crt | 96 +++ sample/sample-keys/server-ec.key | 5 + sample/sample-keys/server.crt | 130 ++- sample/sample-keys/server.key | 43 +- src/Makefile.in | 6 +- src/compat/Makefile.in | 6 +- src/openvpn/Makefile.in | 6 +- src/openvpn/crypto.c | 27 +- src/openvpn/crypto.h | 72 +- src/openvpn/crypto_backend.h | 12 +- src/openvpn/crypto_openssl.c | 4 +- src/openvpn/crypto_polarssl.c | 4 +- src/openvpn/forward.c | 1 + src/openvpn/helper.c | 2 +- src/openvpn/init.c | 86 +- src/openvpn/init.h | 2 + src/openvpn/mtu.h | 6 + src/openvpn/openvpn.c | 4 + src/openvpn/options.c | 110 ++- src/openvpn/options.h | 4 + src/openvpn/pkcs11.c | 5 - src/openvpn/pkcs11.h | 3 - src/openvpn/route.c | 23 +- src/openvpn/socket.c | 12 +- src/openvpn/ssl.c | 54 +- src/openvpn/ssl.h | 3 +- src/openvpn/ssl_backend.h | 2 +- src/openvpn/ssl_common.h | 16 +- src/openvpn/ssl_openssl.c | 39 +- src/openvpn/ssl_polarssl.c | 82 +- src/openvpn/ssl_verify.c | 6 +- src/openvpn/syshead.h | 4 - src/openvpn/tun.c | 119 ++- src/openvpn/tun.h | 3 + src/openvpnserv/Makefile.in | 6 +- src/plugins/Makefile.in | 6 +- src/plugins/auth-pam/Makefile.in | 6 +- src/plugins/down-root/Makefile.in | 6 +- src/plugins/down-root/down-root.c | 696 ++++++++------- test-driver | 139 --- tests/Makefile.in | 457 +++------- tests/t_client.sh | 8 +- tests/t_lpback.sh | 3 + version.m4 | 4 +- 89 files changed, 3011 insertions(+), 2130 deletions(-) create mode 100644 distro/systemd/openvpn-client@.service create mode 100644 distro/systemd/openvpn-server@.service create mode 100644 sample/sample-keys/.gitignore create mode 100644 sample/sample-keys/client-ec.crt create mode 100644 sample/sample-keys/client-ec.key create mode 100644 sample/sample-keys/client-pass.key create mode 100644 sample/sample-keys/client.p12 delete mode 100644 sample/sample-keys/dh1024.pem create mode 100644 sample/sample-keys/dh2048.pem create mode 100755 sample/sample-keys/gen-sample-keys.sh create mode 100644 sample/sample-keys/openssl.cnf delete mode 100644 sample/sample-keys/pass.crt delete mode 100644 sample/sample-keys/pass.key delete mode 100644 sample/sample-keys/pkcs12.p12 create mode 100644 sample/sample-keys/server-ec.crt create mode 100644 sample/sample-keys/server-ec.key delete mode 100755 test-driver diff --git a/.gitignore b/.gitignore index a04afff..0571e80 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ config.sub configure configure.h depcomp +doxygen/ stamp-h1 install-sh missing diff --git a/ChangeLog b/ChangeLog index 08c4cc0..0f091bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,105 @@ OpenVPN Change Log -Copyright (C) 2002-2014 OpenVPN Technologies, Inc. +Copyright (C) 2002-2015 OpenVPN Technologies, Inc. + +2015.06.02 -- Version 2.3.7 +Alexander Pyhalov (1): + Default gateway can't be determined on illumos/Solaris platforms + +Arne Schwabe (1): + Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4 + +David Sommerseth (6): + autotools: Fix wrong ./configure help screen default values + down-root plugin: Replaced system() calls with execve() + down-root: Improve error messages + plugin, down-root: Fix compiler warnings + sockets: Remove the limitation of --tcp-nodelay to be server-only + plugins, down-root: Code style clean-up + +David Woodhouse (2): + pkcs11: Load p11-kit-proxy.so module by default + Make 'provider' option to --show-pkcs11-ids optional where p11-kit is present + +Felix Janda (1): + Use OPENVPN_ETH_P_* so that is unecessary + +Gert Doering (17): + New approach to handle peer-id related changes to link-mtu (2.3 version) + Fix incorrect use of get_ipv6_addr() for iroute options. + Print helpful error message on --mktun/--rmtun if not available. + explain effect of --topology subnet on --ifconfig + Add note about file permissions and --crl-verify to manpage. + repair --dev null breakage caused by db950be85d37 + assume res_init() is always there. + Correct note about DNS randomization in openvpn.8 + Disallow usage of --server-poll-timeout in --secret key mode. + slightly enhance documentation about --cipher + Enforce "serial-tests" behaviour for tests/Makefile + Revert "Enforce "serial-tests" behaviour for tests/Makefile" + On signal reception, return EAI_SYSTEM from openvpn_getaddrinfo(). + Use configure.ac hack to apply serial_test AM option only if supported. + Use EAI_AGAIN instead of EAI_SYSTEM for openvpn_getaddrinfo(). + Move res_init() call to inner openvpn_getaddrinfo() loop + Fix FreeBSD ifconfig for topology subnet tunnels. + +Guy Yur (1): + Fix --redirect-private in --dev tap mode. + +Jan Just Keijser (1): + include ifconfig_ environment variables in --up-restart env set + +Jonathan K. Bullard (1): + Fix null pointer dereference in options.c + +Lev Stipakov (1): + Fix mssfix default value in connection_list context + +Matthias Andree (1): + Manual page update for Re-enabled TLS version negotiation. + +Mike Gilbert (1): + Include systemd units in the source tarball (make dist) + +Robert Fischer (1): + Updated manpage for --rport and --lport + +Samuli Seppänen (2): + Properly escape dashes on the man-page + Improve documentation in --script-security section of the man-page + +Steffan Karger (14): + Really fix '--cipher none' regression + Update doxygen (a bit) + Set tls-version-max to 1.1 if cryptoapicert is used + Account for peer-id in frame size calculation + Disable SSL compression + Fix frame size calculation for non-CBC modes. + Allow for CN/username of 64 characters (fixes off-by-one) + Remove unneeded parameter 'first_time' from possibly_become_daemon() + Re-enable TLS version negotiation by default + Remove size limit for files inlined in config + Improve --tls-cipher and --show-tls man page description + Re-read auth-user-pass file on (re)connect if required + Clarify --capath option in manpage + Call daemon() before initializing crypto library + + +2014.11.28 -- Version 2.3.6 +David Sommerseth (1): + systemd: Reworked the systemd unit file to handle server and client configs better + +Gert Doering (1): + Add client-only support for peer-id. + +Samuli Seppänen (1): + Fix to --shaper documentation on the man-page + +Steffan Karger (4): + Fix assertion error when using --cipher none + Add --tls-version-max + Modernize sample keys and sample configs + Drop too-short control channel packets instead of asserting out. + 2014.10.24 -- Version 2.3.5 Andris Kalnozols (2): diff --git a/Makefile.in b/Makefile.in index 82a762e..a86498f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -338,6 +338,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ diff --git a/aclocal.m4 b/aclocal.m4 index c4b5b0b..0651eb9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -103,10 +103,9 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- @@ -573,7 +572,8 @@ to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi -fi]) +fi +]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further diff --git a/build/Makefile.in b/build/Makefile.in index 32f3dfa..0507078 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -256,6 +256,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -363,9 +365,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu build/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu build/Makefile + $(AUTOMAKE) --foreign build/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/build/msvc/Makefile.in b/build/msvc/Makefile.in index f5cbb6b..7a32914 100644 --- a/build/msvc/Makefile.in +++ b/build/msvc/Makefile.in @@ -257,6 +257,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -361,9 +363,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu build/msvc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/msvc/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu build/msvc/Makefile + $(AUTOMAKE) --foreign build/msvc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/build/msvc/msvc-generate/Makefile.in b/build/msvc/msvc-generate/Makefile.in index 60b4e6a..d6c3b5e 100644 --- a/build/msvc/msvc-generate/Makefile.in +++ b/build/msvc/msvc-generate/Makefile.in @@ -200,6 +200,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -308,9 +310,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu build/msvc/msvc-generate/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/msvc/msvc-generate/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu build/msvc/msvc-generate/Makefile + $(AUTOMAKE) --foreign build/msvc/msvc-generate/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/config.guess b/config.guess index b79252d..1f5c50c 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-06-10' +timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -149,7 +149,7 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac @@ -826,7 +826,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -969,10 +969,10 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} exit ;; - or32:Linux:*:*) + or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) @@ -1260,16 +1260,26 @@ EOF if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; @@ -1361,154 +1371,6 @@ EOF exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 < header file. */ #undef HAVE_NETDB_H -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H - /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H @@ -394,9 +394,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_RESOLV_H -/* Define to 1 if you have the `res_init' function. */ -#undef HAVE_RES_INIT - /* Define to 1 if you have the `sd_booted' function. */ #undef HAVE_SD_BOOTED diff --git a/config.sub b/config.sub index 9633db7..bba4efb 100755 --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-08-10' +timestamp='2014-09-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -265,6 +265,7 @@ case $basic_machine in | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -282,8 +283,10 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -295,11 +298,11 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -324,7 +327,7 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -381,6 +384,7 @@ case $basic_machine in | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ @@ -400,8 +404,10 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -413,6 +419,7 @@ case $basic_machine in | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -822,6 +829,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1367,14 +1378,14 @@ case $os in | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1592,9 +1603,6 @@ case $basic_machine in mips*-*) os=-elf ;; - or1k-*) - os=-elf - ;; or32-*) os=-coff ;; diff --git a/configure b/configure index cc8e3d2..1156c4b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for OpenVPN 2.3.5. +# Generated by GNU Autoconf 2.69 for OpenVPN 2.3.7. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenVPN' PACKAGE_TARNAME='openvpn' -PACKAGE_VERSION='2.3.5' -PACKAGE_STRING='OpenVPN 2.3.5' +PACKAGE_VERSION='2.3.7' +PACKAGE_STRING='OpenVPN 2.3.7' PACKAGE_BUGREPORT='openvpn-users@lists.sourceforge.net' PACKAGE_URL='' @@ -660,6 +660,8 @@ OPTIONAL_DL_LIBS TAP_WIN_MIN_MINOR TAP_WIN_MIN_MAJOR TAP_WIN_COMPONENT_ID +P11KIT_LIBS +P11KIT_CFLAGS libsystemd_LIBS libsystemd_CFLAGS LZO_LIBS @@ -882,7 +884,9 @@ POLARSSL_LIBS LZO_CFLAGS LZO_LIBS libsystemd_CFLAGS -libsystemd_LIBS' +libsystemd_LIBS +P11KIT_CFLAGS +P11KIT_LIBS' # Initialize some variables set by options. @@ -1423,7 +1427,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenVPN 2.3.5 to adapt to many kinds of systems. +\`configure' configures OpenVPN 2.3.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1493,7 +1497,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenVPN 2.3.5:";; + short | recursive ) echo "Configuration of OpenVPN 2.3.7:";; esac cat <<\_ACEOF @@ -1512,7 +1516,7 @@ Optional Features: allow limited interoperability with LZO-enabled peers [default=no] --disable-crypto disable crypto support [default=yes] - --enable-ofb-cfb enable support for OFB and CFB cipher modes + --disable-ofb-cfb disable support for OFB and CFB cipher modes [default=yes] --disable-ssl disable SSL support for TLS-based key exchange [default=yes] @@ -1537,9 +1541,9 @@ Optional Features: --disable-debug disable debugging support (disable gremlin and verb 7+ messages) [default=yes] --enable-small enable smaller executable size (disable OCC, usage - message, and verb 4 parm list) [default=yes] + message, and verb 4 parm list) [default=no] --enable-password-save allow --askpass and --auth-user-pass passwords to be - read from a file [default=yes] + read from a file [default=no] --enable-iproute2 enable support for iproute2 [default=no] --disable-def-auth disable deferred authentication [default=yes] --disable-pf disable internal packet filter [default=yes] @@ -1627,6 +1631,9 @@ Some influential environment variables: C compiler flags for libsystemd, overriding pkg-config libsystemd_LIBS linker flags for libsystemd, overriding pkg-config + P11KIT_CFLAGS + C compiler flags for P11KIT, overriding pkg-config + P11KIT_LIBS linker flags for P11KIT, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1694,7 +1701,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenVPN configure 2.3.5 +OpenVPN configure 2.3.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2476,7 +2483,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenVPN $as_me 2.3.5, which was +It was created by OpenVPN $as_me 2.3.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2840,7 +2847,7 @@ if test -z "${htmldir}"; then fi -$as_echo "#define OPENVPN_VERSION_RESOURCE 2,3,5,0" >>confdefs.h +$as_echo "#define OPENVPN_VERSION_RESOURCE 2,3,7,0" >>confdefs.h ac_aux_dir= @@ -2876,6 +2883,8 @@ ac_config_headers="$ac_config_headers config.h" + + am__api_version='1.14' # Find a good install program. We prefer a C program (faster), @@ -3048,8 +3057,8 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -3362,7 +3371,7 @@ fi # Define the identity of the package. PACKAGE='openvpn' - VERSION='2.3.5' + VERSION='2.3.7' cat >>confdefs.h <<_ACEOF @@ -3454,7 +3463,7 @@ END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi -# Make sure we can run config.sub. + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -14460,7 +14469,7 @@ SOCKET_INCLUDES=" #endif " -for ac_header in net/if.h netinet/ip.h netinet/if_ether.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h +for ac_header in net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "${SOCKET_INCLUDES} @@ -15098,17 +15107,6 @@ _ACEOF fi done -for ac_func in res_init -do : - ac_fn_c_check_func "$LINENO" "res_init" "ac_cv_func_res_init" -if test "x$ac_cv_func_res_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_RES_INIT 1 -_ACEOF - -fi -done - # Windows use stdcall for winsock so we cannot auto detect these @@ -15209,6 +15207,178 @@ done fi LIBS="${old_LIBS}" +# we assume res_init() always exist, but need to find out *where*... +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing __res_init" >&5 +$as_echo_n "checking for library containing __res_init... " >&6; } +if ${ac_cv_search___res_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __res_init (); +int +main () +{ +return __res_init (); + ; + return 0; +} +_ACEOF +for ac_lib in '' resolv bind; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search___res_init=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search___res_init+:} false; then : + break +fi +done +if ${ac_cv_search___res_init+:} false; then : + +else + ac_cv_search___res_init=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search___res_init" >&5 +$as_echo "$ac_cv_search___res_init" >&6; } +ac_res=$ac_cv_search___res_init +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_init" >&5 +$as_echo_n "checking for library containing res_9_init... " >&6; } +if ${ac_cv_search_res_9_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char res_9_init (); +int +main () +{ +return res_9_init (); + ; + return 0; +} +_ACEOF +for ac_lib in '' resolv bind; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_res_9_init=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_res_9_init+:} false; then : + break +fi +done +if ${ac_cv_search_res_9_init+:} false; then : + +else + ac_cv_search_res_9_init=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_9_init" >&5 +$as_echo "$ac_cv_search_res_9_init" >&6; } +ac_res=$ac_cv_search_res_9_init +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_init" >&5 +$as_echo_n "checking for library containing res_init... " >&6; } +if ${ac_cv_search_res_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char res_init (); +int +main () +{ +return res_init (); + ; + return 0; +} +_ACEOF +for ac_lib in '' resolv bind; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_res_init=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_res_init+:} false; then : + break +fi +done +if ${ac_cv_search_res_init+:} false; then : + +else + ac_cv_search_res_init=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_init" >&5 +$as_echo "$ac_cv_search_res_init" >&6; } +ac_res=$ac_cv_search_res_init +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + +fi + + old_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} ${TAP_CFLAGS}" @@ -16730,6 +16900,84 @@ if test "${enable_pkcs11}" = "yes"; then $as_echo "#define ENABLE_PKCS11 1" >>confdefs.h + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for P11KIT" >&5 +$as_echo_n "checking for P11KIT... " >&6; } + +if test -n "$P11KIT_CFLAGS"; then + pkg_cv_P11KIT_CFLAGS="$P11KIT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"p11-kit-1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "p11-kit-1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_P11KIT_CFLAGS=`$PKG_CONFIG --cflags "p11-kit-1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$P11KIT_LIBS"; then + pkg_cv_P11KIT_LIBS="$P11KIT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"p11-kit-1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "p11-kit-1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_P11KIT_LIBS=`$PKG_CONFIG --libs "p11-kit-1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + P11KIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "p11-kit-1" 2>&1` + else + P11KIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "p11-kit-1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$P11KIT_PKG_ERRORS" >&5 + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +else + P11KIT_CFLAGS=$pkg_cv_P11KIT_CFLAGS + P11KIT_LIBS=$pkg_cv_P11KIT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`" + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PKCS11_MODULE "${proxy_module}" +_ACEOF + +fi fi if test "${enable_pedantic}" = "yes"; then @@ -17388,7 +17636,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenVPN $as_me 2.3.5, which was +This file was extended by OpenVPN $as_me 2.3.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17454,7 +17702,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -OpenVPN config.status 2.3.5 +OpenVPN config.status 2.3.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0e0fae5..54b01a4 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,21 @@ AC_CONFIG_AUX_DIR([.]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([src/openvpn/syshead.h]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE + +dnl Initialize automake. automake < 1.12 didn't have serial-tests and +dnl gives an error if it sees this, but for automake >= 1.13 +dnl serial-tests is required so we have to include it. Solution is to +dnl test for the version of automake (by running an external command) +dnl and provide it if necessary. Note we have to do this entirely using +dnl m4 macros since automake queries this macro by running +dnl 'autoconf --trace ...'. +m4_define([serial_tests], [ + m4_esyscmd([automake --version | + head -1 | + awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}' + ]) +]) +AM_INIT_AUTOMAKE(foreign serial_tests) dnl NB: Do not [quote] this parameter. AC_CANONICAL_HOST AC_USE_SYSTEM_EXTENSIONS @@ -62,7 +76,7 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [ofb-cfb], - [AS_HELP_STRING([--enable-ofb-cfb], [enable support for OFB and CFB cipher modes @<:@default=yes@:>@])], + [AS_HELP_STRING([--disable-ofb-cfb], [disable support for OFB and CFB cipher modes @<:@default=yes@:>@])], , [enable_crypto_ofb_cfb="yes"] ) @@ -160,14 +174,14 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [small], - [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=yes@:>@])], + [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=no@:>@])], , [enable_small="no"] ) AC_ARG_ENABLE( [password-save], - [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=yes@:>@])], + [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=no@:>@])], , [enable_password_save="no"] ) @@ -457,7 +471,7 @@ SOCKET_INCLUDES=" " AC_CHECK_HEADERS( - [net/if.h netinet/ip.h netinet/if_ether.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h], + [net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h], , , [[${SOCKET_INCLUDES}]] @@ -603,12 +617,6 @@ AC_SUBST([SOCKETS_LIBS]) old_LIBS="${LIBS}" LIBS="${LIBS} ${SOCKETS_LIBS}" AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton]) -AC_CHECK_FUNCS( - [res_init], - , - , - [[#include ]] -) # Windows use stdcall for winsock so we cannot auto detect these m4_define( [SOCKET_FUNCS], @@ -636,6 +644,11 @@ else fi LIBS="${old_LIBS}" +# we assume res_init() always exist, but need to find out *where*... +AC_SEARCH_LIBS(__res_init, resolv bind, , + AC_SEARCH_LIBS(res_9_init, resolv bind, , + AC_SEARCH_LIBS(res_init, resolv bind, , ))) + AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap]) old_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} ${TAP_CFLAGS}" @@ -1044,6 +1057,13 @@ if test "${enable_pkcs11}" = "yes"; then OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}" OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}" AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11]) + PKG_CHECK_MODULES( + [P11KIT], + [p11-kit-1], + [proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`" + AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "${proxy_module}", [p11-kit proxy])], + [] + ) fi if test "${enable_pedantic}" = "yes"; then diff --git a/distro/Makefile.am b/distro/Makefile.am index 2dd6a6e..bd65b79 100644 --- a/distro/Makefile.am +++ b/distro/Makefile.am @@ -13,3 +13,5 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in SUBDIRS = rpm + +EXTRA_DIST = systemd/openvpn-client@.service systemd/openvpn-server@.service diff --git a/distro/Makefile.in b/distro/Makefile.in index 3f47a83..97b95e3 100644 --- a/distro/Makefile.in +++ b/distro/Makefile.in @@ -257,6 +257,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -349,6 +351,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in SUBDIRS = rpm +EXTRA_DIST = systemd/openvpn-client@.service systemd/openvpn-server@.service all: all-recursive .SUFFIXES: @@ -361,9 +364,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu distro/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign distro/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu distro/Makefile + $(AUTOMAKE) --foreign distro/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/distro/rpm/Makefile.in b/distro/rpm/Makefile.in index d4253c6..2128529 100644 --- a/distro/rpm/Makefile.in +++ b/distro/rpm/Makefile.in @@ -200,6 +200,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -308,9 +310,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu distro/rpm/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign distro/rpm/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu distro/rpm/Makefile + $(AUTOMAKE) --foreign distro/rpm/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/distro/rpm/openvpn.spec b/distro/rpm/openvpn.spec index 45637d7..bd1225e 100644 --- a/distro/rpm/openvpn.spec +++ b/distro/rpm/openvpn.spec @@ -13,7 +13,7 @@ Summary: OpenVPN is a robust and highly flexible VPN daemon by James Yonan. Name: openvpn -Version: 2.3.5 +Version: 2.3.7 Release: 1 URL: http://openvpn.net/ Source0: http://prdownloads.sourceforge.net/openvpn/%{name}-%{version}.tar.gz diff --git a/distro/systemd/openvpn-client@.service b/distro/systemd/openvpn-client@.service new file mode 100644 index 0000000..56d93a9 --- /dev/null +++ b/distro/systemd/openvpn-client@.service @@ -0,0 +1,20 @@ +[Unit] +Description=OpenVPN tunnel for %I +After=syslog.target network-online.target +Wants=network-online.target +Documentation=man:openvpn(8) +Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage +Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO + +[Service] +PrivateTmp=true +Type=forking +PIDFile=/var/run/openvpn/client_%i.pid +ExecStart=/usr/sbin/openvpn --cd /etc/openvpn/client --config %i.conf --daemon --writepid /var/run/openvpn/client_%i.pid +CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_READ_SEARCH +LimitNPROC=10 +DeviceAllow=/dev/null rw +DeviceAllow=/dev/net/tun rw + +[Install] +WantedBy=multi-user.target diff --git a/distro/systemd/openvpn-server@.service b/distro/systemd/openvpn-server@.service new file mode 100644 index 0000000..c4c9a12 --- /dev/null +++ b/distro/systemd/openvpn-server@.service @@ -0,0 +1,19 @@ +[Unit] +Description=OpenVPN service for %I +After=syslog.target network.target +Documentation=man:openvpn(8) +Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage +Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO + +[Service] +PrivateTmp=true +Type=forking +PIDFile=/var/run/openvpn/server_%i.pid +ExecStart=/usr/sbin/openvpn --cd /etc/openvpn/server --status /var/run/openvpn/server_%i-status.log --status-version 2 --config %i.conf --daemon --writepid /var/run/openvpn/server_%i.pid +CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_READ_SEARCH +LimitNPROC=10 +DeviceAllow=/dev/null rw +DeviceAllow=/dev/net/tun rw + +[Install] +WantedBy=multi-user.target diff --git a/doc/Makefile.in b/doc/Makefile.in index ffb000f..508acc9 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -234,6 +234,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -344,9 +346,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/Makefile + $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/doc/openvpn.8 b/doc/openvpn.8 index 39b128f..9db6409 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -37,7 +37,7 @@ .TH openvpn 8 "17 November 2008" .\"********************************************************* .SH NAME -openvpn \- secure IP tunnel daemon. +openvpn - secure IP tunnel daemon. .\"********************************************************* .SH SYNOPSIS .ft 3 @@ -231,7 +231,7 @@ Note that since UDP is connectionless, connection failure is defined by the .B \-\-ping and -.B \-\-ping-restart +.B \-\-ping\-restart options. Note the following corner case: If you use multiple @@ -265,12 +265,12 @@ not match If .B host is a DNS name which resolves to multiple IP addresses, -one will be randomly -chosen, providing a sort of basic load-balancing and -failover capability. +the first address returned by the system getaddrinfo() function +will be used (no DNS randomization inside OpenVPN 2.3.x, and +it will not try multiple addresses). .\"********************************************************* .TP -.B \-\-remote-random-hostname +.B \-\-remote\-random\-hostname Prepend a random string (6 bytes, 12 hex characters) to hostname to prevent DNS caching. For example, "foo.bar.gov" would be modified to ".foo.bar.gov". @@ -289,7 +289,7 @@ and An OpenVPN client will try each connection profile sequentially until it achieves a successful connection. -.B \-\-remote-random +.B \-\-remote\-random can be used to initially "scramble" the connection list. @@ -393,14 +393,14 @@ were declared in all blocks below it. .\"********************************************************* .TP -.B \-\-proto-force p +.B \-\-proto\-force p When iterating through connection profiles, only consider profiles using protocol .B p ('tcp'|'udp'). .\"********************************************************* .TP -.B \-\-remote-random +.B \-\-remote\-random When multiple .B \-\-remote address/ports are specified, or if connection profiles are being @@ -430,19 +430,19 @@ For UDP operation, should be specified on both peers. For TCP operation, one peer must use -.B \-\-proto tcp-server +.B \-\-proto tcp\-server and the other must use -.B \-\-proto tcp-client. +.B \-\-proto tcp\-client. A peer started with .B tcp-server will wait indefinitely for an incoming connection. A peer started with -.B tcp-client +.B tcp\-client will attempt to connect, and if that fails, will sleep for 5 seconds (adjustable via the -.B \-\-connect-retry +.B \-\-connect\-retry option) and try again infinite or up to N retries (adjustable via the -.B \-\-connect-retry-max +.B \-\-connect\-retry\-max option). Both TCP client and server will simulate a SIGUSR1 restart signal if either side resets the connection. @@ -462,9 +462,9 @@ application-level UDP protocols, or tunneling protocols which don't possess a built-in reliability layer. .\"********************************************************* .TP -.B \-\-connect-retry n +.B \-\-connect\-retry n For -.B \-\-proto tcp-client, +.B \-\-proto tcp\-client, take .B n as the @@ -472,29 +472,29 @@ number of seconds to wait between connection retries (default=5). .\"********************************************************* .TP -.B \-\-connect-timeout n +.B \-\-connect\-timeout n For -.B \-\-proto tcp-client, +.B \-\-proto tcp\-client, set connection timeout to .B n seconds (default=10). .\"********************************************************* .TP -.B \-\-connect-retry-max n +.B \-\-connect\-retry\-max n For -.B \-\-proto tcp-client, +.B \-\-proto tcp\-client, take .B n as the number of retries of connection attempt (default=infinite). .\"********************************************************* .TP -.B \-\-show-proxy-settings +.B \-\-show\-proxy\-settings Show sensed HTTP or SOCKS proxy settings. Currently, only Windows clients support this option. .\"********************************************************* .TP -.B \-\-http-proxy server port [authfile|'auto'|'auto-nct'] [auth-method] +.B \-\-http\-proxy server port [authfile|'auto'|'auto\-nct'] [auth-method] Connect to remote host through an HTTP proxy at address .B server and port @@ -511,7 +511,7 @@ HTTP Digest authentication is supported as well, but only via the .B auto or -.B auto-nct +.B auto\-nct flags (below). The @@ -523,38 +523,38 @@ username/password credentials, if required. This flag exists on OpenVPN 2.1 or higher. The -.B auto-nct +.B auto\-nct flag (no clear-text auth) instructs OpenVPN to automatically determine the authentication method, but to reject weak authentication protocols such as HTTP Basic Authentication. .\"********************************************************* .TP -.B \-\-http-proxy-retry +.B \-\-http\-proxy\-retry Retry indefinitely on HTTP proxy errors. If an HTTP proxy error occurs, simulate a SIGUSR1 reset. .\"********************************************************* .TP -.B \-\-http-proxy-timeout n +.B \-\-http\-proxy\-timeout n Set proxy timeout to .B n seconds, default=5. .\"********************************************************* .TP -.B \-\-http-proxy-option type [parm] +.B \-\-http\-proxy\-option type [parm] Set extended HTTP proxy options. Repeat to set multiple options. -.B VERSION version \-\- +.B VERSION version -- Set HTTP version number to .B version (default=1.0). -.B AGENT user-agent \-\- +.B AGENT user-agent -- Set HTTP "User-Agent" string to .B user-agent. .\"********************************************************* .TP -.B \-\-socks-proxy server [port] [authfile] +.B \-\-socks\-proxy server [port] [authfile] Connect to remote host through a Socks5 proxy at address .B server and port @@ -565,12 +565,12 @@ and port "stdin" to prompt from console. .\"********************************************************* .TP -.B \-\-socks-proxy-retry +.B \-\-socks\-proxy\-retry Retry indefinitely on Socks proxy errors. If a Socks proxy error occurs, simulate a SIGUSR1 reset. .\"********************************************************* .TP -.B \-\-resolv-retry n +.B \-\-resolv\-retry n If hostname resolve fails for .B \-\-remote, retry resolve for @@ -633,7 +633,7 @@ Don't use in .B \-\-mode server mode. Use a -.B \-\-client-connect +.B \-\-client\-connect script instead. See the "Environmental Variables" section below for @@ -661,27 +661,37 @@ peer on its new IP address. .\"********************************************************* .TP .B \-\-port port -TCP/UDP port number for both local and remote. The current +TCP/UDP port number or port name for both local and remote (sets both +.B \-\-lport +and +.B \-\-rport +options to given port). The current default of 1194 represents the official IANA port number assignment for OpenVPN and has been used since version 2.0-beta17. Previous versions used port 5000 as the default. .\"********************************************************* .TP .B \-\-lport port -TCP/UDP port number for bind. +Set local TCP/UDP port number or name. Cannot be used together with +.B \-\-nobind +option. .\"********************************************************* .TP .B \-\-rport port -TCP/UDP port number for remote. +Set TCP/UDP port number or name used by the +.B \-\-remote +option. The port can also be set directly using the +.B \-\-remote +option. .\"********************************************************* .TP .B \-\-bind Bind to local address and port. This is the default unless any of -.B \-\-proto tcp-client +.B \-\-proto tcp\-client , -.B \-\-http-proxy +.B \-\-http\-proxy or -.B \-\-socks-proxy +.B \-\-socks\-proxy are used. .\"********************************************************* .TP @@ -712,7 +722,7 @@ devices encapsulate IPv4 or IPv6 (OSI Layer 3) while devices encapsulate Ethernet 802.3 (OSI Layer 2). .\"********************************************************* .TP -.B \-\-dev-type device-type +.B \-\-dev\-type device-type Which device type are we using? .B device-type should be @@ -741,7 +751,7 @@ topology. If you set this directive on the server, the .B \-\-server and -.B \-\-server-bridge +.B \-\-server\-bridge directives will automatically push your chosen topology setting to clients as well. This directive can also be manually pushed to clients. Like the .B \-\-dev @@ -750,23 +760,23 @@ directive, this directive must always be compatible between client and server. .B mode can be one of: -.B net30 \-\- +.B net30 -- Use a point-to-point topology, by allocating one /30 subnet per client. This is designed to allow point-to-point semantics when some or all of the connecting clients might be Windows systems. This is the default on OpenVPN 2.0. -.B p2p \-\- +.B p2p -- Use a point-to-point topology where the remote endpoint of the client's tun interface always points to the local endpoint of the server's tun interface. This mode allocates a single IP address per connecting client. Only use when none of the connecting clients are Windows systems. This mode is functionally equivalent to the -.B \-\-ifconfig-pool-linear +.B \-\-ifconfig\-pool\-linear directive which is available in OpenVPN 2.0 and is now deprecated. -.B subnet \-\- +.B subnet -- Use a subnet rather than a point-to-point topology by configuring the tun interface with a local IP address and subnet mask, similar to the topology used in @@ -783,9 +793,15 @@ driver supports an command which sets a subnet instead of a remote endpoint IP address. This option exists in OpenVPN 2.1 or higher. + +Note: Using +.B \-\-topology subnet +changes the interpretation of the arguments of +.B \-\-ifconfig +to mean "address netmask", no longer "local remote". .\"********************************************************* .TP -.B \-\-tun-ipv6 +.B \-\-tun\-ipv6 Build a tun link capable of forwarding IPv6 traffic. Should be used in conjunction with .B \-\-dev tun @@ -797,16 +813,16 @@ if no specific IPv6 TUN support for your OS has been compiled into OpenVPN. See below for further IPv6-related configuration options. .\"********************************************************* .TP -.B \-\-dev-node node +.B \-\-dev\-node node Explicitly set the device node rather than using /dev/net/tun, /dev/tun, /dev/tap, etc. If OpenVPN cannot figure out whether .B node is a TUN or TAP device based on the name, you should also specify -.B \-\-dev-type tun +.B \-\-dev\-type tun or -.B \-\-dev-type tap. +.B \-\-dev\-type tap. Under Mac OS X this option can be used to specify the default tun implementation. Using @@ -825,7 +841,7 @@ is named in the Network Connections Control Panel or the raw GUID of the adapter enclosed by braces. The -.B \-\-show-adapters +.B \-\-show\-adapters option under Windows can also be used to enumerate all available TAP-Win32 adapters and will show both the network @@ -846,16 +862,21 @@ May be used in order to execute OpenVPN in unprivileged environment. Set TUN/TAP adapter parameters. .B l is the IP address of the local VPN endpoint. -For TUN devices, +For TUN devices in point-to-point mode, .B rn is the IP address of the remote VPN endpoint. -For TAP devices, +For TAP devices, or TUN devices used with +.B \-\-topology subnet, .B rn -is the subnet mask of the virtual ethernet segment +is the subnet mask of the virtual network segment which is being created or connected to. For TUN devices, which facilitate virtual -point-to-point IP connections, +point-to-point IP connections (when used in +.B \-\-topology net30 +or +.B p2p +mode), the proper usage of .B \-\-ifconfig is to use two private IP addresses @@ -870,7 +891,9 @@ you will be pinging across the VPN. For TAP devices, which provide the ability to create virtual -ethernet segments, +ethernet segments, or TUN devices in +.B \-\-topology subnet +mode (which create virtual "multipoint networks"), .B \-\-ifconfig is used to set an IP address and subnet mask just as a physical @@ -904,14 +927,14 @@ getting an IP address lease from a DHCP server. .\"********************************************************* .TP -.B \-\-ifconfig-noexec +.B \-\-ifconfig\-noexec Don't actually execute ifconfig/netsh commands, instead pass .B \-\-ifconfig parameters to scripts using environmental variables. .\"********************************************************* .TP -.B \-\-ifconfig-nowarn +.B \-\-ifconfig\-nowarn Don't output an options consistency check warning if the .B \-\-ifconfig @@ -919,7 +942,7 @@ option on this side of the connection doesn't match the remote side. This is useful when you want to retain the overall benefits of the options consistency check (also see -.B \-\-disable-occ +.B \-\-disable\-occ option) while only disabling the ifconfig component of the check. @@ -927,7 +950,7 @@ For example, if you have a configuration where the local host uses .B \-\-ifconfig but the remote host does not, use -.B \-\-ifconfig-nowarn +.B \-\-ifconfig\-nowarn on the local host. This option will also silence warnings about potential @@ -949,11 +972,11 @@ while at the same time providing portable semantics across OpenVPN's platform space. .B netmask -default \-\- 255.255.255.255 +default -- 255.255.255.255 .B gateway -default \-\- taken from -.B \-\-route-gateway +default -- taken from +.B \-\-route\-gateway or the second parameter to .B \-\-ifconfig when @@ -962,7 +985,7 @@ is specified. .B metric default \-\- taken from -.B \-\-route-metric +.B \-\-route\-metric otherwise 0. The default can be specified by leaving an option blank or setting @@ -977,9 +1000,9 @@ also be specified as a DNS or /etc/hosts file resolvable name, or as one of three special keywords: .B vpn_gateway -\-\- The remote VPN endpoint address +-- The remote VPN endpoint address (derived either from -.B \-\-route-gateway +.B \-\-route\-gateway or the second parameter to .B \-\-ifconfig when @@ -987,23 +1010,23 @@ when is specified). .B net_gateway -\-\- The pre-existing IP default gateway, read from the routing +-- The pre-existing IP default gateway, read from the routing table (not supported on all OSes). .B remote_host -\-\- The +-- The .B \-\-remote address if OpenVPN is being run in client mode, and is undefined in server mode. .\"********************************************************* .TP -.B \-\-max-routes n +.B \-\-max\-routes n Allow a maximum number of n .B \-\-route options to be specified, either in the local configuration file, or pulled from an OpenVPN server. By default, n=100. .\"********************************************************* .TP -.B \-\-route-gateway gw|'dhcp' +.B \-\-route\-gateway gw|'dhcp' Specify a default gateway .B gw for use with @@ -1016,14 +1039,14 @@ the gateway address will be extracted from a DHCP negotiation with the OpenVPN server-side LAN. .\"********************************************************* .TP -.B \-\-route-metric m +.B \-\-route\-metric m Specify a default metric .B m for use with .B \-\-route. .\"********************************************************* .TP -.B \-\-route-delay [n] [w] +.B \-\-route\-delay [n] [w] Delay .B n seconds (default=0) after connection @@ -1031,7 +1054,7 @@ establishment, before adding routes. If .B n is 0, routes will be added immediately upon connection establishment. If -.B \-\-route-delay +.B \-\-route\-delay is omitted, routes will be added immediately after TUN/TAP device open and .B \-\-up @@ -1049,18 +1072,18 @@ tap adapter addresses. The delay will give the DHCP handshake time to complete before routes are added. On Windows, -.B \-\-route-delay +.B \-\-route\-delay tries to be more intelligent by waiting .B w seconds (w=30 by default) for the TAP-Win32 adapter to come up before adding routes. .\"********************************************************* .TP -.B \-\-route-up cmd +.B \-\-route\-up cmd Run command .B cmd after routes are added, subject to -.B \-\-route-delay. +.B \-\-route\-delay. .B cmd consists of a path to script (or executable program), optionally @@ -1071,7 +1094,7 @@ See the "Environmental Variables" section below for additional parameters passed as environmental variables. .\"********************************************************* .TP -.B \-\-route-pre-down cmd +.B \-\-route\-pre\-down cmd Run command .B cmd before routes are removed upon disconnection. @@ -1085,13 +1108,13 @@ See the "Environmental Variables" section below for additional parameters passed as environmental variables. .\"********************************************************* .TP -.B \-\-route-noexec +.B \-\-route\-noexec Don't add or remove routes automatically. Instead pass routes to -.B \-\-route-up +.B \-\-route\-up script using environmental variables. .\"********************************************************* .TP -.B \-\-route-nopull +.B \-\-route\-nopull When used with .B \-\-client or @@ -1105,16 +1128,16 @@ however note that this option still allows the server to set the TCP/IP properties of the client's TUN/TAP interface. .\"********************************************************* .TP -.B \-\-allow-pull-fqdn +.B \-\-allow\-pull\-fqdn Allow client to pull DNS names from server (rather than being limited to IP address) for .B \-\-ifconfig, .B \-\-route, and -.B \-\-route-gateway. +.B \-\-route\-gateway. .\"********************************************************* .TP -.B \-\-client-nat snat|dnat network netmask alias +.B \-\-client\-nat snat|dnat network netmask alias This pushable client option sets up a stateless one-to-one NAT rule on packet addresses (not ports), and is useful in cases where routes or ifconfig settings pushed to the client would @@ -1139,7 +1162,7 @@ for debugging info showing the transformation of src/dest addresses in packets. .\"********************************************************* .TP -.B \-\-redirect-gateway flags... +.B \-\-redirect\-gateway flags... Automatically execute routing commands to cause all outgoing IP traffic to be redirected over the VPN. This is a client-side option. @@ -1158,7 +1181,7 @@ Delete the default gateway route. .B (3) Set the new default gateway to be the VPN endpoint address (derived either from -.B \-\-route-gateway +.B \-\-route\-gateway or the second parameter to .B \-\-ifconfig when @@ -1170,7 +1193,7 @@ that the original default route is restored. Option flags: -.B local \-\- +.B local -- Add the .B local flag if both OpenVPN servers are directly connected via a common subnet, @@ -1180,48 +1203,48 @@ flag will cause step .B 1 above to be omitted. -.B autolocal \-\- +.B autolocal -- Try to automatically determine whether to enable .B local flag above. -.B def1 \-\- +.B def1 -- Use this flag to override the default gateway by using 0.0.0.0/1 and 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of overriding but not wiping out the original default gateway. -.B bypass-dhcp \-\- +.B bypass-dhcp -- Add a direct route to the DHCP server (if it is non-local) which bypasses the tunnel (Available on Windows clients, may not be available on non-Windows clients). -.B bypass-dns \-\- +.B bypass-dns -- Add a direct route to the DNS server(s) (if they are non-local) which bypasses the tunnel (Available on Windows clients, may not be available on non-Windows clients). -.B block-local \-\- +.B block-local -- Block access to local LAN when the tunnel is active, except for the LAN gateway itself. This is accomplished by routing the local LAN (except for the LAN gateway address) into the tunnel. .\"********************************************************* .TP -.B \-\-link-mtu n +.B \-\-link\-mtu n Sets an upper bound on the size of UDP packets which are sent between OpenVPN peers. It's best not to set this parameter unless you know what you're doing. .\"********************************************************* .\"********************************************************* .TP -.B \-\-redirect-private [flags] -Like \-\-redirect-gateway, but omit actually changing the default +.B \-\-redirect\-private [flags] +Like \-\-redirect\-gateway, but omit actually changing the default gateway. Useful when pushing private subnets. .\"********************************************************* .TP -.B \-\-tun-mtu n +.B \-\-tun\-mtu n Take the TUN device MTU to be .B n and derive the link MTU @@ -1243,11 +1266,11 @@ and/or options to deal with MTU sizing issues. .\"********************************************************* .TP -.B \-\-tun-mtu-extra n +.B \-\-tun\-mtu\-extra n Assume that the TUN/TAP device might return as many as .B n bytes more than the -.B \-\-tun-mtu +.B \-\-tun\-mtu size on read. This parameter defaults to 0, which is sufficient for most TUN devices. TAP devices may introduce additional overhead in excess of the MTU size, and a setting of 32 is the default when TAP devices are used. @@ -1255,30 +1278,30 @@ This parameter only controls internal OpenVPN buffer sizing, so there is no transmission overhead associated with using a larger value. .\"********************************************************* .TP -.B \-\-mtu-disc type +.B \-\-mtu\-disc type Should we do Path MTU discovery on TCP/UDP channel? Only supported on OSes such as Linux that supports the necessary system call to set. .B 'no' -\-\- Never send DF (Don't Fragment) frames +-- Never send DF (Don't Fragment) frames .br .B 'maybe' -\-\- Use per-route hints +-- Use per-route hints .br .B 'yes' -\-\- Always DF (Don't Fragment) +-- Always DF (Don't Fragment) .br .\"********************************************************* .TP -.B \-\-mtu-test +.B \-\-mtu\-test To empirically measure MTU on connection startup, add the -.B \-\-mtu-test +.B \-\-mtu\-test option to your configuration. OpenVPN will send ping packets of various sizes to the remote peer and measure the largest packets which were successfully received. The -.B \-\-mtu-test +.B \-\-mtu\-test process normally takes about 3 minutes to complete. .\"********************************************************* .TP @@ -1292,7 +1315,7 @@ bytes. The .B max parameter is interpreted in the same way as the -.B \-\-link-mtu +.B \-\-link\-mtu parameter, i.e. the UDP packet size after encapsulation overhead has been added in, but not including the UDP header itself. @@ -1334,7 +1357,7 @@ bytes. The default value is The .B max parameter is interpreted in the same way as the -.B \-\-link-mtu +.B \-\-link\-mtu parameter, i.e. the UDP packet size after encapsulation overhead has been added in, but not including the UDP header itself. @@ -1384,7 +1407,7 @@ Therefore, one could lower the maximum UDP packet size to 1300 (a good first try for solving MTU-related connection problems) with the following options: -.B \-\-tun-mtu 1500 \-\-fragment 1300 \-\-mssfix +.B \-\-tun\-mtu 1500 \-\-fragment 1300 \-\-mssfix .\"********************************************************* .TP .B \-\-sndbuf size @@ -1403,7 +1426,7 @@ matched in policy routing and packetfilter rules. This option is only supported in Linux and does nothing on other operating systems. .\"********************************************************* .TP -.B \-\-socket-flags flags... +.B \-\-socket\-flags flags... Apply the given flags to the OpenVPN transport socket. Currently, only .B TCP_NODELAY @@ -1429,6 +1452,7 @@ Currently defaults to 100. Limit bandwidth of outgoing tunnel data to .B n bytes per second on the TCP/UDP port. +Note that this will only work if mode is set to p2p. If you want to limit the bandwidth in both directions, use this option on both peers. @@ -1494,9 +1518,9 @@ seconds (specify on both peers to cause ping packets to be sent in both directions since OpenVPN ping packets are not echoed like IP ping packets). When used in one of OpenVPN's secure modes (where -.B \-\-secret, \-\-tls-server, +.B \-\-secret, \-\-tls\-server, or -.B \-\-tls-client +.B \-\-tls\-client is specified), the ping packet will be cryptographically secure. @@ -1509,11 +1533,11 @@ pass will not time out. (2) To provide a basis for the remote to test the existence of its peer using the -.B \-\-ping-exit +.B \-\-ping\-exit option. .\"********************************************************* .TP -.B \-\-ping-exit n +.B \-\-ping\-exit n Causes OpenVPN to exit after .B n seconds pass without reception of a ping @@ -1521,21 +1545,21 @@ or other packet from remote. This option can be combined with .B \-\-inactive, \-\-ping, and -.B \-\-ping-exit +.B \-\-ping\-exit to create a two-tiered inactivity disconnect. For example, -.B openvpn [options...] \-\-inactive 3600 \-\-ping 10 \-\-ping-exit 60 +.B openvpn [options...] \-\-inactive 3600 \-\-ping 10 \-\-ping\-exit 60 when used on both peers will cause OpenVPN to exit within 60 seconds if its peer disconnects, but will exit after one hour if no actual tunnel data is exchanged. .\"********************************************************* .TP -.B \-\-ping-restart n +.B \-\-ping\-restart n Similar to -.B \-\-ping-exit, +.B \-\-ping\-exit, but trigger a .B SIGUSR1 restart after @@ -1556,11 +1580,11 @@ If the peer cannot be reached, a restart will be triggered, causing the hostname used with .B \-\-remote to be re-resolved (if -.B \-\-resolv-retry +.B \-\-resolv\-retry is also specified). In server mode, -.B \-\-ping-restart, \-\-inactive, +.B \-\-ping\-restart, \-\-inactive, or any other type of internally generated signal will always be applied to individual client instance objects, never to whole server itself. @@ -1569,14 +1593,14 @@ which would normally cause a restart, will cause the deletion of the client instance object instead. In client mode, the -.B \-\-ping-restart +.B \-\-ping\-restart parameter is set to 120 seconds by default. This default will hold until the client pulls a replacement value from the server, based on the .B \-\-keepalive setting in the server configuration. To disable the 120 second default, set -.B \-\-ping-restart 0 +.B \-\-ping\-restart 0 on the client. See the signals section below for more information @@ -1586,15 +1610,15 @@ on Note that the behavior of .B SIGUSR1 can be modified by the -.B \-\-persist-tun, \-\-persist-key, \-\-persist-local-ip, +.B \-\-persist\-tun, \-\-persist\-key, \-\-persist\-local\-ip, and -.B \-\-persist-remote-ip +.B \-\-persist\-remote\-ip options. Also note that -.B \-\-ping-exit +.B \-\-ping\-exit and -.B \-\-ping-restart +.B \-\-ping\-restart are mutually exclusive and cannot be used together. .\"********************************************************* .TP @@ -1602,7 +1626,7 @@ are mutually exclusive and cannot be used together. A helper directive designed to simplify the expression of .B \-\-ping and -.B \-\-ping-restart +.B \-\-ping\-restart in server mode configurations. The server timeout is set twice the value of the second argument. @@ -1629,11 +1653,11 @@ expands as follows: .fi .\"********************************************************* .TP -.B \-\-ping-timer-rem +.B \-\-ping\-timer\-rem Run the -.B \-\-ping-exit +.B \-\-ping\-exit / -.B \-\-ping-restart +.B \-\-ping\-restart timer only if we have a remote address. Use this option if you are starting the daemon in listen mode (i.e. without an explicit .B \-\-remote @@ -1641,12 +1665,12 @@ peer), and you don't want to start clocking timeouts until a remote peer connects. .\"********************************************************* .TP -.B \-\-persist-tun +.B \-\-persist\-tun Don't close and reopen TUN/TAP device or run up/down scripts across .B SIGUSR1 or -.B \-\-ping-restart +.B \-\-ping\-restart restarts. .B SIGUSR1 @@ -1656,11 +1680,11 @@ but which offers finer-grained control over reset options. .\"********************************************************* .TP -.B \-\-persist-key +.B \-\-persist\-key Don't re-read key files across .B SIGUSR1 or -.B \-\-ping-restart. +.B \-\-ping\-restart. This option can be combined with .B \-\-user nobody @@ -1676,21 +1700,21 @@ This option solves the problem by persisting keys across resets, so they don't need to be re-read. .\"********************************************************* .TP -.B \-\-persist-local-ip +.B \-\-persist\-local\-ip Preserve initially resolved local IP address and port number across .B SIGUSR1 or -.B \-\-ping-restart +.B \-\-ping\-restart restarts. .\"********************************************************* .TP -.B \-\-persist-remote-ip +.B \-\-persist\-remote\-ip Preserve most recently authenticated remote IP address and port number across .B SIGUSR1 or -.B \-\-ping-restart +.B \-\-ping\-restart restarts. .\"********************************************************* .TP @@ -1768,23 +1792,29 @@ In this context, the last command line parameter passed to the script will be .I init. If the -.B \-\-up-restart +.B \-\-up\-restart option is also used, the up script will be called for restarts as well. A restart is considered to be a partial reinitialization of OpenVPN where the TUN/TAP instance is preserved (the -.B \-\-persist-tun +.B \-\-persist\-tun option will enable such preservation). A restart can be generated by a SIGUSR1 signal, a -.B \-\-ping-restart +.B \-\-ping\-restart timeout, or a connection reset when the TCP protocol is enabled with the .B \-\-proto option. If a restart occurs, and -.B \-\-up-restart +.B \-\-up\-restart has been specified, the up script will be called with .I restart as the last parameter. +NOTE: on restart, OpenVPN will not pass the full set of environment +variables to the script. Namely, everything related to routing and +gateways will not be passed, as nothing needs to be done anyway - all +the routing setup is already in place. Additionally, the up\-restart +script will run with the downgraded UID/GID settings (if configured). + The following standalone example shows how the .B \-\-up script can be called in both an initialization and restart context. @@ -1792,7 +1822,7 @@ script can be called in both an initialization and restart context. 9999 is blocked by your firewall. Also, the example will run indefinitely, so you should abort with control-c). -.B openvpn \-\-dev tun \-\-port 9999 \-\-verb 4 \-\-ping-restart 10 \-\-up 'echo up' \-\-down 'echo down' \-\-persist-tun \-\-up-restart +.B openvpn \-\-dev tun \-\-port 9999 \-\-verb 4 \-\-ping\-restart 10 \-\-up 'echo up' \-\-down 'echo down' \-\-persist\-tun \-\-up\-restart Note that OpenVPN also provides the .B \-\-ifconfig @@ -1811,10 +1841,10 @@ and remote endpoints on the command line to the .B \-\-up script so that they can be used to configure routes such as: -.B route add -net 10.0.0.0 netmask 255.255.255.0 gw $5 +.B route add \-net 10.0.0.0 netmask 255.255.255.0 gw $5 .\"********************************************************* .TP -.B \-\-up-delay +.B \-\-up\-delay Delay TUN/TAP open and possible .B \-\-up script execution @@ -1860,13 +1890,13 @@ your script will also run at reduced privilege. .\"********************************************************* .TP -.B \-\-down-pre +.B \-\-down\-pre Call .B \-\-down cmd/script before, rather than after, TUN/TAP close. .\"********************************************************* .TP -.B \-\-up-restart +.B \-\-up\-restart Enable the .B \-\-up and @@ -1905,10 +1935,10 @@ Versions prior to OpenVPN 2.3.3 will always ignore options set with the directive. See also -.B \-\-ignore-unknown-option +.B \-\-ignore\-unknown\-option .\"********************************************************* .TP -.B \-\-setenv-safe name value +.B \-\-setenv\-safe name value Set a custom environmental variable .B OPENVPN_name=value to pass to script. @@ -1919,13 +1949,13 @@ is a safety precaution to prevent a LD_PRELOAD style attack from a malicious or compromised server. .\"********************************************************* .TP -.B \-\-ignore-unknown-option opt1 opt2 opt3 ... optN +.B \-\-ignore\-unknown\-option opt1 opt2 opt3 ... optN When one of options .B opt1 ... optN is encountered in the configuration file the configuration file parsing does not fail if this OpenVPN version does not support the option. Multiple -.B \-\-ignore-unknown-option +.B \-\-ignore\-unknown\-option options can be given to support a larger number of options to ignore. This option should be used with caution, as there are good security @@ -1934,27 +1964,27 @@ config file. Having said that, there are valid reasons for wanting new software features to gracefully degrade when encountered by older software versions. -.B \-\-ignore-unknown-option +.B \-\-ignore\-unknown\-option is available since OpenVPN 2.3.3. .\"********************************************************* .TP -.B \-\-script-security level +.B \-\-script\-security level This directive offers policy-level control over OpenVPN's usage of external programs and scripts. Lower .B level values are more restrictive, higher values are more permissive. Settings for .B level: -.B 0 \-\- +.B 0 -- Strictly no calling of external programs. .br -.B 1 \-\- +.B 1 -- (Default) Only call built-in executables such as ifconfig, ip, route, or netsh. .br -.B 2 \-\- +.B 2 -- Allow calling of built-in executables and user-defined scripts. .br -.B 3 \-\- +.B 3 -- Allow passwords to be passed to scripts via environmental variables (potentially unsafe). OpenVPN releases before v2.3 also supported a @@ -1967,6 +1997,11 @@ or As of OpenVPN v2.3, this flag is no longer accepted. In most *nix environments the execve() approach has been used without any issues. +Some directives such as \-\-up allow options to be passed to the external +script. In these cases make sure the script name does not contain any spaces or +the configuration parser will choke because it can't determine where the script +name ends and script options start. + To run scripts in Windows in earlier OpenVPN versions you needed to either add a full path to the script interpreter which can parse the script or use the @@ -1993,7 +2028,7 @@ flag was removed is due to the security implications with shell expansions when executing scripts via the system() call. .\"********************************************************* .TP -.B \-\-disable-occ +.B \-\-disable\-occ Don't output a warning message if option inconsistencies are detected between peers. An example of an option inconsistency would be where one peer uses .B \-\-dev tun @@ -2121,9 +2156,9 @@ allow many things required only during initialization. Like with chroot, complications can result when scripts or restarts are executed after the setcon operation, which is why you should really consider using the -.B \-\-persist-key +.B \-\-persist\-key and -.B \-\-persist-tun +.B \-\-persist\-tun options. .\"********************************************************* .TP @@ -2173,7 +2208,7 @@ directive above for description of .B progname parameter. .TP -.B \-\-errors-to-stderr +.B \-\-errors\-to\-stderr Output errors to stderr instead of stdout unless log output is redirected by one of the .B \-\-log options. @@ -2194,7 +2229,7 @@ option must match what is specified in the inetd/xinetd config file. The .B nowait mode can only be used with -.B \-\-proto tcp-server. +.B \-\-proto tcp\-server. The default is .B wait. The @@ -2243,14 +2278,14 @@ is also specified. This option is persistent over the entire course of an OpenVPN instantiation and will not be reset by SIGHUP, SIGUSR1, or -.B \-\-ping-restart. +.B \-\-ping\-restart. Note that on Windows, when OpenVPN is started as a service, logging occurs by default without the need to specify this option. .\"********************************************************* .TP -.B \-\-log-append file +.B \-\-log\-append file Append logging messages to .B file. If @@ -2262,7 +2297,7 @@ except that it appends to rather than truncating the log file. .\"********************************************************* .TP -.B \-\-suppress-timestamps +.B \-\-suppress\-timestamps Avoid writing timestamps to log messages, even when they otherwise would be prepended. In particular, this applies to log messages sent to stdout. @@ -2282,14 +2317,14 @@ greater than 0 is lower priority, less than zero is higher priority). .\"********************************************************* .\".TP -.\".B \-\-nice-work n +.\".B \-\-nice\-work n .\"Change priority of background TLS work thread. The TLS thread .\"feature is enabled when OpenVPN is built .\"with pthread support, and you are running OpenVPN .\"in TLS mode (i.e. with -.\".B \-\-tls-client +.\".B \-\-tls\-client .\"or -.\".B \-\-tls-server +.\".B \-\-tls\-server .\"specified). .\" .\"Using a TLS thread offloads the CPU-intensive process of SSL/TLS-based @@ -2304,7 +2339,7 @@ less than zero is higher priority). .\"than the main thread. .\"********************************************************* .TP -.B \-\-fast-io +.B \-\-fast\-io (Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding a call to poll/epoll/select prior to the write operation. The purpose of such a call would normally be to block until the device @@ -2350,7 +2385,7 @@ Designed to be used to send messages to a controlling application which is receiving the OpenVPN log output. .\"********************************************************* .TP -.B \-\-remap-usr1 signal +.B \-\-remap\-usr1 signal Control whether internally or externally generated SIGUSR1 signals are remapped to SIGHUP (restart without persisting state) or @@ -2368,13 +2403,13 @@ Set output verbosity to Level 3 is recommended if you want a good summary of what's happening without being swamped by output. -.B 0 \-\- +.B 0 -- No output except fatal errors. .br -.B 1 to 4 \-\- +.B 1 to 4 -- Normal usage range. .br -.B 5 \-\- +.B 5 -- Output .B R and @@ -2382,7 +2417,7 @@ and characters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets. .br -.B 6 to 11 \-\- +.B 6 to 11 -- Debug info range (see errlevel.h for additional information on debug levels). .\"********************************************************* @@ -2399,7 +2434,7 @@ Status can also be written to the syslog by sending a signal. .\"********************************************************* .TP -.B \-\-status-version [n] +.B \-\-status\-version [n] Choose the status file format version number. Currently .B n can be 1, 2, or 3 and defaults to 1. @@ -2412,8 +2447,8 @@ consecutive messages in the same category. This is useful to limit repetitive logging of similar message types. .\"********************************************************* .TP -.B \-\-comp-lzo [mode] -Use fast LZO compression \-\- may add up to 1 byte per +.B \-\-comp\-lzo [mode] +Use fast LZO compression -- may add up to 1 byte per packet for incompressible data. .B mode may be "yes", "no", or "adaptive" (default). @@ -2423,16 +2458,16 @@ compression on or off for individual clients. First, make sure the client-side config file enables selective compression by having at least one -.B \-\-comp-lzo +.B \-\-comp\-lzo directive, such as -.B \-\-comp-lzo no. +.B \-\-comp\-lzo no. This will turn off compression by default, but allow a future directive push from the server to dynamically change the on/off/adaptive setting. Next in a -.B \-\-client-config-dir +.B \-\-client\-config\-dir file, specify the compression setting for the client, for example: @@ -2440,7 +2475,7 @@ for example: .ft 3 .in +4 comp-lzo yes -push "comp-lzo yes" +push "comp\-lzo yes" .in -4 .ft .fi @@ -2451,12 +2486,12 @@ setting for the server side of the link, the second sets the client side. .\"********************************************************* .TP -.B \-\-comp-noadapt +.B \-\-comp\-noadapt When used in conjunction with -.B \-\-comp-lzo, +.B \-\-comp\-lzo, this option will disable OpenVPN's adaptive compression algorithm. Normally, adaptive compression is enabled with -.B \-\-comp-lzo. +.B \-\-comp\-lzo. Adaptive compression tries to optimize the case where you have compression enabled, but you are sending predominantly incompressible @@ -2487,9 +2522,9 @@ and set .B port to 'unix'. While the default behavior is to create a unix domain socket that may be connected to by any process, the -.B \-\-management-client-user +.B \-\-management\-client\-user and -.B \-\-management-client-group +.B \-\-management\-client\-group directives can be used to restrict access. The management interface provides a special mode where the TCP @@ -2517,7 +2552,7 @@ be set to 127.0.0.1 (localhost) to restrict accessibility of the management server to local clients. .TP -.B \-\-management-client +.B \-\-management\-client Management interface will connect as a TCP/unix domain client to .B IP:port specified by @@ -2528,41 +2563,41 @@ If the client connection fails to connect or is disconnected, a SIGTERM signal will be generated causing OpenVPN to quit. .\"********************************************************* .TP -.B \-\-management-query-passwords +.B \-\-management\-query\-passwords Query management channel for private key password and -.B \-\-auth-user-pass +.B \-\-auth\-user\-pass username/password. Only query the management channel for inputs which ordinarily would have been queried from the console. .\"********************************************************* .TP -.B \-\-management-query-proxy +.B \-\-management\-query\-proxy Query management channel for proxy server information for a specific .B \-\-remote (client-only). .\"********************************************************* .TP -.B \-\-management-query-remote +.B \-\-management\-query\-remote Allow management interface to override .B \-\-remote directives (client-only). .\"********************************************************* -.B \-\-management-external-key +.B \-\-management\-external\-key Allows usage for external private key file instead of .B \-\-key option (client-only). .\"********************************************************* .TP -.B \-\-management-forget-disconnect +.B \-\-management\-forget\-disconnect Make OpenVPN forget passwords when management session disconnects. This directive does not affect the -.B \-\-http-proxy +.B \-\-http\-proxy username/password. It is always cached. .\"********************************************************* .TP -.B \-\-management-hold +.B \-\-management\-hold Start OpenVPN in a hibernating state, until a client of the management interface explicitly starts it with the @@ -2570,45 +2605,45 @@ with the command. .\"********************************************************* .TP -.B \-\-management-signal +.B \-\-management\-signal Send SIGUSR1 signal to OpenVPN if management session disconnects. This is useful when you wish to disconnect an OpenVPN session on -user logoff. For --management-client this option is not needed since +user logoff. For \-\-management\-client this option is not needed since a disconnect will always generate a SIGTERM. .\"********************************************************* .TP -.B \-\-management-log-cache n +.B \-\-management\-log\-cache n Cache the most recent .B n lines of log file history for usage by the management channel. .\"********************************************************* .TP -.B \-\-management-up-down +.B \-\-management\-up\-down Report tunnel up/down events to management interface. .B .\"********************************************************* .TP -.B \-\-management-client-auth +.B \-\-management\-client\-auth Gives management interface client the responsibility to authenticate clients after their client certificate has been verified. See management-notes.txt in OpenVPN distribution for detailed notes. .\"********************************************************* .TP -.B \-\-management-client-pf +.B \-\-management\-client\-pf Management interface clients must specify a packet filter file for each connecting client. See management-notes.txt in OpenVPN distribution for detailed notes. .\"********************************************************* .TP -.B \-\-management-client-user u +.B \-\-management\-client\-user u When the management interface is listening on a unix domain socket, only allow connections from user .B u. .\"********************************************************* .TP -.B \-\-management-client-group g +.B \-\-management\-client\-group g When the management interface is listening on a unix domain socket, only allow connections from group .B g. @@ -2705,13 +2740,13 @@ expands as follows: Don't use .B \-\-server if you are ethernet bridging. Use -.B \-\-server-bridge +.B \-\-server\-bridge instead. .\"********************************************************* .TP -.B \-\-server-bridge gateway netmask pool-start-IP pool-end-IP +.B \-\-server\-bridge gateway netmask pool-start-IP pool-end-IP .TP -.B \-\-server-bridge ['nogw'] +.B \-\-server\-bridge ['nogw'] A helper directive similar to .B \-\-server @@ -2719,7 +2754,7 @@ which is designed to simplify the configuration of OpenVPN's server mode in ethernet bridging configurations. If -.B \-\-server-bridge +.B \-\-server\-bridge is used without any parameters, it will enable a DHCP-proxy mode, where connecting OpenVPN clients will receive an IP address for their TAP adapter from the DHCP server running @@ -2747,7 +2782,7 @@ IP/netmask on the bridge interface. The and .B netmask parameters to -.B \-\-server-bridge +.B \-\-server\-bridge can be set to either the IP/netmask of the bridge interface, or the IP/netmask of the default gateway/router on the bridged @@ -2779,7 +2814,7 @@ push "route-gateway 10.8.0.4" .fi In another example, -.B \-\-server-bridge +.B \-\-server\-bridge (without parameters) expands as follows: .nf @@ -2794,7 +2829,7 @@ push "route-gateway dhcp" .fi Or -.B \-\-server-bridge nogw +.B \-\-server\-bridge nogw expands as follows: .nf @@ -2824,26 +2859,26 @@ cannot be pushed because the client needs to know them before the connection to the server can be initiated. This is a partial list of options which can currently be pushed: -.B \-\-route, \-\-route-gateway, \-\-route-delay, \-\-redirect-gateway, -.B \-\-ip-win32, \-\-dhcp-option, -.B \-\-inactive, \-\-ping, \-\-ping-exit, \-\-ping-restart, +.B \-\-route, \-\-route\-gateway, \-\-route\-delay, \-\-redirect\-gateway, +.B \-\-ip\-win32, \-\-dhcp\-option, +.B \-\-inactive, \-\-ping, \-\-ping\-exit, \-\-ping\-restart, .B \-\-setenv, -.B \-\-persist-key, \-\-persist-tun, \-\-echo, -.B \-\-comp-lzo, -.B \-\-socket-flags, +.B \-\-persist\-key, \-\-persist\-tun, \-\-echo, +.B \-\-comp\-lzo, +.B \-\-socket\-flags, .B \-\-sndbuf, \-\-rcvbuf .\"********************************************************* .TP -.B \-\-push-reset +.B \-\-push\-reset Don't inherit the global push list for a specific client instance. Specify this option in a client-specific context such as with a -.B \-\-client-config-dir +.B \-\-client\-config\-dir configuration file. This option will ignore .B \-\-push options at the global config file level. .TP -.B \-\-push-peer-info +.B \-\-push\-peer\-info Push additional information about the client to server. The additional information consists of the following data: @@ -2863,19 +2898,19 @@ Disable a particular client (based on the common name) from connecting. Don't use this option to disable a client due to key or password compromise. Use a CRL (certificate revocation list) instead (see the -.B \-\-crl-verify +.B \-\-crl\-verify option). This option must be associated with a specific client instance, which means that it must be specified either in a client instance config file using -.B \-\-client-config-dir +.B \-\-client\-config\-dir or dynamically generated using a -.B \-\-client-connect +.B \-\-client\-connect script. .\"********************************************************* .TP -.B \-\-ifconfig-pool start-IP end-IP [netmask] +.B \-\-ifconfig\-pool start-IP end-IP [netmask] Set aside a pool of subnets to be dynamically allocated to connecting clients, similar to a DHCP server. For tun-style @@ -2888,7 +2923,7 @@ parameter will also be pushed to clients. .\"********************************************************* .TP -.B \-\-ifconfig-pool-persist file [seconds] +.B \-\-ifconfig\-pool\-persist file [seconds] Persist/unpersist ifconfig-pool data to .B file, @@ -2903,7 +2938,7 @@ IP address assigned to them from the ifconfig-pool. Maintaining a long-term association is good for clients because it allows them to effectively use the -.B \-\-persist-tun +.B \-\-persist\-tun option. .B file @@ -2924,12 +2959,12 @@ suggestions only, based on past associations between a common name and IP address. They do not guarantee that the given common name will always receive the given IP address. If you want guaranteed assignment, use -.B \-\-ifconfig-push +.B \-\-ifconfig\-push .\"********************************************************* .TP -.B \-\-ifconfig-pool-linear +.B \-\-ifconfig\-pool\-linear Modifies the -.B \-\-ifconfig-pool +.B \-\-ifconfig\-pool directive to allocate individual TUN interface addresses for clients rather than /30 subnets. NOTE: This option @@ -2940,9 +2975,9 @@ This option is deprecated, and should be replaced with which is functionally equivalent. .\"********************************************************* .TP -.B \-\-ifconfig-push local remote-netmask [alias] +.B \-\-ifconfig\-push local remote-netmask [alias] Push virtual IP endpoints for client tunnel, -overriding the \-\-ifconfig-pool dynamic allocation. +overriding the \-\-ifconfig\-pool dynamic allocation. The parameters .B local @@ -2954,7 +2989,7 @@ directive which you want to execute on the client machine to configure the remote end of the tunnel. Note that the parameters .B local and -.B remote-netmask +.B remote\-netmask are from the perspective of the client, not the server. They may be DNS names rather than IP addresses, in which case they will be resolved on the server at the time of client connection. @@ -2971,9 +3006,9 @@ will refer to the client view. This option must be associated with a specific client instance, which means that it must be specified either in a client instance config file using -.B \-\-client-config-dir +.B \-\-client\-config\-dir or dynamically generated using a -.B \-\-client-connect +.B \-\-client\-connect script. Remember also to include a @@ -2987,18 +3022,18 @@ OpenVPN's internal client IP address selection algorithm works as follows: .B 1 -\-\- Use -.B \-\-client-connect script +-- Use +.B \-\-client\-connect script generated file for static IP (first choice). .br .B 2 -\-\- Use -.B \-\-client-config-dir +-- Use +.B \-\-client\-config\-dir file for static IP (next choice). .br .B 3 -\-\- Use -.B \-\-ifconfig-pool +-- Use +.B \-\-ifconfig\-pool allocation for dynamic IP (last choice). .br .\"********************************************************* @@ -3025,9 +3060,9 @@ directive routes to the specific client. This option must be specified either in a client instance config file using -.B \-\-client-config-dir +.B \-\-client\-config\-dir or dynamically generated using a -.B \-\-client-connect +.B \-\-client\-connect script. The @@ -3043,7 +3078,7 @@ subnet, you can use .B \-\-push "route ..." together with -.B \-\-client-to-client +.B \-\-client\-to\-client to effect this. In order for all clients to see A's subnet, OpenVPN must push this route to all clients EXCEPT for A, since the subnet is already owned by A. @@ -3052,11 +3087,11 @@ not pushing a route to a client if it matches one of the client's iroutes. .\"********************************************************* .TP -.B \-\-client-to-client +.B \-\-client\-to\-client Because the OpenVPN server mode handles multiple clients through a single tun or tap interface, it is effectively a router. The -.B \-\-client-to-client +.B \-\-client\-to\-client flag tells OpenVPN to internally route client-to-client traffic rather than pushing all client-originating traffic to the TUN/TAP interface. @@ -3068,13 +3103,13 @@ if you want to firewall tunnel traffic using custom, per-client rules. .\"********************************************************* .TP -.B \-\-duplicate-cn +.B \-\-duplicate\-cn Allow multiple clients with the same common name to concurrently connect. In the absence of this option, OpenVPN will disconnect a client instance upon connection of a new client having the same common name. .\"********************************************************* .TP -.B \-\-client-connect cmd +.B \-\-client\-connect cmd Run .B command cmd on client connection. @@ -3099,7 +3134,7 @@ to be applied on the server when the client connects, it should write it to the file named by the last argument. See the -.B \-\-client-config-dir +.B \-\-client\-config\-dir option below for options which can be legally used in a dynamically generated config file. @@ -3111,18 +3146,18 @@ returns a non-zero error status, it will cause the client to be disconnected. .\"********************************************************* .TP -.B \-\-client-disconnect cmd +.B \-\-client\-disconnect cmd Like -.B \-\-client-connect +.B \-\-client\-connect but called on client instance shutdown. Will not be called unless the -.B \-\-client-connect +.B \-\-client\-connect script and plugins (if defined) were previously called on this instance with successful (0) status returns. The exception to this rule is if the -.B \-\-client-disconnect +.B \-\-client\-disconnect command or plugins are cascaded, and at least one client-connect function succeeded, then ALL of the client-disconnect functions for scripts and plugins will be called on client instance object deletion, @@ -3130,16 +3165,16 @@ even in cases where some of the related client-connect functions returned an error status. The -.B \-\-client-disconnect +.B \-\-client\-disconnect command is passed the same pathname as the corresponding -.B \-\-client-connect +.B \-\-client\-connect command as its last argument. (after any arguments specified in .B cmd ). .B .\"********************************************************* .TP -.B \-\-client-config-dir dir +.B \-\-client\-config\-dir dir Specify a directory .B dir for custom client config files. After @@ -3155,7 +3190,7 @@ after it has dropped it's root privileges. This file can specify a fixed IP address for a given client using -.B \-\-ifconfig-push, +.B \-\-ifconfig\-push, as well as fixed subnets owned by the client using .B \-\-iroute. @@ -3166,19 +3201,19 @@ without needing to restart the server. The following options are legal in a client-specific context: -.B \-\-push, \-\-push-reset, \-\-iroute, \-\-ifconfig-push, +.B \-\-push, \-\-push\-reset, \-\-iroute, \-\-ifconfig\-push, and .B \-\-config. .\"********************************************************* .TP -.B \-\-ccd-exclusive +.B \-\-ccd\-exclusive Require, as a condition of authentication, that a connecting client has a -.B \-\-client-config-dir +.B \-\-client\-config\-dir file. .\"********************************************************* .TP -.B \-\-tmp-dir dir +.B \-\-tmp\-dir dir Specify a directory .B dir for temporary files. This directory will be used by @@ -3190,7 +3225,7 @@ after it has dropped it's root privileges. This directory will be used by in the following cases: * -.B \-\-client-connect +.B \-\-client\-connect scripts to dynamically generate client-specific configuration files. @@ -3204,7 +3239,7 @@ when using deferred auth method plugin hook to pass filtering rules via pf_file .\"********************************************************* .TP -.B \-\-hash-size r v +.B \-\-hash\-size r v Set the size of the real address hash table to .B r and the virtual address table to @@ -3212,13 +3247,13 @@ and the virtual address table to By default, both tables are sized at 256 buckets. .\"********************************************************* .TP -.B \-\-bcast-buffers n +.B \-\-bcast\-buffers n Allocate .B n buffers for broadcast datagrams (default=256). .\"********************************************************* .TP -.B \-\-tcp-queue-limit n +.B \-\-tcp\-queue\-limit n Maximum number of output packets queued before TCP (default=64). When OpenVPN is tunneling data from a TUN/TAP device to a @@ -3230,7 +3265,7 @@ OpenVPN will start to drop outgoing packets directed at this client. .\"********************************************************* .TP -.B \-\-tcp-nodelay +.B \-\-tcp\-nodelay This macro sets the TCP_NODELAY socket flag on the server as well as pushes it to connecting clients. The TCP_NODELAY flag disables the Nagle algorithm on TCP sockets causing @@ -3253,13 +3288,13 @@ The macro expands as follows: .fi .\"********************************************************* .TP -.B \-\-max-clients n +.B \-\-max\-clients n Limit server to a maximum of .B n concurrent clients. .\"********************************************************* .TP -.B \-\-max-routes-per-client n +.B \-\-max\-routes\-per\-client n Allow a maximum of .B n internal routes per client (default=256). @@ -3269,9 +3304,9 @@ server with packets appearing to come from many unique MAC addresses, forcing the server to deplete virtual memory as its internal routing table expands. This directive can be used in a -.B \-\-client-config-dir +.B \-\-client\-config\-dir file or auto-generated by a -.B \-\-client-connect +.B \-\-client\-connect script to override the global value for a particular client. Note that this @@ -3279,7 +3314,7 @@ directive affects OpenVPN's internal routing table, not the kernel routing table. .\"********************************************************* .TP -.B \-\-stale-routes-check n [t] +.B \-\-stale\-routes\-check n [t] Remove routes haven't had activity for .B n seconds (i.e. the ageing time). @@ -3295,10 +3330,10 @@ is not present it defaults to This option helps to keep the dynamic routing table small. See also -.B \-\-max-routes-per-client +.B \-\-max\-routes\-per\-client .\"********************************************************* .TP -.B \-\-connect-freq n sec +.B \-\-connect\-freq n sec Allow a maximum of .B n new connections per @@ -3314,10 +3349,10 @@ For the best protection against DoS attacks in server mode, use .B \-\-proto udp and -.B \-\-tls-auth. +.B \-\-tls\-auth. .\"********************************************************* .TP -.B \-\-learn-address cmd +.B \-\-learn\-address cmd Run command .B cmd to validate client virtual addresses or routes. @@ -3331,19 +3366,19 @@ Three arguments will be appended to any arguments in .B cmd as follows: -.B [1] operation \-\- +.B [1] operation -- "add", "update", or "delete" based on whether or not the address is being added to, modified, or deleted from OpenVPN's internal routing table. .br -.B [2] address \-\- +.B [2] address -- The address being learned or unlearned. This can be an IPv4 address such as "198.162.10.14", an IPv4 subnet such as "198.162.10.0/24", or an ethernet MAC address (when .B \-\-dev tap is being used) such as "00:FF:01:02:03:04". .br -.B [3] common name \-\- +.B [3] common name -- The common name on the certificate associated with the client linked to this address. Only present for "add" or "update" operations, not "delete". @@ -3363,7 +3398,7 @@ policies with regard to the client's high-level common name, rather than the low level client virtual addresses. .\"********************************************************* .TP -.B \-\-auth-user-pass-verify cmd method +.B \-\-auth\-user\-pass\-verify cmd method Require the client to provide a username/password (possibly in addition to a client certificate) for authentication. @@ -3399,10 +3434,10 @@ will be passed as an argument to and the file will be automatically deleted by OpenVPN after the script returns. The location of the temporary file is controlled by the -.B \-\-tmp-dir +.B \-\-tmp\-dir option, and will default to the current directory if unspecified. For security, consider setting -.B \-\-tmp-dir +.B \-\-tmp\-dir to a volatile storage medium such as .B /dev/shm (if available) to prevent the username/password file from touching the hard drive. @@ -3434,7 +3469,7 @@ For a sample script that performs PAM authentication, see in the OpenVPN source distribution. .\"********************************************************* .TP -.B \-\-opt-verify +.B \-\-opt\-verify Clients that connect with options that are incompatible with those of the server will be disconnected. @@ -3444,16 +3479,16 @@ comp-lzo, fragment, keydir, cipher, auth, keysize, secret, no-replay, no-iv, tls-auth, key-method, tls-server, and tls-client. This option requires that -.B \-\-disable-occ +.B \-\-disable\-occ NOT be used. .\"********************************************************* .TP -.B \-\-auth-user-pass-optional +.B \-\-auth\-user\-pass\-optional Allow connections by clients that do not specify a username/password. Normally, when -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify or -.B \-\-management-client-auth +.B \-\-management\-client\-auth is specified (or an authentication plugin module), the OpenVPN server daemon will require connecting clients to specify a username and password. This option makes the submission of a username/password @@ -3466,29 +3501,29 @@ to empty strings (""). The authentication module/script MUST have logic to detect this condition and respond accordingly. .\"********************************************************* .TP -.B \-\-client-cert-not-required +.B \-\-client\-cert\-not\-required Don't require client certificate, client will authenticate using username/password only. Be aware that using this directive is less secure than requiring certificates from all clients. If you use this directive, the entire responsibility of authentication will rest on your -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script, so keep in mind that bugs in your script could potentially compromise the security of your VPN. If you don't use this directive, but you also specify an -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script, then OpenVPN will perform double authentication. The client certificate verification AND the -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script will need to succeed in order for a client to be authenticated and accepted onto the VPN. .\"********************************************************* .TP -.B \-\-username-as-common-name +.B \-\-username\-as\-common\-name For -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify authentication, use the authenticated username as the common name, rather than the common name from the client cert. @@ -3540,9 +3575,9 @@ carriage-return. no-remapping is only available on the server side. This option is immediately deprecated. It is only implemented to make the transition to the new formatting less intrusive. It will be removed either in OpenVPN v2.4 or v2.5. So please make sure you use the -.B \-\-verify-x509-name +.B \-\-verify\-x509\-name option instead of -.B \-\-tls-remote +.B \-\-tls\-remote as soon as possible and update your scripts where necessary. .\"********************************************************* .TP @@ -3563,7 +3598,7 @@ described with the option as soon as possible. .\"********************************************************* .TP -.B \-\-port-share host port [dir] +.B \-\-port\-share host port [dir] When run in TCP server mode, share the OpenVPN port with another application, such as an HTTPS server. If OpenVPN senses a connection to its port which is using a non-OpenVPN @@ -3588,7 +3623,7 @@ Not implemented on Windows. .SS Client Mode Use client mode when connecting to an OpenVPN server which has -.B \-\-server, \-\-server-bridge, +.B \-\-server, \-\-server\-bridge, or .B \-\-mode server in it's configuration. @@ -3629,12 +3664,12 @@ in situations where you don't trust the server to have control over the client's routing table. .\"********************************************************* .TP -.B \-\-auth-user-pass [up] +.B \-\-auth\-user\-pass [up] Authenticate with server using username/password. .B up is a file containing username/password on 2 lines (Note: OpenVPN will only read passwords from a file if it has been built -with the \-\-enable-password-save configure option, or on Windows +with the \-\-enable\-password\-save configure option, or on Windows by defining ENABLE_PASSWORD_SAVE in win/settings.in). If @@ -3643,12 +3678,12 @@ is omitted, username/password will be prompted from the console. The server configuration must specify an -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script to verify the username/password provided by the client. .\"********************************************************* .TP -.B \-\-auth-retry type +.B \-\-auth\-retry type Controls how OpenVPN responds to username/password verification errors such as the client-side response to an AUTH_FAILED message from the server or verification failure of the private key password. @@ -3659,26 +3694,26 @@ of error. An AUTH_FAILED message is generated by the server if the client fails -.B \-\-auth-user-pass +.B \-\-auth\-user\-pass authentication, or if the server-side -.B \-\-client-connect +.B \-\-client\-connect script returns an error status when the client tries to connect. .B type can be one of: -.B none \-\- +.B none -- Client will exit with a fatal error (this is the default). .br -.B nointeract \-\- +.B nointeract -- Client will retry the connection without requerying for an -.B \-\-auth-user-pass +.B \-\-auth\-user\-pass username/password. Use this option for unattended clients. .br -.B interact \-\- +.B interact -- Client will requery for an -.B \-\-auth-user-pass +.B \-\-auth\-user\-pass username/password and/or private key password before attempting a reconnection. Note that while this option cannot be pushed, it can be controlled @@ -3700,14 +3735,18 @@ See management\-notes.txt in the OpenVPN distribution for a description of the OpenVPN challenge/response protocol. .\"********************************************************* .TP -.B \-\-server-poll-timeout n +.B \-\-server\-poll\-timeout n when polling possible remote servers to connect to in a round-robin fashion, spend no more than .B n seconds waiting for a response before trying the next server. +As this only makes sense in client-to-server setups, it cannot +be used in point-to-point setups using +.B \-\-secret +symmetrical key mode. .\"********************************************************* .TP -.B \-\-explicit-exit-notify [n] +.B \-\-explicit\-exit\-notify [n] In UDP client mode or point-to-point mode, send server/peer an exit notification if tunnel is restarted or OpenVPN process is exited. In client mode, on exit/restart, this @@ -3789,9 +3828,9 @@ would see nothing but random-looking data. .\"********************************************************* .TP -.B \-\-key-direction +.B \-\-key\-direction Alternative way of specifying the optional direction parameter for the -.B \-\-tls-auth +.B \-\-tls\-auth and .B \-\-secret options. Useful when using inline files (See section on inline files). @@ -3826,7 +3865,7 @@ For more information on HMAC see .\"********************************************************* .TP .B \-\-cipher alg -Encrypt packets with cipher algorithm +Encrypt data channel packets with cipher algorithm .B alg. The default is .B BF-CBC, @@ -3840,7 +3879,7 @@ For more information on blowfish, see To see other ciphers that are available with OpenVPN, use the -.B \-\-show-ciphers +.B \-\-show\-ciphers option. OpenVPN supports the CBC, CFB, and OFB cipher modes, @@ -3855,7 +3894,7 @@ to disable encryption. .B \-\-keysize n Size of cipher key in bits (optional). If unspecified, defaults to cipher-specific default. The -.B \-\-show-ciphers +.B \-\-show\-ciphers option (see below) shows all available OpenSSL ciphers, their default key sizes, and whether the key size can be changed. Use care in changing a cipher's default @@ -3887,12 +3926,12 @@ If .B engine-name is specified, use a specific crypto engine. Use the -.B \-\-show-engines +.B \-\-show\-engines standalone option to list the crypto engines which are supported by OpenSSL. .\"********************************************************* .TP -.B \-\-no-replay +.B \-\-no\-replay (Advanced) Disable OpenVPN's protection against replay attacks. Don't use this option unless you are prepared to make a tradeoff of greater efficiency in exchange for less @@ -3936,7 +3975,7 @@ algorithm used by IPSec. .\"********************************************************* .TP -.B \-\-replay-window n [t] +.B \-\-replay\-window n [t] Use a replay protection sliding-window of size .B n and a time window of @@ -3965,7 +4004,7 @@ the TCP/IP protocol stack, provided they satisfy several constraints. .B (a) The packet cannot be a replay (unless -.B \-\-no-replay +.B \-\-no\-replay is specified, which disables replay protection altogether). .B (b) @@ -4023,7 +4062,7 @@ parameters of what is to be expected from the physical IP layer. The problem is easily fixed by simply using TCP as the VPN transport layer. .\"********************************************************* .TP -.B \-\-mute-replay-warnings +.B \-\-mute\-replay\-warnings Silence the output of replay warnings, which are a common false alarm on WiFi networks. This option preserves the security of the replay protection code without @@ -4031,7 +4070,7 @@ the verbosity associated with warnings about duplicate packets. .\"********************************************************* .TP -.B \-\-replay-persist file +.B \-\-replay\-persist file Persist replay-protection state across sessions using .B file to save and reload the state. @@ -4052,10 +4091,10 @@ This option only makes sense when replay protection is enabled (the default) and you are using either .B \-\-secret (shared-secret key mode) or TLS mode with -.B \-\-tls-auth. +.B \-\-tls\-auth. .\"********************************************************* .TP -.B \-\-no-iv +.B \-\-no\-iv (Advanced) Disable OpenVPN's use of IV (cipher initialization vector). Don't use this option unless you are prepared to make a tradeoff of greater efficiency in exchange for less @@ -4076,7 +4115,7 @@ space-saving optimization that uses the unique identifier for datagram replay protection as the IV. .\"********************************************************* .TP -.B \-\-use-prediction-resistance +.B \-\-use\-prediction\-resistance Enable prediction resistance on PolarSSL's RNG. Enabling prediction resistance causes the RNG to reseed in each @@ -4090,7 +4129,7 @@ Note that this option only works with PolarSSL versions greater than 1.1. .\"********************************************************* .TP -.B \-\-test-crypto +.B \-\-test\-crypto Do a self-test of OpenVPN's crypto options by encrypting and decrypting test packets using the data channel encryption options specified above. This option does not require a peer to function, @@ -4100,14 +4139,14 @@ or .B \-\-remote. The typical usage of -.B \-\-test-crypto +.B \-\-test\-crypto would be something like this: -.B openvpn \-\-test-crypto \-\-secret key +.B openvpn \-\-test\-crypto \-\-secret key or -.B openvpn \-\-test-crypto \-\-secret key \-\-verb 9 +.B openvpn \-\-test\-crypto \-\-secret key \-\-verb 9 This option is very useful to test OpenVPN after it has been ported to a new platform, or to isolate problems in the compiler, OpenSSL @@ -4158,14 +4197,14 @@ The easy-rsa package is also rendered in web form here: .I http://openvpn.net/easyrsa.html .\"********************************************************* .TP -.B \-\-tls-server +.B \-\-tls\-server Enable TLS and assume server role during TLS handshake. Note that OpenVPN is designed as a peer-to-peer application. The designation of client or server is only for the purpose of negotiating the TLS control channel. .\"********************************************************* .TP -.B \-\-tls-client +.B \-\-tls\-client Enable TLS and assume client role during TLS handshake. .\"********************************************************* .TP @@ -4176,7 +4215,7 @@ certificate. This file can have multiple certificates in .pem format, concatenated together. You can construct your own certificate authority certificate and private key by using a command such as: -.B openssl req -nodes -new -x509 -keyout ca.key -out ca.crt +.B openssl req \-nodes \-new \-x509 \-keyout ca.key \-out ca.crt Then edit your openssl.cnf file and edit the .B certificate @@ -4195,15 +4234,31 @@ they are distributed with OpenVPN, they are totally insecure. Directory containing trusted certificates (CAs and CRLs). Available with OpenSSL version >= 0.9.7 dev. Not available with PolarSSL. + +When using the +.B \-\-capath +option, you are required to supply valid CRLs for the CAs too. CAs in the +capath directory are expected to be named .. CRLs are expected to +be named .r. See the +.B -CApath +option of +.B openssl verify +, and the +.B -hash +option of +.B openssl x509 +and +.B openssl crl +for more information. .\"********************************************************* .TP .B \-\-dh file File containing Diffie Hellman parameters in .pem format (required for -.B \-\-tls-server +.B \-\-tls\-server only). Use -.B openssl dhparam -out dh1024.pem 1024 +.B openssl dhparam \-out dh1024.pem 1024 to generate your own, or use the existing dh1024.pem file included with the OpenVPN distribution. Diffie Hellman parameters @@ -4211,7 +4266,7 @@ may be considered public. .\"********************************************************* .TP .B \-\-cert file -Local peer's signed certificate in .pem format \-\- must be signed +Local peer's signed certificate in .pem format -- must be signed by a certificate authority whose certificate is in .B \-\-ca file. Each peer in an OpenVPN link running in TLS mode should have its own @@ -4226,14 +4281,14 @@ helping to finance the world's second space tourist :). To generate a certificate, you can use a command such as: -.B openssl req -nodes -new -keyout mycert.key -out mycert.csr +.B openssl req \-nodes \-new \-keyout mycert.key \-out mycert.csr If your certificate authority private key lives on another machine, copy the certificate signing request (mycert.csr) to this other machine (this can be done over an insecure channel such as email). Now sign the certificate with a command such as: -.B openssl ca -out mycert.crt -in mycert.csr +.B openssl ca \-out mycert.crt \-in mycert.csr Now copy the certificate (mycert.crt) back to the peer which initially generated the .csr file (this @@ -4243,7 +4298,7 @@ Note that the command reads the location of the certificate authority key from its configuration file such as .B /usr/share/ssl/openssl.cnf -\-\- note also +-- note also that for certificate authority functions, you must set up the files .B index.txt (may be empty) and @@ -4254,7 +4309,7 @@ that for certificate authority functions, you must set up the files ). .\"********************************************************* .TP -.B \-\-extra-certs file +.B \-\-extra\-certs file Specify a .B file containing one or more PEM certs (concatenated together) @@ -4273,11 +4328,11 @@ file. .B \-\-key file Local peer's private key in .pem format. Use the private key which was generated when you built your peer's certificate (see -.B -cert file +.B \-\-cert file above). .\"********************************************************* .TP -.B \-\-tls-version-min version ['or-highest'] +.B \-\-tls\-version\-min version ['or\-highest'] Enable TLS version negotiation, and set the minimum TLS version we will accept from the peer (default is "1.0"). Examples for version @@ -4285,11 +4340,19 @@ include "1.0", "1.1", or "1.2". If 'or-highest' is specified and version is not recognized, we will only accept the highest TLS version supported by the local SSL implementation. -If this options is not set, the code in OpenVPN 2.3.4 will default -to using TLS 1.0 only, without any version negotiation. This reverts -the beaviour to what OpenVPN versions up to 2.3.2 did, as it turned -out that TLS version negotiation can lead to handshake problems due -to new signature algorithms in TLS 1.2. +Also see +.B \-\-tls\-version\-max +below, for information on compatibility. +.\"********************************************************* +.TP +.B \-\-tls\-version\-max version +Set the maximum TLS version we will use (default is the highest version +supported). Examples for version include "1.0", "1.1", or "1.2". + +If and only if this is set to 1.0, and OpenSSL is used (not PolarSSL), +then OpenVPN will set up OpenSSL to use a fixed TLSv1 handshake. All +other configurations will autonegotiate in the given limits, and the +choice of handshake versions is left to the SSL implementation. .\"********************************************************* .TP .B \-\-pkcs12 file @@ -4302,7 +4365,7 @@ and Not available with PolarSSL. .\"********************************************************* .TP -.B \-\-verify-hash hash +.B \-\-verify\-hash hash Specify SHA1 fingerprint for level-1 cert. The level-1 cert is the CA (or intermediate cert) that signs the leaf certificate, and is one removed from the leaf certificate in the direction of the root. @@ -4313,63 +4376,73 @@ or certificate verification will fail. Hash is specified as XX:XX:... For example: AD:B0:95:D8:09:C8:36:45:12:A9:89:C8:90:09:CB:13:72:A6:AD:16 .\"********************************************************* .TP -.B \-\-pkcs11-cert-private [0|1]... +.B \-\-pkcs11\-cert\-private [0|1]... Set if access to certificate object should be performed after login. Every provider has its own setting. .\"********************************************************* .TP -.B \-\-pkcs11-id name +.B \-\-pkcs11\-id name Specify the serialized certificate id to be used. The id can be gotten by the standalone -.B \-\-show-pkcs11-ids +.B \-\-show\-pkcs11\-ids option. .\"********************************************************* .TP -.B \-\-pkcs11-id-management +.B \-\-pkcs11\-id\-management Acquire PKCS#11 id from management interface. In this case a NEED-STR 'pkcs11-id-request' real-time message will be triggered, application may use pkcs11-id-count command to retrieve available number of certificates, and pkcs11-id-get command to retrieve certificate id and certificate body. .\"********************************************************* .TP -.B \-\-pkcs11-pin-cache seconds +.B \-\-pkcs11\-pin\-cache seconds Specify how many seconds the PIN can be cached, the default is until the token is removed. .\"********************************************************* .TP -.B \-\-pkcs11-protected-authentication [0|1]... +.B \-\-pkcs11\-protected\-authentication [0|1]... Use PKCS#11 protected authentication path, useful for biometric and external keypad devices. Every provider has its own setting. .\"********************************************************* .TP -.B \-\-pkcs11-providers provider... +.B \-\-pkcs11\-providers provider... Specify a RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) providers to load. This option can be used instead of .B \-\-cert, \-\-key, and .B \-\-pkcs12. + +If p11-kit is present on the system, its +.B p11-kit-proxy.so +module will be loaded by default if either the +.B \-\-pkcs11\-id +or +.B \-\-pkcs11\-id\-management +options are specified without +.B \-\-pkcs11\-provider +being given. .\"********************************************************* .TP -.B \-\-pkcs11-private-mode mode... +.B \-\-pkcs11\-private\-mode mode... Specify which method to use in order to perform private key operations. A different mode can be specified for each provider. Mode is encoded as hex number, and can be a mask one of the following: .B 0 -(default) \-\- Try to determine automatically. +(default) -- Try to determine automatically. .br .B 1 -\-\- Use sign. +-- Use sign. .br .B 2 -\-\- Use sign recover. +-- Use sign recover. .br .B 4 -\-\- Use decrypt. +-- Use decrypt. .br .B 8 -\-\- Use unwrap. +-- Use unwrap. .br .\"********************************************************* .TP @@ -4406,7 +4479,7 @@ Certificate Store GUI. .\"********************************************************* .TP -.B \-\-key-method m +.B \-\-key\-method m Use data channel key negotiation method .B m. The key method must match on both sides of the connection. @@ -4434,30 +4507,44 @@ of keying occur: of the connection producing certificates and verifying the certificate (or other authentication info provided) of the other side. The -.B \-\-key-method +.B \-\-key\-method parameter has no effect on this process. (2) After the TLS connection is established, the tunnel session keys are separately negotiated over the existing secure TLS channel. Here, -.B \-\-key-method +.B \-\-key\-method determines the derivation of the tunnel session keys. .\"********************************************************* .TP -.B \-\-tls-cipher l +.B \-\-tls\-cipher l A list .B l of allowable TLS ciphers delimited by a colon (":"). -If you require a high level of security, -you may want to set this parameter manually, to prevent a -version rollback attack where a man-in-the-middle attacker tries -to force two peers to negotiate to the lowest level -of security they both support. + +This setting can be used to ensure that certain cipher suites are used (or +not used) for the TLS connection. OpenVPN uses TLS to secure the control +channel, over which the keys that are used to protect the actual VPN traffic +are exchanged. + +The supplied list of ciphers is (after potential OpenSSL/IANA name translation) +simply supplied to the crypto library. Please see the OpenSSL and/or PolarSSL +documentation for details on the cipher list interpretation. + Use -.B \-\-show-tls -to see a list of supported TLS ciphers. +.B \-\-show\-tls +to see a list of TLS ciphers supported by your crypto library. + +Warning! +.B \-\-tls\-cipher +is an expert feature, which - if used correcly - can improve the security of +your VPN connection. But it is also easy to unwittingly use it to carefully +align a gun with your foot, or just break your connection. Use with care! + +The default for --tls-cipher is to use PolarSSL's default cipher list +when using PolarSSL or "DEFAULT:!EXP:!PSK:!SRP:!kRSA" when using OpenSSL. .\"********************************************************* .TP -.B \-\-tls-timeout n +.B \-\-tls\-timeout n Packet retransmit timeout on TLS control channel if no acknowledgment from remote within .B n @@ -4474,7 +4561,7 @@ the higher level network protocols running on top of the tunnel such as TCP expect this role to be left to them. .\"********************************************************* .TP -.B \-\-reneg-bytes n +.B \-\-reneg\-bytes n Renegotiate data channel key after .B n bytes sent or received (disabled by default). @@ -4484,13 +4571,13 @@ a number of seconds. A key renegotiation will be forced if any of these three criteria are met by either peer. .\"********************************************************* .TP -.B \-\-reneg-pkts n +.B \-\-reneg\-pkts n Renegotiate data channel key after .B n packets sent and received (disabled by default). .\"********************************************************* .TP -.B \-\-reneg-sec n +.B \-\-reneg\-sec n Renegotiate data channel key after .B n seconds (default=3600). @@ -4501,16 +4588,16 @@ cause the end user to be challenged to reauthorize once per hour. Also, keep in mind that this option can be used on both the client and server, and whichever uses the lower value will be the one to trigger the renegotiation. A common mistake is to set -.B \-\-reneg-sec +.B \-\-reneg\-sec to a higher value on either the client or server, while the other side of the connection is still using the default value of 3600 seconds, meaning that the renegotiation will -still occur once per 3600 seconds. The solution is to increase \-\-reneg-sec on both the +still occur once per 3600 seconds. The solution is to increase \-\-reneg\-sec on both the client and server, or set it to 0 on one side of the connection (to disable), and to your chosen value on the other side. .\"********************************************************* .TP -.B \-\-hand-window n -Handshake Window \-\- the TLS-based key exchange must finalize within +.B \-\-hand\-window n +Handshake Window -- the TLS-based key exchange must finalize within .B n seconds of handshake initiation by any peer (default = 60 seconds). @@ -4518,47 +4605,47 @@ If the handshake fails we will attempt to reset our connection with our peer and try again. Even in the event of handshake failure we will still use our expiring key for up to -.B \-\-tran-window +.B \-\-tran\-window seconds to maintain continuity of transmission of tunnel data. .\"********************************************************* .TP -.B \-\-tran-window n -Transition window \-\- our old key can live this many seconds +.B \-\-tran\-window n +Transition window -- our old key can live this many seconds after a new a key renegotiation begins (default = 3600 seconds). This feature allows for a graceful transition from old to new key, and removes the key renegotiation sequence from the critical path of tunnel data forwarding. .\"********************************************************* .TP -.B \-\-single-session +.B \-\-single\-session After initially connecting to a remote peer, disallow any new connections. Using this option means that a remote peer cannot connect, disconnect, and then reconnect. If the daemon is reset by a signal or -.B \-\-ping-restart, +.B \-\-ping\-restart, it will allow one new connection. -.B \-\-single-session +.B \-\-single\-session can be used with -.B \-\-ping-exit +.B \-\-ping\-exit or .B \-\-inactive to create a single dynamic session that will exit when finished. .\"********************************************************* .TP -.B \-\-tls-exit +.B \-\-tls\-exit Exit on TLS negotiation failure. .\"********************************************************* .TP -.B \-\-tls-auth file [direction] +.B \-\-tls\-auth file [direction] Add an additional layer of HMAC authentication on top of the TLS control channel to protect against DoS attacks. In a nutshell, -.B \-\-tls-auth +.B \-\-tls\-auth enables a kind of "HMAC firewall" on OpenVPN's TCP/UDP port, where TLS control channel packets bearing an incorrect HMAC signature can be dropped immediately without @@ -4574,14 +4661,15 @@ An OpenVPN static key file generated by .B direction parameter is used). -.B (2) +.B (2) DEPRECATED A freeform passphrase file. In this case the HMAC key will be derived by taking a secure hash of this file, similar to the .BR md5sum (1) or .BR sha1sum (1) -commands. +commands. This option is deprecated and will stop working in OpenVPN 2.4 and +newer releases. OpenVPN will first try format (1), and if the file fails to parse as a static key file, format (2) will be used. @@ -4592,7 +4680,7 @@ option for more information on the optional .B direction parameter. -.B \-\-tls-auth +.B \-\-tls\-auth is recommended when you are running OpenVPN in a mode where it is listening for packets from any IP address, such as when .B \-\-remote @@ -4626,7 +4714,7 @@ An important rule of thumb in reducing vulnerability to DoS attacks is to minimize the amount of resources a potential, but as yet unauthenticated, client is able to consume. -.B \-\-tls-auth +.B \-\-tls\-auth does this by signing every TLS control channel packet with an HMAC signature, including packets which are sent before the TLS level has had a chance to authenticate the peer. @@ -4634,15 +4722,15 @@ The result is that packets without the correct signature can be dropped immediately upon reception, before they have a chance to consume additional system resources such as by initiating a TLS handshake. -.B \-\-tls-auth +.B \-\-tls\-auth can be strengthened by adding the -.B \-\-replay-persist +.B \-\-replay\-persist option which will keep OpenVPN's replay protection state in a file so that it is not lost across restarts. It should be emphasized that this feature is optional and that the passphrase/key file used with -.B \-\-tls-auth +.B \-\-tls\-auth gives a peer nothing more than the power to initiate a TLS handshake. It is not used to encrypt or authenticate any tunnel data. .\"********************************************************* @@ -4660,7 +4748,7 @@ daemon is started you must be there to type the password. The option allows you to start OpenVPN from the command line. It will query you for a password before it daemonizes. To protect a private key with a password you should omit the -.B -nodes +.B \-nodes option when you use the .B openssl command line tool to manage certificates and private keys. @@ -4673,15 +4761,15 @@ Keep in mind that storing your password in a file to a certain extent invalidates the extra security provided by using an encrypted key (Note: OpenVPN will only read passwords from a file if it has been built -with the \-\-enable-password-save configure option, or on Windows +with the \-\-enable\-password\-save configure option, or on Windows by defining ENABLE_PASSWORD_SAVE in win/settings.in). .\"********************************************************* .TP -.B \-\-auth-nocache +.B \-\-auth\-nocache Don't cache .B \-\-askpass or -.B \-\-auth-user-pass +.B \-\-auth\-user\-pass username/passwords in virtual memory. If specified, this directive will cause OpenVPN to immediately @@ -4690,20 +4778,23 @@ when OpenVPN needs a username/password, it will prompt for input from stdin, which may be multiple times during the duration of an OpenVPN session. +When using \-\-auth\-nocache in combination with a user/password file +and \-\-chroot or \-\-daemon, make sure to use an absolute path. + This directive does not affect the -.B \-\-http-proxy +.B \-\-http\-proxy username/password. It is always cached. .\"********************************************************* .TP -.B \-\-tls-verify cmd +.B \-\-tls\-verify cmd Run command .B cmd to verify the X509 name of a pending TLS connection that has otherwise passed all other tests of certification (except for revocation via -.B \-\-crl-verify +.B \-\-crl\-verify directive; the revocation test occurs after the -.B \-\-tls-verify +.B \-\-tls\-verify test). .B cmd @@ -4740,24 +4831,24 @@ See the "Environmental Variables" section below for additional parameters passed as environmental variables. .\"********************************************************* .TP -.B \-\-tls-export-cert directory +.B \-\-tls\-export\-cert directory Store the certificates the clients uses upon connection to this -directory. This will be done before \-\-tls-verify is called. The +directory. This will be done before \-\-tls\-verify is called. The certificates will use a temporary name and will be deleted when the tls-verify script returns. The file name used for the certificate is available via the peer_cert environment variable. .\"********************************************************* .TP -.B \-\-x509-username-field [ext:\]fieldname +.B \-\-x509\-username\-field [ext:\]fieldname Field in the X.509 certificate subject to be used as the username (default=CN). Typically, this option is specified with .B fieldname as either of the following: -.B \-\-x509-username-field +.B \-\-x509\-username\-field emailAddress .br -.B \-\-x509-username-field ext:\fRsubjectAltName +.B \-\-x509\-username\-field ext:\fRsubjectAltName The first example uses the value of the "emailAddress" attribute in the certificate's Subject field as the username. The second example uses @@ -4772,7 +4863,7 @@ in the last occurrence is chosen. When this option is used, the -.B \-\-verify-x509-name +.B \-\-verify\-x509\-name option will match against the chosen .B fieldname instead of the Common Name. @@ -4788,7 +4879,7 @@ prefix will be left as-is. This automatic upcasing feature is deprecated and will be removed in a future release. .\"********************************************************* .TP -.B \-\-tls-remote name (DEPRECATED) +.B \-\-tls\-remote name (DEPRECATED) Accept connections only from a host with X509 name or common name equal to .B name. @@ -4805,18 +4896,18 @@ a third party, such as a commercial web CA. Name can also be a common name prefix, for example if you want a client to only accept connections to "Server-1", "Server-2", etc., you can simply use -.B \-\-tls-remote Server +.B \-\-tls\-remote Server Using a common name prefix is a useful alternative to managing a CRL (Certificate Revocation List) on the client, since it allows the client to refuse all certificates except for those associated with designated servers. -.B \-\-tls-remote +.B \-\-tls\-remote is a useful replacement for the -.B \-\-tls-verify +.B \-\-tls\-verify option to verify the remote host, because -.B \-\-tls-remote +.B \-\-tls\-remote works in a .B \-\-chroot environment too. @@ -4825,13 +4916,13 @@ environment too. This option is now deprecated. It will be removed either in OpenVPN v2.4 or v2.5. So please make sure you support the new X.509 name formatting described with the -.B \-\-compat-names +.B \-\-compat\-names option as soon as possible by updating your configurations to use -.B \-\-verify-x509-name +.B \-\-verify\-x509\-name instead. .\"********************************************************* .TP -.B \-\-verify-x509-name name type +.B \-\-verify\-x509\-name name type Accept connections only if a host's X.509 name is equal to .B name. The remote host must also pass all other tests of verification. @@ -4843,22 +4934,22 @@ depends on the setting of type. can be "subject" to match the complete subject DN (default), "name" to match a subject RDN or "name-prefix" to match a subject RDN prefix. Which RDN is verified as name depends on the -.B \-\-x509-username-field +.B \-\-x509\-username\-field option. But it defaults to the common name (CN), e.g. a certificate with a subject DN "C=KG, ST=NA, L=Bishkek, CN=Server-1" would be matched by: -.B \-\-verify-x509-name 'C=KG, ST=NA, L=Bishkek, CN=Server-1' +.B \-\-verify\-x509\-name 'C=KG, ST=NA, L=Bishkek, CN=Server-1' and -.B \-\-verify-x509-name Server-1 name +.B \-\-verify\-x509\-name Server-1 name or you could use -.B \-\-verify-x509-name Server- name-prefix +.B \-\-verify\-x509\-name Server- name-prefix if you want a client to only accept connections to "Server-1", "Server-2", etc. -.B \-\-verify-x509-name +.B \-\-verify\-x509\-name is a useful replacement for the -.B \-\-tls-verify +.B \-\-tls\-verify option to verify the remote host, because -.B \-\-verify-x509-name +.B \-\-verify\-x509\-name works in a .B \-\-chroot environment without any dependencies. @@ -4875,7 +4966,7 @@ Never use this option with type "name-prefix" when your client certificates are signed by a third party, such as a commercial web CA. .\"********************************************************* .TP -.B \-\-x509-track attribute +.B \-\-x509\-track attribute Save peer X509 .B attribute value in environment for use by plugins and management interface. @@ -4883,12 +4974,12 @@ Prepend a '+' to .B attribute to save values from full cert chain. Values will be encoded as X509__=. Multiple -.B \-\-x509-track +.B \-\-x509\-track options can be defined to track multiple attributes. Not available with PolarSSL. .\"********************************************************* .TP -.B \-\-ns-cert-type client|server +.B \-\-ns\-cert\-type client|server Require that peer certificate was signed with an explicit .B nsCertType designation of "client" or "server". @@ -4903,19 +4994,19 @@ field set to "server". If the server certificate's nsCertType field is set to "server", then the clients can verify this with -.B \-\-ns-cert-type server. +.B \-\-ns\-cert\-type server. This is an important security precaution to protect against a man-in-the-middle attack where an authorized client attempts to connect to another client by impersonating the server. The attack is easily prevented by having clients verify the server certificate using any one of -.B \-\-ns-cert-type, \-\-verify-x509-name, +.B \-\-ns\-cert\-type, \-\-verify\-x509\-name, or -.B \-\-tls-verify. +.B \-\-tls\-verify. .\"********************************************************* .TP -.B \-\-remote-cert-ku v... +.B \-\-remote\-cert\-ku v... Require that peer certificate was signed with an explicit .B key usage. @@ -4926,7 +5017,7 @@ The key usage should be encoded in hex, more than one key usage can be specified. .\"********************************************************* .TP -.B \-\-remote-cert-eku oid +.B \-\-remote\-cert\-eku oid Require that peer certificate was signed with an explicit .B extended key usage. @@ -4937,7 +5028,7 @@ The extended key usage should be encoded in oid notation, or OpenSSL symbolic representation. .\"********************************************************* .TP -.B \-\-remote-cert-tls client|server +.B \-\-remote\-cert\-tls client|server Require that peer certificate was signed with an explicit .B key usage and @@ -4948,18 +5039,18 @@ This is a useful security option for clients, to ensure that the host they connect to is a designated server. The -.B \-\-remote-cert-tls client +.B \-\-remote\-cert\-tls client option is equivalent to .B -\-\-remote-cert-ku 80 08 88 \-\-remote-cert-eku "TLS Web Client Authentication" +\-\-remote\-cert\-ku 80 08 88 \-\-remote\-cert\-eku "TLS Web Client Authentication" The key usage is digitalSignature and/or keyAgreement. The -.B \-\-remote-cert-tls server +.B \-\-remote\-cert\-tls server option is equivalent to .B -\-\-remote-cert-ku a0 88 \-\-remote-cert-eku "TLS Web Server Authentication" +\-\-remote\-cert\-ku a0 88 \-\-remote\-cert\-eku "TLS Web Server Authentication" The key usage is digitalSignature and ( keyEncipherment or keyAgreement ). @@ -4968,12 +5059,12 @@ a man-in-the-middle attack where an authorized client attempts to connect to another client by impersonating the server. The attack is easily prevented by having clients verify the server certificate using any one of -.B \-\-remote-cert-tls, \-\-verify-x509-name, +.B \-\-remote\-cert\-tls, \-\-verify\-x509\-name, or -.B \-\-tls-verify. +.B \-\-tls\-verify. .\"********************************************************* .TP -.B \-\-crl-verify crl ['dir'] +.B \-\-crl\-verify crl ['dir'] Check peer certificate against the file .B crl in PEM format. @@ -4999,32 +5090,42 @@ is a directory containing files named as revoked serial numbers requests a connection, where the client certificate serial number (decimal string) is the name of a file present in the directory, it will be rejected. + +Note: As the crl file (or directory) is read every time a peer connects, +if you are dropping root privileges with +.B \-\-user, +make sure that this user has sufficient privileges to read the file. .\"********************************************************* .SS SSL Library information: .\"********************************************************* .TP -.B \-\-show-ciphers +.B \-\-show\-ciphers (Standalone) Show all cipher algorithms to use with the .B \-\-cipher option. .\"********************************************************* .TP -.B \-\-show-digests +.B \-\-show\-digests (Standalone) Show all message digest algorithms to use with the .B \-\-auth option. .\"********************************************************* .TP -.B \-\-show-tls +.B \-\-show\-tls (Standalone) -Show all TLS ciphers (TLS used only as a control channel). The TLS -ciphers will be sorted from highest preference (most secure) to -lowest. +Show all TLS ciphers supported by the crypto library. OpenVPN uses TLS to +secure the control channel, over which the keys that are used to protect the +actual VPN traffic are exchanged. The TLS ciphers will be sorted from highest +preference (most secure) to lowest. + +Be aware that whether a cipher suite in this list can actually work depends on +the specific setup of both peers (e.g. both peers must support the cipher, and +an ECDSA cipher suite will not work if you are using an RSA certificate, etc.). .\"********************************************************* .TP -.B \-\-show-engines +.B \-\-show\-engines (Standalone) Show currently available hardware-based crypto acceleration engines supported by the OpenSSL library. @@ -5083,9 +5184,9 @@ option above). One disadvantage of persistent tunnels is that it is harder to automatically configure their MTU value (see -.B \-\-link-mtu +.B \-\-link\-mtu and -.B \-\-tun-mtu +.B \-\-tun\-mtu above). On some platforms such as Windows, TAP-Win32 tunnels are persistent by @@ -5111,7 +5212,7 @@ Optional group to be owner of this tunnel. .SS Windows-Specific Options: .\"********************************************************* .TP -.B \-\-win-sys path +.B \-\-win\-sys path Set the Windows system directory pathname to use when looking for system executables such as .B route.exe @@ -5122,7 +5223,7 @@ not specified, OpenVPN will use the SystemRoot environment variable. This option have changed behaviour in OpenVPN 2.3. Earlier you had to define -.B --win-sys env +.B \-\-win\-sys env to use the SystemRoot environment variable, otherwise it defaulted to C:\\WINDOWS. It is not needed to use the .B env @@ -5130,7 +5231,7 @@ keyword any more, and it will just be ignored. A warning is logged when this is found in the configuration file. .\"********************************************************* .TP -.B \-\-ip-win32 method +.B \-\-ip\-win32 method When using .B \-\-ifconfig on Windows, set the TAP-Win32 adapter @@ -5139,14 +5240,14 @@ IP address and netmask using Don't use this option unless you are also using .B \-\-ifconfig. -.B manual \-\- +.B manual -- Don't set the IP address or netmask automatically. Instead output a message to the console telling the user to configure the adapter manually and indicating the IP/netmask which OpenVPN expects the adapter to be set to. -.B dynamic [offset] [lease-time] \-\- +.B dynamic [offset] [lease-time] -- Automatically set the IP address and netmask by replying to DHCP query messages generated by the kernel. This mode is probably the "cleanest" solution @@ -5184,13 +5285,13 @@ because it prevents routes involving the TAP-Win32 adapter from being lost when the system goes to sleep. The default lease time is one year. -.B netsh \-\- +.B netsh -- Automatically set the IP address and netmask using the Windows command-line "netsh" command. This method appears to work correctly on Windows XP but not Windows 2000. -.B ipapi \-\- +.B ipapi -- Automatically set the IP address and netmask using the Windows IP Helper API. This approach does not have ideal semantics, though testing has indicated @@ -5199,7 +5300,7 @@ it is best to leave the TCP/IP properties for the TAP-Win32 adapter in their default state, i.e. "Obtain an IP address automatically." -.B adaptive \-\- +.B adaptive -- (Default) Try .B dynamic method initially and fail over to @@ -5229,55 +5330,55 @@ mode to restore the TAP-Win32 adapter TCP/IP properties to a DHCP configuration. .\"********************************************************* .TP -.B \-\-route-method m +.B \-\-route\-method m Which method .B m to use for adding routes on Windows? .B adaptive -(default) \-\- Try IP helper API first. If that fails, fall +(default) -- Try IP helper API first. If that fails, fall back to the route.exe shell command. .br .B ipapi -\-\- Use IP helper API. +-- Use IP helper API. .br .B exe -\-\- Call the route.exe shell command. +-- Call the route.exe shell command. .\"********************************************************* .TP -.B \-\-dhcp-option type [parm] +.B \-\-dhcp\-option type [parm] Set extended TAP-Win32 TCP/IP properties, must be used with -.B \-\-ip-win32 dynamic +.B \-\-ip\-win32 dynamic or -.B \-\-ip-win32 adaptive. +.B \-\-ip\-win32 adaptive. This option can be used to set additional TCP/IP properties on the TAP-Win32 adapter, and is particularly useful for configuring an OpenVPN client to access a Samba server across the VPN. -.B DOMAIN name \-\- +.B DOMAIN name -- Set Connection-specific DNS Suffix. -.B DNS addr \-\- +.B DNS addr -- Set primary domain name server address. Repeat this option to set secondary DNS server addresses. -.B WINS addr \-\- +.B WINS addr -- Set primary WINS server address (NetBIOS over TCP/IP Name Server). Repeat this option to set secondary WINS server addresses. -.B NBDD addr \-\- +.B NBDD addr -- Set primary NBDD server address (NetBIOS over TCP/IP Datagram Distribution Server) Repeat this option to set secondary NBDD server addresses. -.B NTP addr \-\- +.B NTP addr -- Set primary NTP server address (Network Time Protocol). Repeat this option to set secondary NTP server addresses. -.B NBT type \-\- +.B NBT type -- Set NetBIOS over TCP/IP Node type. Possible options: .B 1 = b-node (broadcasts), @@ -5290,7 +5391,7 @@ then query name server), and .B 8 = h-node (query name server, then broadcast). -.B NBS scope-id \-\- +.B NBS scope-id -- Set NetBIOS over TCP/IP Scope. A NetBIOS Scope ID provides an extended naming service for the NetBIOS over TCP/IP (Known as NBT) module. The primary purpose of a NetBIOS scope ID is to isolate NetBIOS traffic on @@ -5302,11 +5403,11 @@ computers to use the same computer name, as they have different scope IDs. The Scope ID becomes a part of the NetBIOS name, making the name unique. (This description of NetBIOS scopes courtesy of NeonSurge@abyss.com) -.B DISABLE-NBT \-\- +.B DISABLE-NBT -- Disable Netbios-over-TCP/IP. Note that if -.B \-\-dhcp-option +.B \-\-dhcp\-option is pushed via .B \-\-push to a non-windows client, the option will be saved in the client's @@ -5314,7 +5415,7 @@ environment before the up script is called, under the name "foreign_option_{n}". .\"********************************************************* .TP -.B \-\-tap-sleep n +.B \-\-tap\-sleep n Cause OpenVPN to sleep for .B n seconds immediately after the TAP-Win32 adapter state @@ -5324,19 +5425,19 @@ This option is intended to be used to troubleshoot problems with the .B \-\-ifconfig and -.B \-\-ip-win32 +.B \-\-ip\-win32 options, and is used to give the TAP-Win32 adapter time to come up before Windows IP Helper API operations are applied to it. .\"********************************************************* .TP -.B \-\-show-net-up +.B \-\-show\-net\-up Output OpenVPN's view of the system routing table and network adapter list to the syslog or log file after the TUN/TAP adapter has been brought up and any routes have been added. .\"********************************************************* .TP -.B \-\-dhcp-renew +.B \-\-dhcp\-renew Ask Windows to renew the TAP adapter lease on startup. This option is normally unnecessary, as Windows automatically triggers a DHCP renegotiation on the TAP adapter when it @@ -5345,28 +5446,28 @@ Media Status property to "Always Connected", you may need this flag. .\"********************************************************* .TP -.B \-\-dhcp-release +.B \-\-dhcp\-release Ask Windows to release the TAP adapter lease on shutdown. This option has the same caveats as -.B \-\-dhcp-renew +.B \-\-dhcp\-renew above. .\"********************************************************* .TP -.B \-\-register-dns +.B \-\-register\-dns Run net stop dnscache, net start dnscache, ipconfig /flushdns and ipconfig /registerdns on connection initiation. This is known to kick Windows into recognizing pushed DNS servers. .\"********************************************************* .TP -.B \-\-pause-exit +.B \-\-pause\-exit Put up a "press any key to continue" message on the console prior to OpenVPN program exit. This option is automatically used by the Windows explorer when OpenVPN is run on a configuration file using the right-click explorer menu. .\"********************************************************* .TP -.B \-\-service exit-event [0|1] +.B \-\-service exit\-event [0|1] Should be used when OpenVPN is being automatically executed by another program in such a context that no interaction with the user via display or keyboard @@ -5395,20 +5496,20 @@ window to output status/error messages, therefore it is useful to use .B \-\-log or -.B \-\-log-append +.B \-\-log\-append to write these messages to a file. .\"********************************************************* .TP -.B \-\-show-adapters +.B \-\-show\-adapters (Standalone) Show available TAP-Win32 adapters which can be selected using the -.B \-\-dev-node +.B \-\-dev\-node option. On non-Windows systems, the .BR ifconfig (8) command provides similar functionality. .\"********************************************************* .TP -.B \-\-allow-nonadmin [TAP-adapter] +.B \-\-allow\-nonadmin [TAP-adapter] (Standalone) Set .B TAP-adapter @@ -5423,7 +5524,7 @@ and reloaded. This directive can only be used by an administrator. .\"********************************************************* .TP -.B \-\-show-valid-subnets +.B \-\-show\-valid\-subnets (Standalone) Show valid subnets for .B \-\-dev tun @@ -5436,7 +5537,7 @@ Namely, the point-to-point endpoints used in TUN device emulation must be the middle two addresses of a /30 subnet (netmask 255.255.255.252). .\"********************************************************* .TP -.B \-\-show-net +.B \-\-show\-net (Standalone) Show OpenVPN's view of the system routing table and network adapter list. @@ -5444,11 +5545,17 @@ adapter list. .SS PKCS#11 Standalone Options: .\"********************************************************* .TP -.B \-\-show-pkcs11-ids provider [cert_private] +.B \-\-show\-pkcs11\-ids [provider] [cert_private] (Standalone) Show PKCS#11 token object list. Specify cert_private as 1 if certificates are stored as private objects. +If p11-kit is present on the system, the +.B provider +argument is optional; if omitted the default +.B p11-kit-proxy.so +module will be queried. + .B \-\-verb option can be used BEFORE this option to produce debugging information. .\"********************************************************* @@ -5461,26 +5568,26 @@ as well (except for .B \-\-topology , which has no effect on IPv6). .TP -.B --ifconfig-ipv6 ipv6addr/bits ipv6remote +.B \-\-ifconfig\-ipv6 ipv6addr/bits ipv6remote configure IPv6 address .B ipv6addr/bits on the ``tun'' device. The second parameter is used as route target for -.B --route-ipv6 +.B \-\-route\-ipv6 if no gateway is specified. .TP -.B --route-ipv6 ipv6addr/bits [gateway] [metric] +.B \-\-route\-ipv6 ipv6addr/bits [gateway] [metric] setup IPv6 routing in the system to send the specified IPv6 network into OpenVPN's ``tun'' device .TP -.B --server-ipv6 ipv6addr/bits +.B \-\-server\-ipv6 ipv6addr/bits convenience-function to enable a number of IPv6 related options at once, namely -.B --ifconfig-ipv6, --ifconfig-ipv6-pool, --tun-ipv6 +.B \-\-ifconfig\-ipv6, \-\-ifconfig\-ipv6\-pool, \-\-tun\-ipv6 and -.B --push tun-ipv6 -Is only accepted if ``--mode server'' or ``--server'' is set. +.B \-\-push tun\-ipv6 +Is only accepted if ``\-\-mode server'' or ``\-\-server'' is set. .TP -.B --ifconfig-ipv6-pool ipv6addr/bits +.B \-\-ifconfig\-ipv6\-pool ipv6addr/bits Specify an IPv6 address pool for dynamic assignment to clients. The pool starts at .B ipv6addr @@ -5489,20 +5596,20 @@ and increments by +1 for every new client (linear mode). The setting controls the size of the pool. Due to implementation details, the pool size must be between /64 and /112. .TP -.B --ifconfig-ipv6-push ipv6addr/bits ipv6remote +.B \-\-ifconfig\-ipv6\-push ipv6addr/bits ipv6remote for ccd/ per-client static IPv6 interface configuration, see -.B --client-config-dir +.B \-\-client\-config\-dir and -.B --ifconfig-push +.B \-\-ifconfig\-push for more details. .TP -.B --iroute-ipv6 ipv6addr/bits +.B \-\-iroute\-ipv6 ipv6addr/bits for ccd/ per-client static IPv6 route configuration, see -.B --iroute +.B \-\-iroute for more details how to setup and use this, and how -.B --iroute +.B \-\-iroute and -.B --route +.B \-\-route interact. .\"********************************************************* @@ -5517,7 +5624,7 @@ of environmental variables for use by user-defined scripts. Executed after TCP/UDP socket bind and TUN/TAP open. .\"********************************************************* .TP -.B \-\-tls-verify +.B \-\-tls\-verify Executed when we have a still untrusted remote peer. .\"********************************************************* .TP @@ -5525,25 +5632,25 @@ Executed when we have a still untrusted remote peer. Executed after connection authentication, or remote IP address change. .\"********************************************************* .TP -.B \-\-client-connect +.B \-\-client\-connect Executed in .B \-\-mode server mode immediately after client authentication. .\"********************************************************* .TP -.B \-\-route-up +.B \-\-route\-up Executed after connection authentication, either immediately after, or some number of seconds after as defined by the -.B \-\-route-delay +.B \-\-route\-delay option. .\"********************************************************* .TP -.B \-\-route-pre-down +.B \-\-route\-pre\-down Executed right before the routes are removed. .\"********************************************************* .TP -.B \-\-client-disconnect +.B \-\-client\-disconnect Executed in .B \-\-mode server mode on client instance shutdown. @@ -5553,14 +5660,14 @@ mode on client instance shutdown. Executed after TCP/UDP and TUN/TAP close. .\"********************************************************* .TP -.B \-\-learn-address +.B \-\-learn\-address Executed in .B \-\-mode server mode whenever an IPv4 address/route or MAC address is added to OpenVPN's internal routing table. .\"********************************************************* .TP -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify Executed in .B \-\-mode server mode on new client connections, when the client is @@ -5586,7 +5693,7 @@ Can string remapping be disabled? .B A: Yes, by using the -.B \-\-no-name-remapping +.B \-\-no\-name\-remapping option, however this should be considered an advanced option. Here is a brief rundown of OpenVPN's current string types and the @@ -5602,17 +5709,17 @@ true. Alphanumeric, underbar ('_'), dash ('-'), dot ('.'), and at ('@'). -.B \-\-auth-user-pass username: +.B \-\-auth\-user\-pass username: Same as Common Name, with one exception: starting with OpenVPN 2.0.1, the username is passed to the OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY plugin in its raw form, without string remapping. -.B \-\-auth-user-pass password: +.B \-\-auth\-user\-pass password: Any "printable" character except CR or LF. Printable is defined to be a character which will cause the C library isprint() function to return true. -.B \-\-client-config-dir filename as derived from common name or username: +.B \-\-client\-config\-dir filename as derived from common name or username: Alphanumeric, underbar ('_'), dash ('-'), and dot ('.') except for "." or ".." as standalone strings. As of 2.0.1-rc6, the at ('@') character has been added as well for compatibility with the common name character class. @@ -5642,23 +5749,23 @@ which refer to different client instances. .B bytes_received Total number of bytes received from client during VPN session. Set prior to execution of the -.B \-\-client-disconnect +.B \-\-client\-disconnect script. .\"********************************************************* .TP .B bytes_sent Total number of bytes sent to client during VPN session. Set prior to execution of the -.B \-\-client-disconnect +.B \-\-client\-disconnect script. .\"********************************************************* .TP .B common_name The X509 common name of an authenticated client. Set prior to execution of -.B \-\-client-connect, \-\-client-disconnect, +.B \-\-client\-connect, \-\-client\-disconnect, and -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify scripts. .\"********************************************************* .TP @@ -5680,7 +5787,7 @@ Set on program initiation and reset on SIGHUP. Set to "1" if the .B \-\-log or -.B \-\-log-append +.B \-\-log\-append directives are specified, or "0" otherwise. Set on program initiation and reset on SIGHUP. .\"********************************************************* @@ -5700,7 +5807,7 @@ An option pushed via .B \-\-push to a client which does not natively support it, such as -.B \-\-dhcp-option +.B \-\-dhcp\-option on a non-Windows system, will be recorded to this environmental variable sequence prior to .B \-\-up @@ -5726,7 +5833,7 @@ script execution. .TP .B ifconfig_ipv6_local The local VPN endpoint IPv6 address specified in the -.B \-\-ifconfig-ipv6 +.B \-\-ifconfig\-ipv6 option (first parameter). Set prior to OpenVPN calling the .I ifconfig @@ -5741,7 +5848,7 @@ script execution. .B ifconfig_ipv6_netbits The prefix length of the IPv6 network on the VPN interface. Derived from the /nnn parameter of the IPv6 address in the -.B \-\-ifconfig-ipv6 +.B \-\-ifconfig\-ipv6 option (first parameter). Set prior to OpenVPN calling the .I ifconfig @@ -5755,7 +5862,7 @@ script execution. .TP .B ifconfig_ipv6_remote The remote VPN endpoint IPv6 address specified in the -.B \-\-ifconfig-ipv6 +.B \-\-ifconfig\-ipv6 option (second parameter). Set prior to OpenVPN calling the .I ifconfig @@ -5817,54 +5924,54 @@ script execution. .B ifconfig_pool_local_ip The local virtual IP address for the TUN/TAP tunnel taken from an -.B \-\-ifconfig-push +.B \-\-ifconfig\-push directive if specified, or otherwise from the ifconfig pool (controlled by the -.B \-\-ifconfig-pool +.B \-\-ifconfig\-pool config file directive). Only set for .B \-\-dev tun tunnels. This option is set on the server prior to execution of the -.B \-\-client-connect +.B \-\-client\-connect and -.B \-\-client-disconnect +.B \-\-client\-disconnect scripts. .\"********************************************************* .TP .B ifconfig_pool_netmask The virtual IP netmask for the TUN/TAP tunnel taken from an -.B \-\-ifconfig-push +.B \-\-ifconfig\-push directive if specified, or otherwise from the ifconfig pool (controlled by the -.B \-\-ifconfig-pool +.B \-\-ifconfig\-pool config file directive). Only set for .B \-\-dev tap tunnels. This option is set on the server prior to execution of the -.B \-\-client-connect +.B \-\-client\-connect and -.B \-\-client-disconnect +.B \-\-client\-disconnect scripts. .\"********************************************************* .TP .B ifconfig_pool_remote_ip The remote virtual IP address for the TUN/TAP tunnel taken from an -.B \-\-ifconfig-push +.B \-\-ifconfig\-push directive if specified, or otherwise from the ifconfig pool (controlled by the -.B \-\-ifconfig-pool +.B \-\-ifconfig\-pool config file directive). This option is set on the server prior to execution of the -.B \-\-client-connect +.B \-\-client\-connect and -.B \-\-client-disconnect +.B \-\-client\-disconnect scripts. .\"********************************************************* .TP @@ -5896,7 +6003,7 @@ Set on program initiation and reset on SIGHUP. .B password The password provided by a connecting client. Set prior to -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script execution only when the .B via-env modifier is specified, and deleted from the environment @@ -5937,7 +6044,7 @@ script execution. The default gateway used by .B \-\-route options, as specified in either the -.B \-\-route-gateway +.B \-\-route\-gateway option or the second parameter to .B \-\-ifconfig when @@ -5988,7 +6095,7 @@ or configuration file. .TP .B peer_cert Temporary file name containing the client certificate upon -connection. Useful in conjunction with --tls-verify +connection. Useful in conjunction with \-\-tls\-verify .\"********************************************************* .TP .B script_context @@ -6016,11 +6123,11 @@ The reason for exit or restart. Can be one of option), .B ping-exit (controlled by -.B \-\-ping-exit +.B \-\-ping\-exit option), .B ping-restart (controlled by -.B \-\-ping-restart +.B \-\-ping\-restart option), .B connection-reset (triggered on TCP connection reset), @@ -6034,7 +6141,7 @@ or Client connection timestamp, formatted as a human-readable time string. Set prior to execution of the -.B \-\-client-connect +.B \-\-client\-connect script. .\"********************************************************* .TP @@ -6042,7 +6149,7 @@ script. The duration (in seconds) of the client session which is now disconnecting. Set prior to execution of the -.B \-\-client-disconnect +.B \-\-client\-disconnect script. .\"********************************************************* .TP @@ -6050,7 +6157,7 @@ script. Client connection timestamp, formatted as a unix integer date/time value. Set prior to execution of the -.B \-\-client-connect +.B \-\-client\-connect script. .\"********************************************************* .TP @@ -6060,7 +6167,7 @@ where .B n is the verification level. Only set for TLS connections. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify script. .\"********************************************************* .TP @@ -6070,7 +6177,7 @@ where .B n is the verification level. Only set for TLS connections. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify script. .\"********************************************************* .TP @@ -6080,7 +6187,7 @@ where .B n is the verification level. Only set for TLS connections. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify script. This is in the form of a decimal string like "933971680", which is suitable for doing serial-based OCSP queries (with OpenSSL, do not prepend "0x" to the string) If something goes wrong while reading @@ -6107,9 +6214,9 @@ script execution. .B trusted_ip (or trusted_ip6) Actual IP address of connecting client or peer which has been authenticated. Set prior to execution of -.B \-\-ipchange, \-\-client-connect, +.B \-\-ipchange, \-\-client\-connect, and -.B \-\-client-disconnect +.B \-\-client\-disconnect scripts. If using ipv6 endpoints (udp6, tcp6), .B trusted_ip6 @@ -6119,9 +6226,9 @@ will be set instead. .B trusted_port Actual port number of connecting client or peer which has been authenticated. Set prior to execution of -.B \-\-ipchange, \-\-client-connect, +.B \-\-ipchange, \-\-client\-connect, and -.B \-\-client-disconnect +.B \-\-client\-disconnect scripts. .\"********************************************************* .TP @@ -6130,12 +6237,12 @@ Actual IP address of connecting client or peer which has not been authenticated yet. Sometimes used to .B nmap the connecting host in a -.B \-\-tls-verify +.B \-\-tls\-verify script to ensure it is firewalled properly. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify and -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify scripts. If using ipv6 endpoints (udp6, tcp6), .B untrusted_ip6 @@ -6146,16 +6253,16 @@ will be set instead. Actual port number of connecting client or peer which has not been authenticated yet. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify and -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify scripts. .\"********************************************************* .TP .B username The username provided by a connecting client. Set prior to -.B \-\-auth-user-pass-verify +.B \-\-auth\-user\-pass\-verify script execution only when the .B via-env modifier is specified. @@ -6167,7 +6274,7 @@ where .B n is the verification level. Only set for TLS connections. Set prior to execution of -.B \-\-tls-verify +.B \-\-tls\-verify script. This variable is similar to .B tls_id_{n} except the component X509 subject fields are broken out, and @@ -6198,9 +6305,9 @@ X509_1_C=KG .\"********************************************************* .SH INLINE FILE SUPPORT OpenVPN allows including files in the main configuration for the -.B \-\-ca, \-\-cert, \-\-dh, \-\-extra-certs, \-\-key, \-\-pkcs12, \-\-secret +.B \-\-ca, \-\-cert, \-\-dh, \-\-extra\-certs, \-\-key, \-\-pkcs12, \-\-secret and -.B \-\-tls-auth +.B \-\-tls\-auth options. Each inline file started by the line @@ -6225,7 +6332,7 @@ Here is an example of an inline file usage When using the inline file feature with .B \-\-pkcs12 the inline file has to be base64 encoded. Encoding of a .p12 file into base64 can be done for example with OpenSSL by running -.B openssl base64 -in input.p12 +.B openssl base64 \-in input.p12 .SH SIGNALS .TP @@ -6242,18 +6349,18 @@ Like except don't re-read configuration file, and possibly don't close and reopen TUN/TAP device, re-read key files, preserve local IP address/port, or preserve most recently authenticated remote IP address/port based on -.B \-\-persist-tun, \-\-persist-key, \-\-persist-local-ip, +.B \-\-persist\-tun, \-\-persist\-key, \-\-persist\-local\-ip, and -.B \-\-persist-remote-ip +.B \-\-persist\-remote\-ip options respectively (see above). This signal may also be internally generated by a timeout condition, governed by the -.B \-\-ping-restart +.B \-\-ping\-restart option. This signal, when combined with -.B \-\-persist-remote-ip, +.B \-\-persist\-remote\-ip, may be sent when the underlying parameters of the host's network interface change such as when the host is a DHCP client and is assigned a new IP address. @@ -6323,7 +6430,7 @@ without an explicit firewall rule). If you are using a Linux iptables-based firewall, you may need to enter the following command to allow incoming packets on the TUN device: .IP -.B iptables -A INPUT -i tun+ -j ACCEPT +.B iptables \-A INPUT \-i tun+ \-j ACCEPT .LP See the firewalls section below for more information on configuring firewalls for use with OpenVPN. @@ -6464,11 +6571,11 @@ parameters you can use the included file dh1024.pem. .LP On may: .IP -.B openvpn \-\-remote june.kg \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-tls-client \-\-ca ca.crt \-\-cert client.crt \-\-key client.key \-\-reneg-sec 60 \-\-verb 5 +.B openvpn \-\-remote june.kg \-\-dev tun1 \-\-ifconfig 10.4.0.1 10.4.0.2 \-\-tls\-client \-\-ca ca.crt \-\-cert client.crt \-\-key client.key \-\-reneg\-sec 60 \-\-verb 5 .LP On june: .IP -.B openvpn \-\-remote may.kg \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-tls-server \-\-dh dh1024.pem \-\-ca ca.crt \-\-cert server.crt \-\-key server.key \-\-reneg-sec 60 \-\-verb 5 +.B openvpn \-\-remote may.kg \-\-dev tun1 \-\-ifconfig 10.4.0.2 10.4.0.1 \-\-tls\-server \-\-dh dh1024.pem \-\-ca ca.crt \-\-cert server.crt \-\-key server.key \-\-reneg\-sec 60 \-\-verb 5 .LP Now verify the tunnel is working by pinging across the tunnel. .LP @@ -6481,7 +6588,7 @@ On june: .B ping 10.4.0.1 .LP Notice the -.B \-\-reneg-sec 60 +.B \-\-reneg\-sec 60 option we used above. That tells OpenVPN to renegotiate the data channel keys every minute. Since we used @@ -6490,7 +6597,7 @@ above, you will see status information on each new key negotiation. For production operations, a key renegotiation interval of 60 seconds is probably too frequent. Omit the -.B \-\-reneg-sec 60 +.B \-\-reneg\-sec 60 option to use OpenVPN's default key renegotiation interval of one hour. .\"********************************************************* .SS Routing: @@ -6510,15 +6617,15 @@ On Linux, enable routing: .LP and enable TUN packet forwarding through the firewall: .IP -.B iptables -A FORWARD -i tun+ -j ACCEPT +.B iptables \-A FORWARD \-i tun+ \-j ACCEPT .LP On may: .IP -.B route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.4.0.2 +.B route add \-net 10.0.1.0 netmask 255.255.255.0 gw 10.4.0.2 .LP On june: .IP -.B route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.4.0.1 +.B route add \-net 10.0.0.0 netmask 255.255.255.0 gw 10.4.0.1 .LP Now any machine on the 10.0.0.0/24 subnet can access any machine on the 10.0.1.0/24 subnet @@ -6534,7 +6641,7 @@ OpenVPN's usage of a single UDP port makes it fairly firewall-friendly. You should add an entry to your firewall rules to allow incoming OpenVPN packets. On Linux 2.4+: .IP -.B iptables -A INPUT -p udp -s 1.2.3.4 \-\-dport 1194 -j ACCEPT +.B iptables \-A INPUT \-p udp \-s 1.2.3.4 \-\-dport 1194 \-j ACCEPT .LP This will allow incoming packets on UDP port 1194 (OpenVPN's default UDP port) from an OpenVPN peer at 1.2.3.4. @@ -6545,7 +6652,7 @@ address can be considered optional, since HMAC packet authentication is a much more secure method of verifying the authenticity of a packet source. In that case: .IP -.B iptables -A INPUT -p udp \-\-dport 1194 -j ACCEPT +.B iptables \-A INPUT \-p udp \-\-dport 1194 \-j ACCEPT .LP would be adequate and would not render the host inflexible with respect to its peer having a dynamic IP address. @@ -6567,20 +6674,20 @@ firewall rules. You should also add firewall rules to allow incoming IP traffic on TUN or TAP devices such as: .IP -.B iptables -A INPUT -i tun+ -j ACCEPT +.B iptables \-A INPUT \-i tun+ \-j ACCEPT .LP to allow input packets from tun devices, .IP -.B iptables -A FORWARD -i tun+ -j ACCEPT +.B iptables \-A FORWARD \-i tun+ \-j ACCEPT .LP to allow input packets from tun devices to be forwarded to other hosts on the local network, .IP -.B iptables -A INPUT -i tap+ -j ACCEPT +.B iptables \-A INPUT \-i tap+ \-j ACCEPT .LP to allow input packets from tap devices, and .IP -.B iptables -A FORWARD -i tap+ -j ACCEPT +.B iptables \-A FORWARD \-i tap+ \-j ACCEPT .LP to allow input packets from tap devices to be forwarded to other hosts on the local network. diff --git a/include/Makefile.in b/include/Makefile.in index 8bffd21..a8b2963 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -246,6 +246,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -350,9 +352,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/Makefile + $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/ltmain.sh b/ltmain.sh index a356aca..bffda54 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1" +VERSION="2.4.2 Debian-2.4.2-1.11" TIMESTAMP="" package_revision=1.3337 diff --git a/sample/Makefile.in b/sample/Makefile.in index 4e14709..2db1b3d 100644 --- a/sample/Makefile.in +++ b/sample/Makefile.in @@ -227,6 +227,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -342,9 +344,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sample/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sample/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu sample/Makefile + $(AUTOMAKE) --foreign sample/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/sample/sample-config-files/client.conf b/sample/sample-config-files/client.conf index 58b2038..050ef60 100644 --- a/sample/sample-config-files/client.conf +++ b/sample/sample-config-files/client.conf @@ -89,18 +89,19 @@ ca ca.crt cert client.crt key client.key -# Verify server certificate by checking -# that the certicate has the nsCertType -# field set to "server". This is an -# important precaution to protect against +# Verify server certificate by checking that the +# certicate has the correct key usage set. +# This is an important precaution to protect against # a potential attack discussed here: # http://openvpn.net/howto.html#mitm # # To use this feature, you will need to generate -# your server certificates with the nsCertType -# field set to "server". The build-key-server -# script in the easy-rsa folder will do this. -ns-cert-type server +# your server certificates with the keyUsage set to +# digitalSignature, keyEncipherment +# and the extendedKeyUsage to +# serverAuth +# EasyRSA can do this for you. +remote-cert-tls server # If a tls-auth key is used on the server # then every client must also have the key. diff --git a/sample/sample-config-files/loopback-client b/sample/sample-config-files/loopback-client index d7f59e6..ebbd1cf 100644 --- a/sample/sample-config-files/loopback-client +++ b/sample/sample-config-files/loopback-client @@ -17,9 +17,9 @@ dev null verb 3 reneg-sec 10 tls-client +remote-cert-tls server ca sample-keys/ca.crt key sample-keys/client.key cert sample-keys/client.crt -cipher DES-EDE3-CBC ping 1 inactive 120 10000000 diff --git a/sample/sample-config-files/loopback-server b/sample/sample-config-files/loopback-server index 9d21bce..8cb97be 100644 --- a/sample/sample-config-files/loopback-server +++ b/sample/sample-config-files/loopback-server @@ -17,10 +17,9 @@ dev null verb 3 reneg-sec 10 tls-server -dh sample-keys/dh1024.pem +dh sample-keys/dh2048.pem ca sample-keys/ca.crt key sample-keys/server.key cert sample-keys/server.crt -cipher DES-EDE3-CBC ping 1 inactive 120 10000000 diff --git a/sample/sample-config-files/server.conf b/sample/sample-config-files/server.conf index 467d5b8..701be3c 100644 --- a/sample/sample-config-files/server.conf +++ b/sample/sample-config-files/server.conf @@ -81,10 +81,8 @@ key server.key # This file should be kept secret # Diffie hellman parameters. # Generate your own with: -# openssl dhparam -out dh1024.pem 1024 -# Substitute 2048 for 1024 if you are using -# 2048 bit keys. -dh dh1024.pem +# openssl dhparam -out dh2048.pem 2048 +dh dh2048.pem # Network topology # Should be subnet (addressing via IP) diff --git a/sample/sample-config-files/tls-office.conf b/sample/sample-config-files/tls-office.conf index f790f46..d196144 100644 --- a/sample/sample-config-files/tls-office.conf +++ b/sample/sample-config-files/tls-office.conf @@ -26,7 +26,7 @@ up ./office.up tls-server # Diffie-Hellman Parameters (tls-server only) -dh dh1024.pem +dh dh2048.pem # Certificate Authority file ca my-ca.crt diff --git a/sample/sample-keys/.gitignore b/sample/sample-keys/.gitignore new file mode 100644 index 0000000..f148752 --- /dev/null +++ b/sample/sample-keys/.gitignore @@ -0,0 +1 @@ +sample-ca/ diff --git a/sample/sample-keys/README b/sample/sample-keys/README index 1cd473a..66dd945 100644 --- a/sample/sample-keys/README +++ b/sample/sample-keys/README @@ -1,14 +1,19 @@ -Sample RSA keys. +Sample RSA and EC keys. -See the examples section of the man page -for usage examples. +Run ./gen-sample-keys.sh to generate fresh test keys. + +See the examples section of the man page for usage examples. NOTE: THESE KEYS ARE FOR TESTING PURPOSES ONLY. DON'T USE THEM FOR ANY REAL WORK BECAUSE THEY ARE TOTALLY INSECURE! -ca.{crt,key} -- sample CA key/cert -client.{crt,key} -- sample client key/cert -server.{crt,key} -- sample server key/cert (nsCertType=server) -pass.{crt,key} -- sample client key/cert with password-encrypted key - password = "password" +ca.{crt,key} -- sample CA key/cert +server.{crt,key} -- sample server key/cert +client.{crt,key} -- sample client key/cert +client-pass.key -- sample client key with password-encrypted key + password = "password" +client.p12 -- sample client pkcs12 bundle + password = "password" +client-ec.{crt,key} -- sample elliptic curve client key/cert +server-ec.{crt,key} -- sample elliptic curve server key/cert diff --git a/sample/sample-keys/ca.crt b/sample/sample-keys/ca.crt index e063ccc..a11bafa 100644 --- a/sample/sample-keys/ca.crt +++ b/sample/sample-keys/ca.crt @@ -1,19 +1,35 @@ -----BEGIN CERTIFICATE----- -MIIDBjCCAm+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBmMQswCQYDVQQGEwJLRzEL +MIIGKDCCBBCgAwIBAgIJAKFO3vqQ8q6BMA0GCSqGSIb3DQEBCwUAMGYxCzAJBgNV +BAYTAktHMQswCQYDVQQIEwJOQTEQMA4GA1UEBxMHQklTSEtFSzEVMBMGA1UEChMM +T3BlblZQTi1URVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4w +HhcNMTQxMDIyMjE1OTUyWhcNMjQxMDE5MjE1OTUyWjBmMQswCQYDVQQGEwJLRzEL MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t -VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTA0MTEy -NTE0NDA1NVoXDTE0MTEyMzE0NDA1NVowZjELMAkGA1UEBhMCS0cxCzAJBgNVBAgT -Ak5BMRAwDgYDVQQHEwdCSVNIS0VLMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxITAf -BgkqhkiG9w0BCQEWEm1lQG15aG9zdC5teWRvbWFpbjCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEAqPjWJnesPu6bR/iec4FMz3opVaPdBHxg+ORKNmrnVZPh0t8/ -ZT34KXkYoI9B82scurp8UlZVXG8JdUsz+yai8ti9+g7vcuyKUtcCIjn0HLgmdPu5 -gFX25lB0pXw+XIU031dOfPvtROdG5YZN5yCErgCy7TE7zntLnkEDuRmyU6cCAwEA -AaOBwzCBwDAdBgNVHQ4EFgQUiaZg47rqPq/8ZH9MvYzSSI3gzEYwgZAGA1UdIwSB -iDCBhYAUiaZg47rqPq/8ZH9MvYzSSI3gzEahaqRoMGYxCzAJBgNVBAYTAktHMQsw -CQYDVQQIEwJOQTEQMA4GA1UEBxMHQklTSEtFSzEVMBMGA1UEChMMT3BlblZQTi1U -RVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW6CAQAwDAYDVR0T -BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBfJoiWYrYdjM0mKPEzUQk0nLYTovBP -I0es/2rfGrin1zbcFY+4dhVBd1E/StebnG+CP8r7QeEIwu7x8gYDdOLLsZn+2vBL -e4jNU1ClI6Q0L7jrzhhunQ5mAaZztVyYwFB15odYcdN2iO0tP7jtEsvrRqxICNy3 -8itzViPTf5W4sA== +VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMIICIjANBgkq +hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsJVPCqt3vtoDW2U0DII1QIh2Qs0dqh88 +8nivxAIm2LTq93e9fJhsq3P/UVYAYSeCIrekXypR0EQgSgcNTvGBMe20BoHO5yvb +GjKPmjfLj6XRotCOGy8EDl/hLgRY9efiA8wsVfuvF2q/FblyJQPR/gPiDtTmUiqF +qXa7AJmMrqFsnWppOuGd7Qc6aTsae4TF1e/gUTCTraa7NeHowDaKhdyFmEEnCYR5 +CeUsx2JlFWAH8PCrxBpHYbmGyvS0kH3+rQkaSM/Pzc2bS4ayHaOYRK5XsGq8XiNG +KTTLnSaCdPeHsI+3xMHmEh+u5Og2DFGgvyD22gde6W2ezvEKCUDrzR7bsnYqqyUy +n7LxnkPXGyvR52T06G8KzLKQRmDlPIXhzKMO07qkHmIonXTdF7YI1azwHpAtN4dS +rUe1bvjiTSoEsQPfOAyvD0RMK/CBfgEZUzAB50e/IlbZ84c0DJfUMOm4xCyft1HF +YpYeyCf5dxoIjweCPOoP426+aTXM7kqq0ieIr6YxnKV6OGGLKEY+VNZh1DS7enqV +HP5i8eimyuUYPoQhbK9xtDGMgghnc6Hn8BldPMcvz98HdTEH4rBfA3yNuCxLSNow +4jJuLjNXh2QeiUtWtkXja7ec+P7VqKTduJoRaX7cs+8E3ImigiRnvmK+npk7Nt1y +YE9hBRhSoLsCAwEAAaOB2DCB1TAdBgNVHQ4EFgQUK0DlyX319JY46S/jL9lAZMmO +BZswgZgGA1UdIwSBkDCBjYAUK0DlyX319JY46S/jL9lAZMmOBZuhaqRoMGYxCzAJ +BgNVBAYTAktHMQswCQYDVQQIEwJOQTEQMA4GA1UEBxMHQklTSEtFSzEVMBMGA1UE +ChMMT3BlblZQTi1URVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21h +aW6CCQChTt76kPKugTAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG +9w0BAQsFAAOCAgEABc77f4C4P8fIS+V8qCJmVNSDU44UZBc+D+J6ZTgW8JeOHUIj +Bh++XDg3gwat7pIWQ8AU5R7h+fpBI9n3dadyIsMHGwSogHY9Gw7di2RVtSFajEth +rvrq0JbzpwoYedMh84sJ2qI/DGKW9/Is9+O52fR+3z3dY3gNRDPQ5675BQ5CQW9I +AJgLOqzD8Q0qrXYi7HaEqzNx6p7RDTuhFgvTd+vS5d5+28Z5fm2umnq+GKHF8W5P +ylp2Js119FTVO7brusAMKPe5emc7tC2ov8OFFemQvfHR41PLryap2VD81IOgmt/J +kX/j/y5KGux5HZ3lxXqdJbKcAq4NKYQT0mCkRD4l6szaCEJ+k0SiM9DdTcBDefhR +9q+pCOyMh7d8QjQ1075mF7T+PGkZQUW1DUjEfrZhICnKgq+iEoUmM0Ee5WtRqcnu +5BTGQ2mSfc6rV+Vr+eYXqcg7Nxb3vFXYSTod1UhefonVqwdmyJ2sC79zp36Tbo2+ +65NW2WJK7KzPUyOJU0U9bcu0utvDOvGWmG+aHbymJgcoFzvZmlXqMXn97pSFn4jV +y3SLRgJXOw1QLXL2Y5abcuoBVr4gCOxxk2vBeVxOMRXNqSWZOFIF1bu/PxuDA+Sa +hEi44aHbPXt9opdssz/hdGfd8Wo7vEJrbg7c6zR6C/Akav1Rzy9oohIdgOw= -----END CERTIFICATE----- diff --git a/sample/sample-keys/ca.key b/sample/sample-keys/ca.key index b4bf792..8b11bc2 100644 --- a/sample/sample-keys/ca.key +++ b/sample/sample-keys/ca.key @@ -1,15 +1,52 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQCo+NYmd6w+7ptH+J5zgUzPeilVo90EfGD45Eo2audVk+HS3z9l -PfgpeRigj0Hzaxy6unxSVlVcbwl1SzP7JqLy2L36Du9y7IpS1wIiOfQcuCZ0+7mA -VfbmUHSlfD5chTTfV058++1E50blhk3nIISuALLtMTvOe0ueQQO5GbJTpwIDAQAB -AoGAQuVREyWp4bhhbZr2UFBOco2ws6EOLWp4kdD/uI+WSoEjlHKiDJj+GJ1CrL5K -o+4yD5MpCQf4/4FOQ0ukprfjJpDwDinTG6vzuWSLTHNiTgvksW3vy7IsNMJx97hT -4D2QOOl9HhA50Qqg70teMPYXOgLRMVsdCIV7p7zDNy4nM+ECQQDX8m5ZcQmPtUDA -38dPTfpL4U7kMB94FItJYH/Lk5kMW1/J33xymNhL+BHaG064ol9n2ubGW4XEO5t2 -qE1IOsVpAkEAyE/x/OBVSI1s75aYGlEwMd87p3qaDdtXT7WzujjRY7r8Y1ynkMU6 -GtMeneBX/lk4BY/6I+5bhAzce+hqhaXejwJBAL5Wg+c4GApf41xdogqHm7doNyYw -OHyZ9w9NDDc+uGbI30xLPSCxEe0cEXgiG6foDpm2uzRZFTWaqHPU8pFYpAkCQGNX -cpWM0/7VVK9Fqk1y8knpgfY/UWOJ4jU/0dCLGR0ywLSuYNPlXDmtdkOp3TnhGW14 -x/9F2NEWZ8pzq1B4wHUCQQC5ztD4m/rpiIpinoewUJODoeBJXYBKqx1+mdrALCq6 -ESvK1WRiusMaY3xmsdv4J2TB5iUPryELbn3jU12WGcQc ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCwlU8Kq3e+2gNb +ZTQMgjVAiHZCzR2qHzzyeK/EAibYtOr3d718mGyrc/9RVgBhJ4Iit6RfKlHQRCBK +Bw1O8YEx7bQGgc7nK9saMo+aN8uPpdGi0I4bLwQOX+EuBFj15+IDzCxV+68Xar8V +uXIlA9H+A+IO1OZSKoWpdrsAmYyuoWydamk64Z3tBzppOxp7hMXV7+BRMJOtprs1 +4ejANoqF3IWYQScJhHkJ5SzHYmUVYAfw8KvEGkdhuYbK9LSQff6tCRpIz8/NzZtL +hrIdo5hErlewarxeI0YpNMudJoJ094ewj7fEweYSH67k6DYMUaC/IPbaB17pbZ7O +8QoJQOvNHtuydiqrJTKfsvGeQ9cbK9HnZPTobwrMspBGYOU8heHMow7TuqQeYiid +dN0XtgjVrPAekC03h1KtR7Vu+OJNKgSxA984DK8PREwr8IF+ARlTMAHnR78iVtnz +hzQMl9Qw6bjELJ+3UcVilh7IJ/l3GgiPB4I86g/jbr5pNczuSqrSJ4ivpjGcpXo4 +YYsoRj5U1mHUNLt6epUc/mLx6KbK5Rg+hCFsr3G0MYyCCGdzoefwGV08xy/P3wd1 +MQfisF8DfI24LEtI2jDiMm4uM1eHZB6JS1a2ReNrt5z4/tWopN24mhFpftyz7wTc +iaKCJGe+Yr6emTs23XJgT2EFGFKguwIDAQABAoICAQCEYPqnihI0PqZjnwQdGIQp +g+P8gl7pyY9cS0OhUueicEbyDI8+V9qn0kcmx61zKDY0Jq4QNd6tnlUCijTc6Mot +DwF2G1xsC4GvKxZiy89MOkhloanXETEeQZzDbbjvaM4UgL0AHLWPfZQRCjxbKXkE +0A5phgvAr2YSvBLHCVXhGN0fScXnwXouVsvgVdGtpcTWdIUa+KrNdQBGDbz6VCkW +31I76SQFy40d8PPX6ZjUJHDvnM14LycySO6XOkofRIVnXTqaOUiVBb2VKj5fX+Ro +ILdWZz4d6J3RiGXYwyTr4SGVKLjgxWfgUGZB7x+NrqgugNzuaLYrkuWKSEN42nWq +yoP6x6xtbAsmB6Fvdqwm/d8BmLhUweaVc0L7AYzXNsOBuT3kubJHMmu3Jv4xgyWk +l/MAGJQc7i7QQweGgsYZgR8WlbkWkSFpUcgQBDzDibb6nsD2jnYijQrnrrmiEjEI +R7MO551V+nFw9utiM8U9WIWwqzY0d98ujWkGjVe7uz9ZBVyg0DEAEj/zRi9T54aG +1V6CB2Cjyw+HzzsDw7yWroWzo4U9YfjbPKCoBsXlqQFLFwY8oL6mEZ7UOobaV1Zl +WtuHyYw3UNFxuSGPPyxJkFePIQLLvfKvh2R+V0DrT3UJRoKKlt9RejRSN0tOh0Cm +2YD6d7T/DXnQHomIQKhKEQKCAQEA3sgsDg0eKDK8pUyVE+9wW5kql12nTzpBtnCM +eg5J9OJcXKhCD/NIyUTIMXoMvZQpLwGUAYLgu4gE04zKWHDouf7MRSFltD5LJ7F2 +7nuYKHZXk0BhgMhdnQot3FKcOMrKCnZcM+RWX9ZJa8wO6whCaYCw7DtS0SSVODQk +9EwAgX6/Hq60V7ujPZJCyNd3o0bIdAA/0AQRTZUADP3AHgUzh71aysYJt+UKt1v0 +Xc7l6hn7Dn7Ewzpf+WdZ2pV7d3JUSBVKiTDxLV904nDBNOxjMhz0rW01ojR6bzpn +XhkFPqnmh+yEYGRgfSAAzkvSsSJEAtBFSicupA/6n83Lo2YvswKCAQEAyumuxP4Z +a7s8x8DFba7vuQ+KVxpkKgEz1sxnGRNQJm18/ss/Y5JiaLFYT3E72VkQfBQ2ngu+ +GrJL3OhiNhzy1KLGS6mrwULtKiuud5MMQDL0Pvkncr9NTy4rBnWzhp2XyPeETu8n +JpL2i2OK6lY/lgpBckXuap9gAl0fXk+y+BkZ71OoYaGnKpPjs+Xcq/qgPgZ7O3NW +1g+Bd2AVPSxQpXjuy5rgtQURCN733vkNBzFedKREx7Z6l8UPlK/Exuc7BMIHfn5V +dd0R3Th+82fkMNVJz6MKmHJ6CJI53M7co/YdAvIkxOFRIPGbO3arL2R69nRgAZBE +zLawx1JJTRIG2QKCAQATtZXgMFzopYR3A011FAvWrrhL5+czZS4HG/Hxom38kkIl +mGUv0BAybjlf1zJlW0RBelxDvfZv4Nq8dIo6RNLyEY601v2OcqxneJXTB3AwtDeP +OXTm1dMiX5IrGcvkYlx5jHsfxCW4GNcqCEWRmYt2lgIRBDaRdjEVZdeXHVo2GqaB +6mbeFCWe/t+VsSpOcaauTI9YseNt/66fd5uVjFRAwAnWQqr9b/AAxMvbuMAyc9X4 +NFLoCrQO9ovGgM8JhD3cmrWbaY8MupM2rU8KhZdJCbLD3ROPpCDo0jvu4TvLjXBt +ugkEFh1LNJedqKudLDDkJtTaeJjxvtAnbyeC7zltAoIBAC9TIyzUqq8io0FfZ2x2 +cXiy9CvuftABKcr+L0l85KOhw5ZVZvpdKNCMFDGrEi9WA28886QWzwbA8Mqb9FP0 +mnoXYLJC50kSx+ee+nju9dt/RtHtIFM15N0DwosmJnHODZmUiOo0AuiPPCs0UzDm +Xrwqtirlvn5ln2nNuEQxyGbuy8qys0HaBvf6OBA8GySNNpRgxJsQAn+4bBSgdzOm +Q0TkmKUqASCXBusPvbXmVjCIRiRkL5p4p8z/6+tct0NAqNYqPr80zc/IeKMkyw8P ++vucszNXLmBxyp53JEGoiXNAMnH+ca7tchOB5hePTMun3rneWInk0PcB4OcL/QaZ +nrkCggEBAN67+SvcWtM1BoLXSz5/apFAE+DicCv94PrvMBOhfvu1oBrElR1rBjiN +2B83SktkF4WhCXr10GP+RUpjaqPBtT7NW4r3fL5B8EPsHeabL+pg9e6wG1rH8GqG +toWecmfC9uqK7l1A59h5Oveq5K19bZTRZRjQtv2e4KQknlJR6cwy+TGUU5kAUlMt +vcivyjzxc0UQwq7zKktJq+xW/TZiSLgd3B32p0sXX378qFUJ4SO2UZ1OCh8R7PY1 +Fx25K/89Q1yGdbYiXb/Dx0a2WB9rP+b6alMl/dxPdqDKj2QXXkdh8+yvhVpQTyZw +B1RaqQXwzqrCH0F/vw3lRceYhcQvzcQ= +-----END PRIVATE KEY----- diff --git a/sample/sample-keys/client-ec.crt b/sample/sample-keys/client-ec.crt new file mode 100644 index 0000000..759daba --- /dev/null +++ b/sample/sample-keys/client-ec.crt @@ -0,0 +1,85 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4 (0x4) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + Validity + Not Before: Oct 22 21:59:53 2014 GMT + Not After : Oct 19 21:59:53 2024 GMT + Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Client-EC/emailAddress=me@myhost.mydomain + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (256 bit) + pub: + 04:3b:ce:62:5d:6f:87:82:75:24:c2:58:f5:0e:88: + 4d:57:0d:06:b2:71:88:87:58:19:bb:de:5f:7f:52: + 62:51:a2:48:91:83:48:91:90:3e:87:02:0f:15:51: + f9:68:97:12:0a:fd:d2:3c:87:83:4b:65:54:00:44: + 8d:28:76:49:05 + ASN1 OID: secp256k1 + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + X509v3 Subject Key Identifier: + 64:F6:49:88:E7:74:C1:AB:A5:FA:4F:2B:71:3C:25:13:3D:C8:94:C5 + X509v3 Authority Key Identifier: + keyid:2B:40:E5:C9:7D:F5:F4:96:38:E9:2F:E3:2F:D9:40:64:C9:8E:05:9B + DirName:/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + serial:A1:4E:DE:FA:90:F2:AE:81 + + Signature Algorithm: sha256WithRSAEncryption + 32:3d:f0:08:67:dd:03:73:76:cc:76:52:0a:f6:97:d1:c6:fa: + 5f:d3:e6:28:c9:75:a7:08:a8:34:49:69:cf:eb:ab:da:86:b3: + 2e:65:17:ee:7e:b6:b5:6b:15:0b:dc:11:3a:b9:5a:b3:80:b8: + bb:f4:6c:cf:88:3a:10:83:7e:10:a0:82:87:6e:06:ec:78:62: + d4:d1:44:27:dd:2c:19:d8:1a:a1:ae:f4:a0:00:7f:53:5a:40: + 8a:c2:83:77:4b:26:7d:53:b0:d3:0f:2f:7c:28:70:ef:74:58: + 5b:de:81:94:4c:63:19:f0:79:cb:6c:b2:ec:32:1b:4b:e4:62: + 22:4f:ad:ac:4a:6f:a9:6e:c4:2a:8d:8a:88:19:09:fd:88:93: + 3c:27:4d:91:95:ff:57:84:13:fd:4a:68:db:20:df:10:e6:81: + 1d:fd:e7:1d:35:fb:19:02:dd:b5:5f:a0:c1:07:ec:74:b4:ef: + 8b:f9:33:9a:f2:a6:3b:6e:b6:4a:52:ab:5d:99:76:64:62:c4: + d5:3a:c6:81:8d:eb:c8:4b:02:af:e1:ca:60:e9:8d:c7:a9:2b: + ea:4f:56:31:d3:9a:11:c2:9c:83:5c:a2:8d:98:fe:cc:a5:ad: + 1f:51:c4:6e:cf:ff:a0:51:64:c8:7f:7f:32:05:4c:8d:7f:bf: + b8:ed:e5:81:5f:81:bd:1d:9b:3f:8a:83:27:26:b4:69:84:8b: + e5:d9:ea:fd:08:a8:aa:e4:3a:dc:29:4d:80:6c:13:f7:45:ce: + 92:f2:a9:f3:5f:90:83:d6:23:0f:50:e5:40:09:4c:6b:f2:73: + aa:d8:49:a7:a9:81:6e:bb:f2:e4:a5:7f:19:39:1d:65:f3:11: + 97:b1:2b:7c:2f:36:77:7f:75:fd:88:44:90:7c:f2:33:8d:cd: + 2c:f6:76:60:33:d3:f4:b3:8c:81:d7:85:89:cc:d7:d5:2c:94: + a9:31:3f:d3:63:a7:dc:82:3f:0a:d8:c5:71:97:69:3b:c1:69: + cb:f0:1b:be:15:c0:be:aa:fd:e8:13:2c:0c:3f:72:7b:7d:9c: + 3b:7f:b8:82:36:4b:ad:4d:16:19:b9:1c:b3:2d:d7:5f:8b:f8: + 14:ce:d4:13:e5:82:7a:1d:40:28:08:65:4a:19:d7:7a:35:09: + db:36:48:4b:96:44:bd:1f:12:b2:39:08:1e:5b:66:25:9b:e0: + 16:d3:79:05:e3:f6:90:da:95:95:33:a1:53:a8:3c:a9:f0:b2: + f5:d0:aa:80:a0:96:ca:8c:45:62:c2:74:04:91:68:27:fb:e9: + 97:be:3a:87:8a:85:28:2d:6e:a9:60:9b:63:ba:65:98:5e:bb: + 02:ee:ac:ba:be:f6:42:26 +-----BEGIN CERTIFICATE----- +MIIESTCCAjGgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJLRzEL +MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t +VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTE0MTAy +MjIxNTk1M1oXDTI0MTAxOTIxNTk1M1owbTELMAkGA1UEBhMCS0cxCzAJBgNVBAgT +Ak5BMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxFzAVBgNVBAMTDlRlc3QtQ2xpZW50 +LUVDMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wVjAQBgcqhkjO +PQIBBgUrgQQACgNCAAQ7zmJdb4eCdSTCWPUOiE1XDQaycYiHWBm73l9/UmJRokiR +g0iRkD6HAg8VUflolxIK/dI8h4NLZVQARI0odkkFo4HIMIHFMAkGA1UdEwQCMAAw +HQYDVR0OBBYEFGT2SYjndMGrpfpPK3E8JRM9yJTFMIGYBgNVHSMEgZAwgY2AFCtA +5cl99fSWOOkv4y/ZQGTJjgWboWqkaDBmMQswCQYDVQQGEwJLRzELMAkGA1UECBMC +TkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4tVEVTVDEhMB8G +CSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluggkAoU7e+pDyroEwDQYJKoZI +hvcNAQELBQADggIBADI98Ahn3QNzdsx2Ugr2l9HG+l/T5ijJdacIqDRJac/rq9qG +sy5lF+5+trVrFQvcETq5WrOAuLv0bM+IOhCDfhCggoduBux4YtTRRCfdLBnYGqGu +9KAAf1NaQIrCg3dLJn1TsNMPL3wocO90WFvegZRMYxnwectssuwyG0vkYiJPraxK +b6luxCqNiogZCf2IkzwnTZGV/1eEE/1KaNsg3xDmgR395x01+xkC3bVfoMEH7HS0 +74v5M5rypjtutkpSq12ZdmRixNU6xoGN68hLAq/hymDpjcepK+pPVjHTmhHCnINc +oo2Y/sylrR9RxG7P/6BRZMh/fzIFTI1/v7jt5YFfgb0dmz+KgycmtGmEi+XZ6v0I +qKrkOtwpTYBsE/dFzpLyqfNfkIPWIw9Q5UAJTGvyc6rYSaepgW678uSlfxk5HWXz +EZexK3wvNnd/df2IRJB88jONzSz2dmAz0/SzjIHXhYnM19UslKkxP9Njp9yCPwrY +xXGXaTvBacvwG74VwL6q/egTLAw/cnt9nDt/uII2S61NFhm5HLMt11+L+BTO1BPl +gnodQCgIZUoZ13o1Cds2SEuWRL0fErI5CB5bZiWb4BbTeQXj9pDalZUzoVOoPKnw +svXQqoCglsqMRWLCdASRaCf76Ze+OoeKhSgtbqlgm2O6ZZheuwLurLq+9kIm +-----END CERTIFICATE----- diff --git a/sample/sample-keys/client-ec.key b/sample/sample-keys/client-ec.key new file mode 100644 index 0000000..8131380 --- /dev/null +++ b/sample/sample-keys/client-ec.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQg2RVk/d0yok086M9bLPIi +eu4DfcBUwphOnkje1/7VSY+hRANCAAQ7zmJdb4eCdSTCWPUOiE1XDQaycYiHWBm7 +3l9/UmJRokiRg0iRkD6HAg8VUflolxIK/dI8h4NLZVQARI0odkkF +-----END PRIVATE KEY----- diff --git a/sample/sample-keys/client-pass.key b/sample/sample-keys/client-pass.key new file mode 100644 index 0000000..2bb8d4e --- /dev/null +++ b/sample/sample-keys/client-pass.key @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,ECC1F209896FC2621233FFF6F1FFD045 + +i6t7VKTyNNELTvrBO464e02nFg9rvYwumxd0sfqcPtaKmRK2mrZmEd/Xh0Nv1WyB +PyuJo78qQixAtxObRbkSNINzTr5C8IDrE6+wQYCJinvO54U0o+ksv0tsyLngz1cb +is8ZqHXrRgJ3qGFQWmFRtFKFQvSXOTDX3fLkEB53HfeblQCxBCnJ82Sp7ivnVR/j +Q8qQRy1RMbzIN0trEGf0Zi4tHEvXL1u7Y+olQzSlmWWaQt20hhXUOMLhMtlRsAo7 +AwjlE94JjAfJ1q1dwIcRN4c9Lk8GkiX6w7nDpRACDpk2S8ifCqi69eGe4+g7owhL +74bgs64PmM9a2sNXy1v6WE3c/t6sSrZiMvrGsqMo4sBlrQ9WXe0Naon7heBkPcdS +px0YJjnyBXHMIH+ASmALSJ5JXq9vt2xRFf0dOsGapxhP+7bZJ5Pwyk/yUu5uHFbM +/aBemlrZJzlKeYiiwpwx2whQAtDwN41zMG+r27EzSU/AaDV40NPiwwycpWt/Bp1e +z1ag0JuS0an+PK4jmREtzT5U5BeAVM91x8YttOPpmUIpahAa1zwdYPRAIkbmPJ4z +ZH+9YoPH4hoBQKdIhshYktjdI++xNiKXAUGUz5YoX8S68SsLdmKvhnQ7fu5VvOkA +2pb7taXGy7zfn+a/fWauhuceV9HPlAXMIu3GsssODoNly3vpcFeiMySKppygJ3Eg +A3o9n8UepD+jXflKG/R/t7U3hT6LqSIvQWqBqYMEVFMCNzSsJ/ce/4veFvx343zT +qdxuzYqyiXM74cynpfqHdVa9SFICTesNdVDI0FdOXhSQ4bHJc7Xp9FFJdS0lMRw4 +ACwKxvs8lo4Gx1WFyCqH5OxosKtDHQYzdUJfSWVJlhhOFR3GncR9qSe3O5fkhJfs +TALnC+xTJyCkSB2k0/bxVLIhlkPdCwzsrN/B6X2CDBdg0mQIo0LaPzGF8VneM20d +XebYn751XSiL3HKyq8G5AEFwj9AO3Q8gKuP2fPoWdngJ2GT+mt1m2fIw9Igu39J0 +ZMegyUN0wSIiA5AkgryK9U+PJEiJmLzOJ/NGr7E5tPF18eZWapK4KZ8TXC4RNiye +g+apGa+xZJz2VQp/Mrcdj9D4UDJFQjrvKaS0PXJDoYUXFBoMv3rxijzRVxlhhuJY +yZ0At+UqZD5wpuWW6DRrgJIpy0HNhbaLmgsU0Co0HKviB0x8hvMJbi/uCoPTOdPz +sPB7CN2i3oXe7xw1HfSTSFWb4leqjlKwNgfV42ox0QUjkkADeeuY+56g/B2+QmdE +vXrc6sDwfNUwRUzeMn8yfum/aW1y/wrqF/qPTBQqFd85vlzS+NfXIKDg04cAljTu ++2BLzvizh9Bb68iG4PykNXbjbAir1EbQG1tCzq1eKhERjgrxdv6+XqAmvchMCeL5 +L6hvfQFBPCo/4xnMpU5wooFarO/kGdKlGr5rXOydgfL618Td18BIX+FHQFb3zzVU +y2NR4++DslJAZgAU+512zzpW1m3JtaRoyqyoLE2YFPlW804Xc1PBB3Ix6Wyzcegy +D4qMk5qxjBkXEsBBSCYfVbWoMBeMhnvxkz0b9wkPtAW/jEJCB2Kkn/5yMC0DkePO +-----END RSA PRIVATE KEY----- diff --git a/sample/sample-keys/client.crt b/sample/sample-keys/client.crt index c047446..1744cb2 100644 --- a/sample/sample-keys/client.crt +++ b/sample/sample-keys/client.crt @@ -2,64 +2,102 @@ Certificate: Data: Version: 3 (0x2) Serial Number: 2 (0x2) - Signature Algorithm: md5WithRSAEncryption + Signature Algorithm: sha256WithRSAEncryption Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain Validity - Not Before: Nov 25 14:46:49 2004 GMT - Not After : Nov 23 14:46:49 2014 GMT + Not Before: Oct 22 21:59:53 2014 GMT + Not After : Oct 19 21:59:53 2024 GMT Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Client/emailAddress=me@myhost.mydomain Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:d2:12:5c:c6:4d:13:34:ae:cf:fa:ab:fe:cb:de: - 8c:f1:4b:4a:95:28:60:87:82:2c:b8:c1:e5:8e:c6: - 5d:11:58:61:a4:a5:f1:42:d7:86:74:6c:9d:9c:7a: - f0:3a:5c:29:e6:53:3b:5e:6d:d8:f0:45:06:2c:23: - ee:09:bc:02:8f:0e:b8:d5:33:1f:c3:4a:11:02:48: - 0b:cc:4b:ad:6e:74:e0:a2:53:b1:d6:cc:89:b9:e2: - 6f:db:15:b3:19:1e:57:04:79:48:3a:da:76:31:fc: - bf:d3:34:21:e7:32:d8:9e:06:4e:be:f3:e3:79:b0: - 54:fd:d1:42:32:aa:3e:7a:c1 + Public-Key: (2048 bit) + Modulus: + 00:ec:65:8f:e9:12:c2:1a:5b:e6:56:2a:08:a9:82: + 3a:2d:44:78:a3:00:3b:b0:9f:e7:27:10:40:93:ef: + f1:cc:3e:a0:aa:04:a2:80:1b:13:a9:e6:fe:81:d6: + 70:90:a8:d8:d4:de:30:d8:35:00:d2:be:62:f0:48: + da:fc:15:8d:c4:c6:6d:0b:99:f1:2b:83:00:0a:d3: + 2a:23:0b:e5:cd:f9:35:df:43:61:15:72:ad:95:98: + f6:73:21:41:5e:a0:dd:47:27:a0:d5:9a:d4:41:a8: + 1c:1d:57:20:71:17:8f:f7:28:9e:3e:07:ce:ec:d5: + 0e:42:4f:1e:74:47:8e:47:9d:d2:14:28:27:2c:14: + 10:f5:d1:96:b5:93:74:84:ef:f9:04:de:8d:4a:6f: + df:77:ab:ea:d1:58:d3:44:fe:5a:04:01:ff:06:7a: + 97:f7:fd:e3:57:48:e1:f0:df:40:13:9f:66:23:5a: + e3:55:54:3d:54:39:ee:00:f9:12:f1:d2:df:74:2e: + ba:d7:f0:8d:c6:dd:18:58:1c:93:22:0b:75:fa:a8: + d6:e0:b5:2f:2d:b9:d4:fe:b9:4f:86:e2:75:48:16: + 60:fb:3f:c9:b4:30:42:29:fb:3b:b3:2b:b9:59:81: + 6a:46:f3:45:83:bf:fd:d5:1a:ff:37:0c:6f:5b:fd: + 61:f1 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate X509v3 Subject Key Identifier: - 17:B7:3F:C7:62:A0:A9:FD:A4:31:0E:58:D7:D9:94:7B:4B:3F:CB:56 + D2:B4:36:0F:B1:FC:DD:A5:EA:2A:F7:C7:23:89:FA:E3:FA:7A:44:1D X509v3 Authority Key Identifier: - keyid:89:A6:60:E3:BA:EA:3E:AF:FC:64:7F:4C:BD:8C:D2:48:8D:E0:CC:46 + keyid:2B:40:E5:C9:7D:F5:F4:96:38:E9:2F:E3:2F:D9:40:64:C9:8E:05:9B DirName:/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain - serial:00 + serial:A1:4E:DE:FA:90:F2:AE:81 - Signature Algorithm: md5WithRSAEncryption - 61:c6:d1:fa:24:0f:c7:be:09:3b:d8:04:17:63:31:17:07:f9: - 56:99:af:4c:67:fa:db:cb:94:cf:55:a5:7b:16:20:8b:42:64: - 13:23:62:45:28:93:5e:36:f7:db:02:95:a1:e9:fd:e3:0f:8d: - 73:a1:7b:0e:55:78:4d:a5:c4:b7:22:12:a0:ee:55:e0:b8:0e: - c9:9b:12:e3:b0:ef:9b:68:93:57:6e:6c:ad:16:68:8e:8d:30: - 33:fe:2a:1b:c3:03:8f:b6:0a:2d:0c:b1:3c:bb:f9:58:3f:8c: - 81:59:6b:14:dd:62:b5:c2:93:ed:5d:c6:19:0f:9b:4b:52:b3: - 7c:78 + Signature Algorithm: sha256WithRSAEncryption + 7f:e0:fe:84:a7:ec:df:62:a5:cd:3c:c1:e6:42:b1:31:12:f0: + b9:da:a7:9e:3f:bd:96:52:b6:fc:55:74:64:3e:e4:ff:7e:aa: + f7:3e:06:18:5f:73:85:f8:c8:e0:67:1b:4d:97:ca:05:d0:37: + 07:33:64:9b:e6:78:77:14:9a:55:bb:2a:ac:c3:7f:c9:15:08: + 83:5c:c8:c2:61:d3:71:4c:05:0b:2b:cb:a3:87:6d:a0:32:ed: + b0:b3:27:97:4a:55:8d:01:2a:30:56:68:ab:f2:da:5c:10:73: + c9:aa:0a:9c:4b:4c:a0:5b:51:6e:0a:7e:6c:53:80:b0:00:e1: + 1e:9a:4c:0a:37:9e:20:89:bc:c5:e5:79:58:b7:45:ff:d3:c4: + a1:fd:d9:78:3d:45:16:74:df:82:44:1d:1d:81:50:5a:b9:32: + 4c:e2:4f:3f:0e:3a:65:5a:64:83:3b:29:31:c4:99:88:bc:c5: + 84:39:f2:19:12:e1:66:d0:ea:fb:75:b1:d2:27:be:91:59:a3: + 2b:09:d5:5c:bf:46:8e:d6:67:d6:0b:ec:da:ab:f0:80:19:87: + 64:07:a9:77:b1:5e:0c:e2:c5:1d:6a:ac:5d:23:f3:30:75:36: + 4e:ca:c3:4e:b0:4d:8c:2c:ce:52:61:63:de:d5:f5:ef:ef:0a: + 6b:23:25:26:3c:3a:f2:c3:c2:16:19:3f:a9:32:ba:68:f9:c9: + 12:3c:3e:c6:1f:ff:9b:4e:f4:90:b0:63:f5:d1:33:00:30:5a: + e8:24:fa:35:44:9b:6a:80:f3:a6:cc:7b:3c:73:5f:50:c4:30: + 71:d8:74:90:27:0a:01:4e:a5:5e:b1:f8:da:c2:61:81:11:ae: + 29:a3:8f:fa:7e:4c:4e:62:b1:00:de:92:e3:8f:6a:2e:da:d9: + 38:5d:6b:7c:0d:e4:01:aa:c8:c6:6d:8b:cd:c0:c8:6e:e4:57: + 21:8a:f6:46:30:d9:ad:51:a1:87:96:a6:53:c9:1e:c6:bb:c3: + eb:55:fe:8c:d6:5c:d5:c6:f3:ca:b0:60:d2:d4:2a:1f:88:94: + d3:4c:1a:da:0c:94:fe:c1:5d:0d:2a:db:99:29:5d:f6:dd:16: + c4:c8:4d:74:9e:80:d9:d0:aa:ed:7b:e3:30:e4:47:d8:f5:15: + c1:71:b8:c6:fd:ee:fc:9e:b2:5f:b5:b7:92:ed:ff:ca:37:f6: + c7:82:b4:54:13:9b:83:cd:87:8b:7e:64:f6:2e:54:3a:22:b1: + c5:c1:f4:a5:25:53:9a:4d:a8:0f:e7:35:4b:89:df:19:83:66: + 64:d9:db:d1:61:2b:24:1b:1d:44:44:fb:49:30:87:b7:49:23: + 08:02:8a:e0:25:f3:f4:43 -----BEGIN CERTIFICATE----- -MIIDNTCCAp6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBmMQswCQYDVQQGEwJLRzEL +MIIFFDCCAvygAwIBAgIBAjANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJLRzEL MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t -VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTA0MTEy -NTE0NDY0OVoXDTE0MTEyMzE0NDY0OVowajELMAkGA1UEBhMCS0cxCzAJBgNVBAgT +VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTE0MTAy +MjIxNTk1M1oXDTI0MTAxOTIxNTk1M1owajELMAkGA1UEBhMCS0cxCzAJBgNVBAgT Ak5BMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxFDASBgNVBAMTC1Rlc3QtQ2xpZW50 -MSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wgZ8wDQYJKoZIhvcN -AQEBBQADgY0AMIGJAoGBANISXMZNEzSuz/qr/svejPFLSpUoYIeCLLjB5Y7GXRFY -YaSl8ULXhnRsnZx68DpcKeZTO15t2PBFBiwj7gm8Ao8OuNUzH8NKEQJIC8xLrW50 -4KJTsdbMibnib9sVsxkeVwR5SDradjH8v9M0Iecy2J4GTr7z43mwVP3RQjKqPnrB -AgMBAAGjge4wgeswCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH -ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFBe3P8dioKn9pDEOWNfZlHtL -P8tWMIGQBgNVHSMEgYgwgYWAFImmYOO66j6v/GR/TL2M0kiN4MxGoWqkaDBmMQsw -CQYDVQQGEwJLRzELMAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNV -BAoTDE9wZW5WUE4tVEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9t -YWluggEAMA0GCSqGSIb3DQEBBAUAA4GBAGHG0fokD8e+CTvYBBdjMRcH+VaZr0xn -+tvLlM9VpXsWIItCZBMjYkUok14299sClaHp/eMPjXOhew5VeE2lxLciEqDuVeC4 -DsmbEuOw75tok1dubK0WaI6NMDP+KhvDA4+2Ci0MsTy7+Vg/jIFZaxTdYrXCk+1d -xhkPm0tSs3x4 +MSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDsZY/pEsIaW+ZWKgipgjotRHijADuwn+cnEECT +7/HMPqCqBKKAGxOp5v6B1nCQqNjU3jDYNQDSvmLwSNr8FY3Exm0LmfErgwAK0yoj +C+XN+TXfQ2EVcq2VmPZzIUFeoN1HJ6DVmtRBqBwdVyBxF4/3KJ4+B87s1Q5CTx50 +R45HndIUKCcsFBD10Za1k3SE7/kE3o1Kb993q+rRWNNE/loEAf8Gepf3/eNXSOHw +30ATn2YjWuNVVD1UOe4A+RLx0t90LrrX8I3G3RhYHJMiC3X6qNbgtS8tudT+uU+G +4nVIFmD7P8m0MEIp+zuzK7lZgWpG80WDv/3VGv83DG9b/WHxAgMBAAGjgcgwgcUw +CQYDVR0TBAIwADAdBgNVHQ4EFgQU0rQ2D7H83aXqKvfHI4n64/p6RB0wgZgGA1Ud +IwSBkDCBjYAUK0DlyX319JY46S/jL9lAZMmOBZuhaqRoMGYxCzAJBgNVBAYTAktH +MQswCQYDVQQIEwJOQTEQMA4GA1UEBxMHQklTSEtFSzEVMBMGA1UEChMMT3BlblZQ +Ti1URVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW6CCQChTt76 +kPKugTANBgkqhkiG9w0BAQsFAAOCAgEAf+D+hKfs32KlzTzB5kKxMRLwudqnnj+9 +llK2/FV0ZD7k/36q9z4GGF9zhfjI4GcbTZfKBdA3BzNkm+Z4dxSaVbsqrMN/yRUI +g1zIwmHTcUwFCyvLo4dtoDLtsLMnl0pVjQEqMFZoq/LaXBBzyaoKnEtMoFtRbgp+ +bFOAsADhHppMCjeeIIm8xeV5WLdF/9PEof3ZeD1FFnTfgkQdHYFQWrkyTOJPPw46 +ZVpkgzspMcSZiLzFhDnyGRLhZtDq+3Wx0ie+kVmjKwnVXL9GjtZn1gvs2qvwgBmH +ZAepd7FeDOLFHWqsXSPzMHU2TsrDTrBNjCzOUmFj3tX17+8KayMlJjw68sPCFhk/ +qTK6aPnJEjw+xh//m070kLBj9dEzADBa6CT6NUSbaoDzpsx7PHNfUMQwcdh0kCcK +AU6lXrH42sJhgRGuKaOP+n5MTmKxAN6S449qLtrZOF1rfA3kAarIxm2LzcDIbuRX +IYr2RjDZrVGhh5amU8kexrvD61X+jNZc1cbzyrBg0tQqH4iU00wa2gyU/sFdDSrb +mSld9t0WxMhNdJ6A2dCq7XvjMORH2PUVwXG4xv3u/J6yX7W3ku3/yjf2x4K0VBOb +g82Hi35k9i5UOiKxxcH0pSVTmk2oD+c1S4nfGYNmZNnb0WErJBsdRET7STCHt0kj +CAKK4CXz9EM= -----END CERTIFICATE----- diff --git a/sample/sample-keys/client.key b/sample/sample-keys/client.key index 17b9509..6d31489 100644 --- a/sample/sample-keys/client.key +++ b/sample/sample-keys/client.key @@ -1,15 +1,28 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDSElzGTRM0rs/6q/7L3ozxS0qVKGCHgiy4weWOxl0RWGGkpfFC -14Z0bJ2cevA6XCnmUztebdjwRQYsI+4JvAKPDrjVMx/DShECSAvMS61udOCiU7HW -zIm54m/bFbMZHlcEeUg62nYx/L/TNCHnMtieBk6+8+N5sFT90UIyqj56wQIDAQAB -AoGBAK8RoIGekCfym99DYYfTg9A/t/tQeAnWYaDj7oSrKbqf1lgZ91OGPEZgkoVr -KzLnxf9uU+bhUs8CJx+4HdO8/L9rAJA+oD9QNuMp0elN4AKuEGE1Eq3a0e3cmgPI -+VIoXM6WVAGgK9I03Zu/UerYQ/DdXWGOIsKhFe8qyQoG9pKxAkEA9ld6O9MHQt3d -JAjJkgCNn4psozxjrfLWy2huXd3H3CRqGMjLITDGzdkVSgXjHokBYroi0+TZTu4M -ulJSJaWwBQJBANpO2DAexH2zRHw5Z6QyeEVxz7B3/FzU4GgJx9BH+FSBh+F0G5Ln -ir5Vst8vZ/LGcgpYjHQLNAvZVgUjiQ4Y6I0CQGvwMJL+CHR4GmmroAblTyjU0n1D -/Lk/anZ+L73Za7U+D28ErFzCrpmLwRRKOBYtGfpUbOZDpCQ9kj4hy/TLALECQCcL -9ysUNbzt9Y/qjJkX1d9F7gn4TBEmmkTBixW76bTjvjQbGlt6Qpyso2O8DPGlgPxM -vkJ7RoHgC7y7kGYPGnkCQBVxSNGIjLx4NQBgN4HD0y4+fars1PTUGnckBcS4npb9 -onLNyerBlWdBwbARyBS7WPIbyyf5VCrn3yIqWxaARO0= ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDsZY/pEsIaW+ZW +KgipgjotRHijADuwn+cnEECT7/HMPqCqBKKAGxOp5v6B1nCQqNjU3jDYNQDSvmLw +SNr8FY3Exm0LmfErgwAK0yojC+XN+TXfQ2EVcq2VmPZzIUFeoN1HJ6DVmtRBqBwd +VyBxF4/3KJ4+B87s1Q5CTx50R45HndIUKCcsFBD10Za1k3SE7/kE3o1Kb993q+rR +WNNE/loEAf8Gepf3/eNXSOHw30ATn2YjWuNVVD1UOe4A+RLx0t90LrrX8I3G3RhY +HJMiC3X6qNbgtS8tudT+uU+G4nVIFmD7P8m0MEIp+zuzK7lZgWpG80WDv/3VGv83 +DG9b/WHxAgMBAAECggEBAIOdaCpUD02trOh8LqZxowJhBOl7z7/ex0uweMPk67LT +i5AdVHwOlzwZJ8oSIknoOBEMRBWcLQEojt1JMuL2/R95emzjIKshHHzqZKNulFvB +TIUpdnwChTKtH0mqUkLlPU3Ienty4IpNlpmfUKimfbkWHERdBJBHbtDsTABhdo3X +9pCF/yRKqJS2Fy/Mkl3gv1y/NB1OL4Jhl7vQbf+kmgfQN2qdOVe2BOKQ8NlPUDmE +/1XNIDaE3s6uvUaoFfwowzsCCwN2/8QrRMMKkjvV+lEVtNmQdYxj5Xj5IwS0vkK0 +6icsngW87cpZxxc1zsRWcSTloy5ohub4FgKhlolmigECgYEA+cBlxzLvaMzMlBQY +kCac9KQMvVL+DIFHlZA5i5L/9pRVp4JJwj3GUoehFJoFhsxnKr8HZyLwBKlCmUVm +VxnshRWiAU18emUmeAtSGawlAS3QXhikVZDdd/L20YusLT+DXV81wlKR97/r9+17 +klQOLkSdPm9wcMDOWMNHX8bUg8kCgYEA8k+hQv6+TR/+Beao2IIctFtw/EauaJiJ +wW5ql1cpCLPMAOQUvjs0Km3zqctfBF8mUjdkcyJ4uhL9FZtfywY22EtRIXOJ/8VR +we65mVo6RLR8YVM54sihanuFOnlyF9LIBWB+9pUfh1/Y7DSebh7W73uxhAxQhi3Y +QwfIQIFd8OkCgYBalH4VXhLYhpaYCiXSej6ot6rrK2N6c5Tb2MAWMA1nh+r84tMP +gMoh+pDgYPAqMI4mQbxUmqZEeoLuBe6VHpDav7rPECRaW781AJ4ZM4cEQ3Jz/inz +4qOAMn10CF081/Ez9ykPPlU0bsYNWHNd4eB2xWnmUBKOwk7UgJatVPaUiQKBgQCI +f18CVGpzG9CHFnaK8FCnMNOm6VIaTcNcGY0mD81nv5Dt943P054BQMsAHTY7SjZW +HioRyZtkhonXAB2oSqnekh7zzxgv4sG5k3ct8evdBCcE1FNJc2eqikZ0uDETRoOy +s7cRxNNr+QxDkyikM+80HOPU1PMPgwfOSrX90GJQ8QKBgEBKohGMV/sNa4t14Iau +qO8aagoqh/68K9GFXljsl3/iCSa964HIEREtW09Qz1w3dotEgp2w8bsDa+OwWrLy +0SY7T5jRViM3cDWRlUBLrGGiL0FiwsfqiRiji60y19erJgrgyGVIb1kIgIBRkgFM +2MMweASzTmZcri4PA/5C0HYb +-----END PRIVATE KEY----- diff --git a/sample/sample-keys/client.p12 b/sample/sample-keys/client.p12 new file mode 100644 index 0000000..8458c79 Binary files /dev/null and b/sample/sample-keys/client.p12 differ diff --git a/sample/sample-keys/dh1024.pem b/sample/sample-keys/dh1024.pem deleted file mode 100644 index 7ce05f0..0000000 --- a/sample/sample-keys/dh1024.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN DH PARAMETERS----- -MIGHAoGBAJ419DBEOgmQTzo5qXl5fQcN9TN455wkOL7052HzxxRVMyhYmwQcgJvh -1sa18fyfR9OiVEMYglOpkqVoGLN7qd5aQNNi5W7/C+VBdHTBJcGZJyyP5B3qcz32 -9mLJKudlVudV0Qxk5qUJaPZ/xupz0NyoVpviuiBOI1gNi8ovSXWzAgEC ------END DH PARAMETERS----- diff --git a/sample/sample-keys/dh2048.pem b/sample/sample-keys/dh2048.pem new file mode 100644 index 0000000..8eda59a --- /dev/null +++ b/sample/sample-keys/dh2048.pem @@ -0,0 +1,8 @@ +-----BEGIN DH PARAMETERS----- +MIIBCAKCAQEArdnA32xujHPlPI+jPffHSoMUZ+b5gRz1H1Lw9//Gugm5TAsRiYrB +t2BDSsMKvAjyqN+i5SJv4TOk98kRRKB27iPvyXmiL945VaDQl/UehCySjYlGFUjW +9nuo+JwQxeSbw0TLiSYoYJZQ8X1CxPl9mgJl277O4cW1Gc8I/bWa+ipU/4K5wv3h +GI8nt+6A0jN3M/KebotMP101G4k0l0qsY4oRMTmP+z3oAP0qU9NZ1jiuMFVzRlNp +5FdYF7ctrH+tBF+QmyT4SRKSED4wE4oX6gp420NaBhIEQifIj75wlMDtxQlpkN+x +QkjsEbPlaPKHGQ4uupssChVUi8IM2yq5EwIBAg== +-----END DH PARAMETERS----- diff --git a/sample/sample-keys/gen-sample-keys.sh b/sample/sample-keys/gen-sample-keys.sh new file mode 100755 index 0000000..414687e --- /dev/null +++ b/sample/sample-keys/gen-sample-keys.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Run this script to set up a test CA, and test key-certificate pair for a +# server, and various clients. +# +# Copyright (C) 2014 Steffan Karger +set -eu + +command -v openssl >/dev/null 2>&1 || { echo >&2 "Unable to find openssl. Please make sure openssl is installed and in your path."; exit 1; } + +if [ ! -f openssl.cnf ] +then + echo "Please run this script from the sample directory" + exit 1 +fi + +# Create required directories and files +mkdir -p sample-ca +rm -f sample-ca/index.txt +touch sample-ca/index.txt +echo "01" > sample-ca/serial + +# Generate CA key and cert +openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 \ + -extensions easyrsa_ca -keyout sample-ca/ca.key -out sample-ca/ca.crt \ + -subj "/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain" \ + -config openssl.cnf + +# Create server key and cert +openssl req -new -nodes -config openssl.cnf -extensions server \ + -keyout sample-ca/server.key -out sample-ca/server.csr \ + -subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server/emailAddress=me@myhost.mydomain" +openssl ca -batch -config openssl.cnf -extensions server \ + -out sample-ca/server.crt -in sample-ca/server.csr + +# Create client key and cert +openssl req -new -nodes -config openssl.cnf \ + -keyout sample-ca/client.key -out sample-ca/client.csr \ + -subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Client/emailAddress=me@myhost.mydomain" +openssl ca -batch -config openssl.cnf \ + -out sample-ca/client.crt -in sample-ca/client.csr + +# Create password protected key file +openssl rsa -aes256 -passout pass:password \ + -in sample-ca/client.key -out sample-ca/client-pass.key + +# Create pkcs#12 client bundle +openssl pkcs12 -export -nodes -password pass:password \ + -out sample-ca/client.p12 -inkey sample-ca/client.key \ + -in sample-ca/client.crt -certfile sample-ca/ca.crt + + +# Create EC server and client cert (signed by 'regular' RSA CA) +openssl ecparam -out sample-ca/secp256k1.pem -name secp256k1 + +openssl req -new -newkey ec:sample-ca/secp256k1.pem -nodes -config openssl.cnf \ + -extensions server \ + -keyout sample-ca/server-ec.key -out sample-ca/server-ec.csr \ + -subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server-EC/emailAddress=me@myhost.mydomain" +openssl ca -batch -config openssl.cnf -extensions server \ + -out sample-ca/server-ec.crt -in sample-ca/server-ec.csr + +openssl req -new -newkey ec:sample-ca/secp256k1.pem -nodes -config openssl.cnf \ + -keyout sample-ca/client-ec.key -out sample-ca/client-ec.csr \ + -subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Client-EC/emailAddress=me@myhost.mydomain" +openssl ca -batch -config openssl.cnf \ + -out sample-ca/client-ec.crt -in sample-ca/client-ec.csr + +# Generate DH parameters +openssl dhparam -out dh2048.pem 2048 + +# Copy keys and certs to working directory +cp sample-ca/*.key . +cp sample-ca/*.crt . +cp sample-ca/*.p12 . diff --git a/sample/sample-keys/openssl.cnf b/sample/sample-keys/openssl.cnf new file mode 100644 index 0000000..aabfd48 --- /dev/null +++ b/sample/sample-keys/openssl.cnf @@ -0,0 +1,139 @@ +# Heavily borrowed from EasyRSA 3, for use with OpenSSL 1.0.* + +#################################################################### +[ ca ] +default_ca = CA_default # The default ca section + +#################################################################### +[ CA_default ] + +dir = sample-ca # Where everything is kept +certs = $dir # Where the issued certs are kept +crl_dir = $dir # Where the issued crl are kept +database = $dir/index.txt # database index file. +new_certs_dir = $dir # default place for new certs. + +certificate = $dir/ca.crt # The CA certificate +serial = $dir/serial # The current serial number +crl = $dir/crl.pem # The current CRL +private_key = $dir/ca.key # The private key +RANDFILE = $dir/.rand # private random number file + +x509_extensions = basic_exts # The extentions to add to the cert + +# This allows a V2 CRL. Ancient browsers don't like it, but anything Easy-RSA +# is designed for will. In return, we get the Issuer attached to CRLs. +crl_extensions = crl_ext + +default_days = 3650 # how long to certify for +default_crl_days= 30 # how long before next CRL +default_md = sha256 # use public key default MD +preserve = no # keep passed DN ordering + +# A few difference way of specifying how similar the request should look +# For type CA, the listed attributes must be the same, and the optional +# and supplied fields are just that :-) +policy = policy_anything + +# For the 'anything' policy, which defines allowed DN fields +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +name = optional +emailAddress = optional + +#################################################################### +# Easy-RSA request handling +# We key off $DN_MODE to determine how to format the DN +[ req ] +default_bits = 2048 +default_keyfile = privkey.pem +default_md = sha256 +distinguished_name = cn_only +x509_extensions = easyrsa_ca # The extentions to add to the self signed cert + +# A placeholder to handle the $EXTRA_EXTS feature: +#%EXTRA_EXTS% # Do NOT remove or change this line as $EXTRA_EXTS support requires it + +#################################################################### +# Easy-RSA DN (Subject) handling + +# Easy-RSA DN for cn_only support: +[ cn_only ] +commonName = Common Name (eg: your user, host, or server name) +commonName_max = 64 +commonName_default = changeme + +# Easy-RSA DN for org support: +[ org ] +countryName = Country Name (2 letter code) +countryName_default = KG +countryName_min = 2 +countryName_max = 2 + +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = NA + +localityName = Locality Name (eg, city) +localityName_default = BISHKEK + +0.organizationName = Organization Name (eg, company) +0.organizationName_default = OpenVPN-TEST + +organizationalUnitName = Organizational Unit Name (eg, section) +organizationalUnitName_default = + +commonName = Common Name (eg: your user, host, or server name) +commonName_max = 64 +commonName_default = + +emailAddress = Email Address +emailAddress_default = me@myhost.mydomain +emailAddress_max = 64 + +#################################################################### + +[ basic_exts ] +basicConstraints = CA:FALSE +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid,issuer:always + +# The Easy-RSA CA extensions +[ easyrsa_ca ] + +# PKIX recommendations: + +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid:always,issuer:always + +# This could be marked critical, but it's nice to support reading by any +# broken clients who attempt to do so. +basicConstraints = CA:true + +# Limit key usage to CA tasks. If you really want to use the generated pair as +# a self-signed cert, comment this out. +keyUsage = cRLSign, keyCertSign + +# CRL extensions. +[ crl_ext ] + +# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL. + +# issuerAltName=issuer:copy +authorityKeyIdentifier=keyid:always,issuer:always + + +# Server extensions. +[ server ] + +basicConstraints = CA:FALSE +nsCertType = server +nsComment = "OpenSSL Generated Server Certificate" +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid,issuer:always +extendedKeyUsage = serverAuth +keyUsage = digitalSignature, keyEncipherment diff --git a/sample/sample-keys/pass.crt b/sample/sample-keys/pass.crt deleted file mode 100644 index 8bb7b17..0000000 --- a/sample/sample-keys/pass.crt +++ /dev/null @@ -1,65 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 3 (0x3) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain - Validity - Not Before: Nov 25 14:48:55 2004 GMT - Not After : Nov 23 14:48:55 2014 GMT - Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Client-Password/emailAddress=me@myhost.mydomain - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:ca:b4:05:67:7b:51:c1:d2:fe:21:57:b1:a5:57: - 5c:c0:86:38:05:a8:91:cf:e7:a4:bd:7a:76:d8:3b: - cf:fe:f3:78:65:24:d6:72:7d:1b:6d:b6:da:04:f2: - a8:f6:b4:04:78:d2:24:a7:21:2f:ca:29:46:96:0f: - 0b:91:31:66:1e:4d:22:9a:5d:05:17:99:9c:a0:7e: - e0:2a:be:78:0c:a1:b9:d4:04:c4:ec:f8:61:79:62: - b5:52:2d:f5:41:af:db:9f:8c:ab:08:1b:b7:95:b8: - c1:f0:29:d3:da:fb:00:3f:8e:5c:27:e3:8d:fa:ee: - dc:b4:3b:0b:8b:e0:ab:c1:c1 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 40:57:F1:8C:9C:86:B2:DA:E0:3F:A7:B8:D7:85:43:45:07:8A:40:73 - X509v3 Authority Key Identifier: - keyid:89:A6:60:E3:BA:EA:3E:AF:FC:64:7F:4C:BD:8C:D2:48:8D:E0:CC:46 - DirName:/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain - serial:00 - - Signature Algorithm: md5WithRSAEncryption - a5:79:72:7f:a2:08:28:8e:66:da:e1:d0:be:bb:97:3d:65:9f: - ab:1e:19:ac:f1:66:44:14:8f:4e:7c:eb:ea:1e:2f:57:ea:44: - 46:4c:b9:56:5b:c0:0c:58:d2:45:87:26:6d:82:de:8c:64:b8: - 8b:22:61:61:c6:68:36:08:9d:5a:fd:2f:e5:21:e1:a2:0c:7f: - 3e:ca:e1:06:ea:9f:81:62:3d:a0:ce:f1:1e:0d:ab:86:89:ed: - 9a:89:34:32:c9:e9:6d:7d:f5:11:c3:5d:7e:a5:f7:f1:a6:83: - 77:1b:94:67:d9:0f:5c:ac:0e:08:4a:88:98:65:49:eb:66:9e: - 2d:28 ------BEGIN CERTIFICATE----- -MIIDPjCCAqegAwIBAgIBAzANBgkqhkiG9w0BAQQFADBmMQswCQYDVQQGEwJLRzEL -MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t -VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTA0MTEy -NTE0NDg1NVoXDTE0MTEyMzE0NDg1NVowczELMAkGA1UEBhMCS0cxCzAJBgNVBAgT -Ak5BMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxHTAbBgNVBAMTFFRlc3QtQ2xpZW50 -LVBhc3N3b3JkMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wgZ8w -DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMq0BWd7UcHS/iFXsaVXXMCGOAWokc/n -pL16dtg7z/7zeGUk1nJ9G2222gTyqPa0BHjSJKchL8opRpYPC5ExZh5NIppdBReZ -nKB+4Cq+eAyhudQExOz4YXlitVIt9UGv25+Mqwgbt5W4wfAp09r7AD+OXCfjjfru -3LQ7C4vgq8HBAgMBAAGjge4wgeswCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYd -T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFEBX8YychrLa -4D+nuNeFQ0UHikBzMIGQBgNVHSMEgYgwgYWAFImmYOO66j6v/GR/TL2M0kiN4MxG -oWqkaDBmMQswCQYDVQQGEwJLRzELMAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hL -RUsxFTATBgNVBAoTDE9wZW5WUE4tVEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlo -b3N0Lm15ZG9tYWluggEAMA0GCSqGSIb3DQEBBAUAA4GBAKV5cn+iCCiOZtrh0L67 -lz1ln6seGazxZkQUj0586+oeL1fqREZMuVZbwAxY0kWHJm2C3oxkuIsiYWHGaDYI -nVr9L+Uh4aIMfz7K4Qbqn4FiPaDO8R4Nq4aJ7ZqJNDLJ6W199RHDXX6l9/Gmg3cb -lGfZD1ysDghKiJhlSetmni0o ------END CERTIFICATE----- diff --git a/sample/sample-keys/pass.key b/sample/sample-keys/pass.key deleted file mode 100644 index 4916364..0000000 --- a/sample/sample-keys/pass.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,959F7365DBBFDB77 - -nGm57l+rR/8dAZOHL/1x/6dt11zUca7rphjsgw6XRnSf3M/CWmHvHVjApWcNLEs5 -SWNMp1xfUogtGzsKoMBbnlZLDA7RVHUYD6dVMyCpc64UjzT08LmdZhtQYLAKmlUC -PT1VXS4Ae+SrqCPUqJkw1xP3kr0F1EVCXNu0nhOBAuuTGOS7PPEyW2N+k4nRHtsR -IaPp8GCuIeoR6CdymTFTq6d/GeCiEcyrUM4BNrG4GtRRrURxxOrzQFEOS5sjBPSg -Km1lwa6zBQFRLg9dKjRBL4teKuPY5Z2Nmpcml/aN4CkdkVEso4lW6/UHLE/joOMQ -0MdpdYtu8wnt1WI/Z4immQfl3MF+QcPMkqXXzCEhGG/5SbAo89KC46UXvu1Z5OhS -8XFHhvYBivOYWgZ3XUQqyZ0ulF60mFX7aE1Ph/eEbhWBHmU39hGjxzop1UoPwqLx -ahvtfvCkR3ZeqlWO9SHzCA3MlrKwQ1p1UL6nG6AJhNN9jSevH6by+8wr07NBZOqX -fJx+J/8EdVsUCFG2UJxPwM83ZSwAsvKRqph6CuWEl9ndUb7rw6khmRIoY0Iz3LbU -1MlcDoJNcJas6lYDr1UeFSk86g0SiGCHXZIqsjyUgq6HIy4YrAYiQUthnlF8tp2Q -nNQBPLo1GsHf0dC2MqKfDFASu7ST+Bl+yajHcIiUXvUJPxWbjkWYG9Q2p2ZBLzZD -uqeRr66OKxTzUS4go/QbHDNsAulXl61gQIEOdZw5uy/Jl11kyAI6EQbzmehagKdH -EshTgKp8ks62y0bBHgy3FMKyidJ5Hm58ZDhBxrwN0w+vhRoTGOepTA== ------END RSA PRIVATE KEY----- diff --git a/sample/sample-keys/pkcs12.p12 b/sample/sample-keys/pkcs12.p12 deleted file mode 100644 index 253d408..0000000 Binary files a/sample/sample-keys/pkcs12.p12 and /dev/null differ diff --git a/sample/sample-keys/server-ec.crt b/sample/sample-keys/server-ec.crt new file mode 100644 index 0000000..7c7645a --- /dev/null +++ b/sample/sample-keys/server-ec.crt @@ -0,0 +1,96 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 3 (0x3) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + Validity + Not Before: Oct 22 21:59:53 2014 GMT + Not After : Oct 19 21:59:53 2024 GMT + Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Server-EC/emailAddress=me@myhost.mydomain + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (256 bit) + pub: + 04:21:09:ac:27:e6:00:3a:57:f4:f6:c7:78:a9:b1: + f4:d7:d7:45:59:39:e4:a3:d3:2c:94:f9:61:4a:e6: + b9:e9:87:57:c8:0f:88:03:a0:56:ee:34:e7:e4:4e: + 20:63:6c:c1:6e:c1:04:ac:b9:2f:a9:76:69:d3:7d: + 49:ff:f1:34:cb + ASN1 OID: secp256k1 + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Cert Type: + SSL Server + Netscape Comment: + OpenSSL Generated Server Certificate + X509v3 Subject Key Identifier: + 33:1A:42:61:9E:88:08:3F:6F:1F:98:88:3A:DD:2D:C7:07:3D:F6:9B + X509v3 Authority Key Identifier: + keyid:2B:40:E5:C9:7D:F5:F4:96:38:E9:2F:E3:2F:D9:40:64:C9:8E:05:9B + DirName:/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + serial:A1:4E:DE:FA:90:F2:AE:81 + + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Key Usage: + Digital Signature, Key Encipherment + Signature Algorithm: sha256WithRSAEncryption + 9d:89:f6:7e:0b:43:05:22:63:e5:b3:45:a8:d9:ef:33:3c:b7: + 19:37:28:87:27:43:43:86:a3:3f:b9:23:27:0f:96:4f:de:01: + 80:38:6b:d9:c8:94:77:1f:06:08:34:65:77:ad:57:0c:23:99: + f1:51:12:5f:32:d8:9c:7c:93:f1:f6:72:2a:05:61:ff:62:aa: + 33:aa:ef:a3:4d:d6:93:56:40:ff:38:2e:73:1c:69:fb:71:a1: + fa:64:19:6a:04:1c:8b:20:a8:ee:a5:18:63:f8:84:f4:ca:84: + 8e:b6:05:48:c6:f3:f7:81:90:4d:9e:00:cd:4a:92:83:d4:93: + 67:05:dc:16:8b:78:fa:b1:82:48:c6:86:74:44:b1:06:7e:8a: + c8:64:0b:82:3a:e2:f5:56:60:ea:50:70:03:da:9f:fc:28:20: + 6b:7d:04:e0:eb:8d:e2:f1:be:82:2f:ba:51:50:2b:6c:d2:fc: + 11:cd:69:85:3b:9e:14:19:dd:bc:14:cf:61:b0:7a:07:cb:e8: + e0:fc:c3:1f:a4:cb:cf:c1:e9:62:0f:d2:53:f8:ce:06:f4:f8: + 2f:55:13:aa:67:44:b6:b8:e8:3e:82:af:66:f5:f0:7c:fe:41: + e6:9d:c0:9f:78:fd:00:85:02:40:63:37:fa:00:e6:3c:a6:9f: + 35:4f:1d:a6:f1:cb:8b:04:e0:67:98:56:d1:87:58:b6:39:f6: + d3:fe:a8:40:50:80:7f:e6:4a:36:d0:c0:a5:61:64:1d:3a:87: + ad:78:72:c9:3f:98:44:35:f9:cf:32:b2:18:4c:b0:72:fa:5e: + 6c:62:1e:d4:31:0c:c8:9b:74:f0:00:9e:70:c3:1e:c7:a4:9d: + 03:a4:ac:1a:09:1f:86:23:65:51:34:50:86:68:1e:68:4d:9a: + 4b:78:10:1c:bd:51:09:bb:fe:16:a3:c7:19:b4:05:44:a1:e6: + c6:23:76:d5:b8:3a:eb:a5:17:1d:2b:2e:fe:85:7c:88:4f:f1: + e8:34:32:e0:c5:96:87:c3:e8:c9:5f:89:24:10:0e:1e:07:0b: + 2c:f8:d0:49:1b:63:5e:63:44:e9:2a:43:e2:9c:d6:f2:43:99: + 47:f8:9b:49:1a:a7:d1:e0:53:67:1d:cb:14:b6:b0:2c:4d:b3: + f2:c5:62:c2:a6:09:7a:c0:6c:59:3e:73:83:0c:6c:de:30:77: + 4d:1b:ed:b0:7f:77:87:8d:55:1d:d3:ed:f7:66:bd:06:2a:f8: + fd:00:e7:c0:31:e2:ff:53:9e:25:97:c6:64:84:9d:8d:61:8e: + c9:1f:6c:55:a1:7c:59:aa:eb:e8:2a:b2:2d:c7:09:cd:b5:3d: + d8:74:4f:6e:9c:3b:d5:6d +-----BEGIN CERTIFICATE----- +MIIEtTCCAp2gAwIBAgIBAzANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJLRzEL +MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t +VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTE0MTAy +MjIxNTk1M1oXDTI0MTAxOTIxNTk1M1owbTELMAkGA1UEBhMCS0cxCzAJBgNVBAgT +Ak5BMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxFzAVBgNVBAMTDlRlc3QtU2VydmVy +LUVDMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wVjAQBgcqhkjO +PQIBBgUrgQQACgNCAAQhCawn5gA6V/T2x3ipsfTX10VZOeSj0yyU+WFK5rnph1fI +D4gDoFbuNOfkTiBjbMFuwQSsuS+pdmnTfUn/8TTLo4IBMzCCAS8wCQYDVR0TBAIw +ADARBglghkgBhvhCAQEEBAMCBkAwMwYJYIZIAYb4QgENBCYWJE9wZW5TU0wgR2Vu +ZXJhdGVkIFNlcnZlciBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUMxpCYZ6ICD9vH5iI +Ot0txwc99pswgZgGA1UdIwSBkDCBjYAUK0DlyX319JY46S/jL9lAZMmOBZuhaqRo +MGYxCzAJBgNVBAYTAktHMQswCQYDVQQIEwJOQTEQMA4GA1UEBxMHQklTSEtFSzEV +MBMGA1UEChMMT3BlblZQTi1URVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3Qu +bXlkb21haW6CCQChTt76kPKugTATBgNVHSUEDDAKBggrBgEFBQcDATALBgNVHQ8E +BAMCBaAwDQYJKoZIhvcNAQELBQADggIBAJ2J9n4LQwUiY+WzRajZ7zM8txk3KIcn +Q0OGoz+5IycPlk/eAYA4a9nIlHcfBgg0ZXetVwwjmfFREl8y2Jx8k/H2cioFYf9i +qjOq76NN1pNWQP84LnMcaftxofpkGWoEHIsgqO6lGGP4hPTKhI62BUjG8/eBkE2e +AM1KkoPUk2cF3BaLePqxgkjGhnREsQZ+ishkC4I64vVWYOpQcAPan/woIGt9BODr +jeLxvoIvulFQK2zS/BHNaYU7nhQZ3bwUz2GwegfL6OD8wx+ky8/B6WIP0lP4zgb0 ++C9VE6pnRLa46D6Cr2b18Hz+QeadwJ94/QCFAkBjN/oA5jymnzVPHabxy4sE4GeY +VtGHWLY59tP+qEBQgH/mSjbQwKVhZB06h614csk/mEQ1+c8yshhMsHL6XmxiHtQx +DMibdPAAnnDDHseknQOkrBoJH4YjZVE0UIZoHmhNmkt4EBy9UQm7/hajxxm0BUSh +5sYjdtW4OuulFx0rLv6FfIhP8eg0MuDFlofD6MlfiSQQDh4HCyz40EkbY15jROkq +Q+Kc1vJDmUf4m0kap9HgU2cdyxS2sCxNs/LFYsKmCXrAbFk+c4MMbN4wd00b7bB/ +d4eNVR3T7fdmvQYq+P0A58Ax4v9TniWXxmSEnY1hjskfbFWhfFmq6+gqsi3HCc21 +Pdh0T26cO9Vt +-----END CERTIFICATE----- diff --git a/sample/sample-keys/server-ec.key b/sample/sample-keys/server-ec.key new file mode 100644 index 0000000..8f2c914 --- /dev/null +++ b/sample/sample-keys/server-ec.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgLHGYqSlzoRaogmJfrC+E +ozTothB9bORaQ1C/3FmeQ6ehRANCAAQhCawn5gA6V/T2x3ipsfTX10VZOeSj0yyU ++WFK5rnph1fID4gDoFbuNOfkTiBjbMFuwQSsuS+pdmnTfUn/8TTL +-----END PRIVATE KEY----- diff --git a/sample/sample-keys/server.crt b/sample/sample-keys/server.crt index 28bb4d9..76b4044 100644 --- a/sample/sample-keys/server.crt +++ b/sample/sample-keys/server.crt @@ -2,25 +2,34 @@ Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) - Signature Algorithm: md5WithRSAEncryption + Signature Algorithm: sha256WithRSAEncryption Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain Validity - Not Before: Nov 25 14:42:22 2004 GMT - Not After : Nov 23 14:42:22 2014 GMT + Not Before: Oct 22 21:59:52 2014 GMT + Not After : Oct 19 21:59:52 2024 GMT Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Server/emailAddress=me@myhost.mydomain Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:cb:4e:ac:f9:83:57:f6:69:d2:32:29:b4:bc:ad: - e6:f7:26:21:89:33:30:43:40:a3:35:d9:de:26:01: - d6:b4:f0:bc:0a:19:55:99:3b:f1:4c:91:60:b6:fd: - 74:34:8d:5a:c7:62:ec:ce:f2:d6:02:ce:57:32:f4: - 35:8c:71:a0:6d:65:2a:e7:80:ae:29:59:cf:36:73: - f8:7c:4a:73:90:fc:30:28:d5:46:7d:35:a4:4e:c9: - 9f:90:7b:e2:09:21:36:c5:a8:ec:85:82:9a:32:b4: - 91:3b:c1:d6:4f:9f:d1:f8:6f:68:f4:1d:d2:06:91: - 32:cc:9a:48:fd:cd:98:7f:2f + Public-Key: (2048 bit) + Modulus: + 00:a5:b8:a2:ee:ce:b1:a6:0f:6a:b2:9f:d3:22:17: + 79:de:09:98:71:78:fa:a7:ce:36:51:54:57:c7:31: + 99:56:d1:8a:d6:c5:fd:52:e6:88:0e:7b:f9:ea:27: + 7a:bf:3f:14:ec:aa:d2:ff:8b:56:58:ac:ca:51:77: + c5:3c:b6:e4:83:6f:22:06:2d:5b:eb:e7:59:d4:ab: + 42:c8:d5:a9:87:73:b3:73:36:51:2f:a5:d0:90:a2: + 87:64:54:6c:12:d3:b8:76:47:69:af:ae:8f:00:b3: + 70:b9:e7:67:3f:8c:6a:3d:79:5f:81:27:a3:0e:aa: + a7:3d:81:48:10:b1:18:6c:38:2e:8f:7a:7b:c5:3d: + 21:c8:f9:a0:7f:17:2b:88:4f:ba:f2:ec:6d:24:8e: + 6c:f1:0a:5c:d9:5b:b1:b0:fc:49:cb:4a:d2:58:c6: + 2a:25:b0:97:84:c3:9e:ff:34:8c:10:46:7f:0f:fb: + 3c:59:7a:a6:29:0c:ae:8e:50:3a:f2:53:84:40:2d: + d5:91:7b:0a:37:8e:82:77:ce:66:2f:34:77:5c:a5: + 45:3b:00:19:a7:07:d1:92:e6:66:b9:3b:4e:e9:63: + fc:33:98:1a:ae:7b:08:7d:0a:df:7a:ba:aa:59:6d: + 86:82:0a:64:2b:da:59:a7:4c:4e:ef:3d:bd:04:a2: + 4b:31 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -30,38 +39,75 @@ Certificate: Netscape Comment: OpenSSL Generated Server Certificate X509v3 Subject Key Identifier: - 69:11:FE:E7:9F:89:7B:71:34:69:C0:DC:82:F8:D0:5D:4D:FB:78:DF + B3:9D:81:E6:16:92:64:C4:86:87:F5:29:10:1B:5E:2F:74:F7:ED:B1 X509v3 Authority Key Identifier: - keyid:89:A6:60:E3:BA:EA:3E:AF:FC:64:7F:4C:BD:8C:D2:48:8D:E0:CC:46 + keyid:2B:40:E5:C9:7D:F5:F4:96:38:E9:2F:E3:2F:D9:40:64:C9:8E:05:9B DirName:/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain - serial:00 + serial:A1:4E:DE:FA:90:F2:AE:81 - Signature Algorithm: md5WithRSAEncryption - 35:5c:75:da:57:ef:b5:79:f2:a2:db:36:e4:75:e8:c7:bc:73: - 26:cf:30:36:4b:2e:51:46:37:60:2f:4e:2b:f6:71:a2:23:db: - 8e:d8:5c:d5:af:2e:22:28:dd:30:a8:89:66:3a:cc:5b:3c:0f: - 96:12:20:de:5e:41:52:74:35:ed:4c:26:40:19:ca:73:df:54: - b1:30:96:9c:a5:14:d0:38:28:3f:ab:30:07:d7:de:98:d2:7f: - 7f:90:b2:52:1d:e5:95:88:ed:ba:8a:6a:14:85:66:76:ec:75: - 30:e8:ae:94:f4:e1:76:fa:4b:0e:f1:53:d7:95:be:fb:69:fa: - 3d:32 + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Key Usage: + Digital Signature, Key Encipherment + Signature Algorithm: sha256WithRSAEncryption + 4e:25:80:1b:cb:b0:42:ff:bb:3f:e8:0d:58:c1:80:db:cf:d0: + 90:df:ca:c1:e6:41:e1:48:7f:a7:1e:c7:35:9f:9c:6d:7c:3e: + 82:e8:de:7e:ae:82:16:00:33:0f:02:23:f1:9d:fe:2b:06:16: + 05:55:16:89:dc:63:ac:5f:1a:31:13:79:21:a3:6e:60:28:e8: + e7:6b:54:00:22:a1:b7:69:5a:17:31:ce:0f:c2:a6:dd:a3:6f: + de:ea:19:6c:d2:d2:cb:35:9d:dd:87:51:33:68:cd:c3:9b:90: + 55:f1:80:3d:5c:b8:09:b6:e1:3c:13:a4:5d:4a:ce:a5:11:9e: + f9:08:ee:be:e3:54:1d:06:4c:bb:1b:72:13:ee:7d:a0:45:cc: + fe:d1:3b:02:03:c1:d4:ea:45:2d:a8:c9:97:e7:f3:8a:7a:a0: + 2f:dd:48:3a:75:c9:42:28:94:fc:af:44:52:16:68:98:d6:ad: + a8:65:b1:cd:ac:60:41:70:e5:44:e8:5a:f2:e7:fc:3b:fe:45: + 89:17:1d:6d:85:c6:f0:fc:69:87:d1:1d:07:f3:cb:7b:54:8d: + aa:a3:cc:e3:c6:fc:d6:05:76:35:d0:26:63:8e:d1:a8:b7:ff: + 61:42:8a:2c:63:1f:d4:ec:14:47:6b:1e:e3:81:61:12:3b:8c: + 16:b5:cf:87:6a:2d:42:21:83:9c:0e:3a:90:3a:1e:c1:36:61: + 41:f9:fb:4e:5d:ea:f4:df:23:92:33:2b:9b:14:9f:a0:f5:d3: + c4:f8:1f:2f:9c:11:36:af:2a:22:61:95:32:0b:c4:1c:2d:b1: + c1:0a:2a:97:c0:43:4a:6c:3e:db:00:cd:29:15:9e:7e:41:75: + 36:a8:56:86:8c:82:9e:46:20:e5:06:1e:60:d2:03:5f:9f:9e: + 69:bb:bf:c2:b4:43:e2:7d:85:17:83:18:41:b0:cb:a9:04:1b: + 18:52:9f:89:8b:76:9f:94:59:81:4f:60:5b:33:18:fc:c7:52: + d0:d2:69:fc:0b:a2:63:32:75:43:99:e9:d7:f8:6d:c7:55:31: + 0c:f3:ef:1a:71:e1:0a:57:e1:9d:13:b2:1e:fe:1d:ef:e4:f1: + 51:d9:95:b3:fd:28:28:93:91:4a:29:c5:37:0e:ab:d8:85:6a: + fe:a8:83:1f:7b:80:5d:1f:04:79:b7:a9:08:6e:0d:d6:2e:aa: + 7c:f6:63:7d:41:de:70:13:32:ce:dd:58:cc:a6:73:d4:72:7e: + d7:ac:74:a8:35:ba:c3:1b:2a:64:d7:5a:37:97:56:94:34:2b: + 2a:71:60:bc:69:ab:00:85:b9:4f:67:32:17:51:c3:da:57:3a: + 37:89:66:c4:7a:51:da:5f -----BEGIN CERTIFICATE----- -MIIDUTCCArqgAwIBAgIBATANBgkqhkiG9w0BAQQFADBmMQswCQYDVQQGEwJLRzEL +MIIFgDCCA2igAwIBAgIBATANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJLRzEL MAkGA1UECBMCTkExEDAOBgNVBAcTB0JJU0hLRUsxFTATBgNVBAoTDE9wZW5WUE4t -VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTA0MTEy -NTE0NDIyMloXDTE0MTEyMzE0NDIyMlowajELMAkGA1UEBhMCS0cxCzAJBgNVBAgT +VEVTVDEhMB8GCSqGSIb3DQEJARYSbWVAbXlob3N0Lm15ZG9tYWluMB4XDTE0MTAy +MjIxNTk1MloXDTI0MTAxOTIxNTk1MlowajELMAkGA1UEBhMCS0cxCzAJBgNVBAgT Ak5BMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxFDASBgNVBAMTC1Rlc3QtU2VydmVy -MSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wgZ8wDQYJKoZIhvcN -AQEBBQADgY0AMIGJAoGBAMtOrPmDV/Zp0jIptLyt5vcmIYkzMENAozXZ3iYB1rTw -vAoZVZk78UyRYLb9dDSNWsdi7M7y1gLOVzL0NYxxoG1lKueArilZzzZz+HxKc5D8 -MCjVRn01pE7Jn5B74gkhNsWo7IWCmjK0kTvB1k+f0fhvaPQd0gaRMsyaSP3NmH8v -AgMBAAGjggEJMIIBBTAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIGQDAzBglg -hkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgU2VydmVyIENlcnRpZmljYXRl -MB0GA1UdDgQWBBRpEf7nn4l7cTRpwNyC+NBdTft43zCBkAYDVR0jBIGIMIGFgBSJ -pmDjuuo+r/xkf0y9jNJIjeDMRqFqpGgwZjELMAkGA1UEBhMCS0cxCzAJBgNVBAgT -Ak5BMRAwDgYDVQQHEwdCSVNIS0VLMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxITAf -BgkqhkiG9w0BCQEWEm1lQG15aG9zdC5teWRvbWFpboIBADANBgkqhkiG9w0BAQQF -AAOBgQA1XHXaV++1efKi2zbkdejHvHMmzzA2Sy5RRjdgL04r9nGiI9uO2FzVry4i -KN0wqIlmOsxbPA+WEiDeXkFSdDXtTCZAGcpz31SxMJacpRTQOCg/qzAH196Y0n9/ -kLJSHeWViO26imoUhWZ27HUw6K6U9OF2+ksO8VPXlb77afo9Mg== +MSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCluKLuzrGmD2qyn9MiF3neCZhxePqnzjZRVFfH +MZlW0YrWxf1S5ogOe/nqJ3q/PxTsqtL/i1ZYrMpRd8U8tuSDbyIGLVvr51nUq0LI +1amHc7NzNlEvpdCQoodkVGwS07h2R2mvro8As3C552c/jGo9eV+BJ6MOqqc9gUgQ +sRhsOC6PenvFPSHI+aB/FyuIT7ry7G0kjmzxClzZW7Gw/EnLStJYxiolsJeEw57/ +NIwQRn8P+zxZeqYpDK6OUDryU4RALdWRewo3joJ3zmYvNHdcpUU7ABmnB9GS5ma5 +O07pY/wzmBquewh9Ct96uqpZbYaCCmQr2lmnTE7vPb0EoksxAgMBAAGjggEzMIIB +LzAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIGQDAzBglghkgBhvhCAQ0EJhYk +T3BlblNTTCBHZW5lcmF0ZWQgU2VydmVyIENlcnRpZmljYXRlMB0GA1UdDgQWBBSz +nYHmFpJkxIaH9SkQG14vdPftsTCBmAYDVR0jBIGQMIGNgBQrQOXJffX0ljjpL+Mv +2UBkyY4Fm6FqpGgwZjELMAkGA1UEBhMCS0cxCzAJBgNVBAgTAk5BMRAwDgYDVQQH +EwdCSVNIS0VLMRUwEwYDVQQKEwxPcGVuVlBOLVRFU1QxITAfBgkqhkiG9w0BCQEW +Em1lQG15aG9zdC5teWRvbWFpboIJAKFO3vqQ8q6BMBMGA1UdJQQMMAoGCCsGAQUF +BwMBMAsGA1UdDwQEAwIFoDANBgkqhkiG9w0BAQsFAAOCAgEATiWAG8uwQv+7P+gN +WMGA28/QkN/KweZB4Uh/px7HNZ+cbXw+gujefq6CFgAzDwIj8Z3+KwYWBVUWidxj +rF8aMRN5IaNuYCjo52tUACKht2laFzHOD8Km3aNv3uoZbNLSyzWd3YdRM2jNw5uQ +VfGAPVy4CbbhPBOkXUrOpRGe+QjuvuNUHQZMuxtyE+59oEXM/tE7AgPB1OpFLajJ +l+fzinqgL91IOnXJQiiU/K9EUhZomNatqGWxzaxgQXDlROha8uf8O/5FiRcdbYXG +8Pxph9EdB/PLe1SNqqPM48b81gV2NdAmY47RqLf/YUKKLGMf1OwUR2se44FhEjuM +FrXPh2otQiGDnA46kDoewTZhQfn7Tl3q9N8jkjMrmxSfoPXTxPgfL5wRNq8qImGV +MgvEHC2xwQoql8BDSmw+2wDNKRWefkF1NqhWhoyCnkYg5QYeYNIDX5+eabu/wrRD +4n2FF4MYQbDLqQQbGFKfiYt2n5RZgU9gWzMY/MdS0NJp/AuiYzJ1Q5np1/htx1Ux +DPPvGnHhClfhnROyHv4d7+TxUdmVs/0oKJORSinFNw6r2IVq/qiDH3uAXR8Eebep +CG4N1i6qfPZjfUHecBMyzt1YzKZz1HJ+16x0qDW6wxsqZNdaN5dWlDQrKnFgvGmr +AIW5T2cyF1HD2lc6N4lmxHpR2l8= -----END CERTIFICATE----- diff --git a/sample/sample-keys/server.key b/sample/sample-keys/server.key index 976acab..011df12 100644 --- a/sample/sample-keys/server.key +++ b/sample/sample-keys/server.key @@ -1,15 +1,28 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDLTqz5g1f2adIyKbS8reb3JiGJMzBDQKM12d4mAda08LwKGVWZ -O/FMkWC2/XQ0jVrHYuzO8tYCzlcy9DWMcaBtZSrngK4pWc82c/h8SnOQ/DAo1UZ9 -NaROyZ+Qe+IJITbFqOyFgpoytJE7wdZPn9H4b2j0HdIGkTLMmkj9zZh/LwIDAQAB -AoGBAKP1ljA/iY/zNY447kZ/5NWKzd7tBk4mcbl7M9no/7O6tZtbZRoIKoi6cYoC -C1ZabUyBbkNTud5XdCFmq0zRUjOWvoFMZ9VZfd2kRPvl4TGczBtJAq65b+EYMGui -q6T9p61xPdtzu0vM+Ecj127pAMk5XcJyxu8XQK7lZWmG5UoJAkEA8CxXNZN+A3qD -bMBPI3VdwKCNSjNVEQEnygMbNgw7VLdxPpspzZziqJEGdzsM4dsnOBwKxIWFLN2h -lbGBOquAswJBANi0atGWM8VUxDjvqqHCTS9RUXWgnvYhee4/xraJBQPBSivjC9P0 -vKT7PjBHU6djtKSLKGaHn1vHqmyY7PCMjZUCQQCNVSqExqSzG1dXmdt4PErNXi2G -6qo2dX2arTVIGu6XLdQgSWLSMm5XT/CEHWW5SyPLKwVTHFeATXQXCPvJML9tAkEA -k0yXax0g1ZoXwufN4SQUmPw6Va03P/BjU/nP1ZVvbiz9gLVU/d7WN4J7tA9XomkY -idv5OzAmtxkSE70jGSNAvQJAWhCf9+iHkzOHRyKKOYlh1DHUwDfSEp+hlZYg9H03 -P2sraQzUxgWDY/DIY63KvW78ny863baFz7onz21MYGgJXg== ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCluKLuzrGmD2qy +n9MiF3neCZhxePqnzjZRVFfHMZlW0YrWxf1S5ogOe/nqJ3q/PxTsqtL/i1ZYrMpR +d8U8tuSDbyIGLVvr51nUq0LI1amHc7NzNlEvpdCQoodkVGwS07h2R2mvro8As3C5 +52c/jGo9eV+BJ6MOqqc9gUgQsRhsOC6PenvFPSHI+aB/FyuIT7ry7G0kjmzxClzZ +W7Gw/EnLStJYxiolsJeEw57/NIwQRn8P+zxZeqYpDK6OUDryU4RALdWRewo3joJ3 +zmYvNHdcpUU7ABmnB9GS5ma5O07pY/wzmBquewh9Ct96uqpZbYaCCmQr2lmnTE7v +Pb0EoksxAgMBAAECggEAPMOMin+jR75TYxeTNObiunVOPh0b2zeTVxLT9KfND7ZZ +cBK8pg79SEJRCnhbW5BnvbeNEkIm8PC6ZlDCM1bkRwUStq0fDUqQ95esLzOYq5/S +5qW98viblszhU/pYfja/Zi8dI1uf96PT63Zbt0NnGQ9N42+DLDeKhtTGdchZqiQA +LeSR0bQanY4tUUtCNYvBT8E3pzhoIsUzVwzIK53oovRpcOX3pMXVYZsmNhXdFFRy +YkjMXpj7fGyaAJK0QsC+PsgrKuhXDzDttsG2lI/mq9+7RXB3d/pzhmBVWynVH2lw +iQ7ONkSz7akDz/4I4WmxJep+FfQJYgK6rnLAlQqauQKBgQDammSAprnvDvNhSEp8 +W+xt7jQnFqaENbGgP0/D/OZMXc4khgexqlKFmSnBCRDmQ6JvLTWqDXC4+aqAbFQz +zAIjiKaT+so8xvFRob+rBMJY5JLYKNa+zUUanfORUNYLFJPvFqnrWGaJ9uufdaM7 +0a5bu95PN74NXee3DBbpBv8HLwKBgQDCEk+IjNbjMT+Neq0ywUeM5rFrUKi92abe +AgsVpjbighRV+6jA2lZFJcize+xYJ9wiOR1/TEI9PZ2OtBkqpwVdvTEHTagRLcvd +NfGcptREDnNLoNWA22buQpztiEduutACWQsrd+JQmqbUicUdW4zw86/oCMbYCW3V +QmYOLns7nwKBgHHUX20WZE91S4pmqFKlUzHTDdkk1ESX6Qx2q0R01j8BwawHFs6O +0DW9EZ7w55nfsh+OPRl1sjK/3ubMgfQO0TZLm+IGf3Sya0qEnVeiPMkpDMX+TgRA +wzEe+ou6uho+9uFSvdxMxeglaYA5M2ycvNwLsbEyZ4ZyVYxdgTiKahYFAoGAcIfP +iD0qKQiYcj/tB94cz+3AeJqHjbYT1O1YYhBECOkmQ4kuG80+cs/q5W/45lEOiuWV +Xgfo7Lu6jVGOujWoneci87oqtvNYH4e09oGh2WiLoBG9Wv9dWtBTUERSLzmxfXsG +SAk2uEhEbj8IhfJc8iZLHH9iVUh6YEslBBodqL8CgYEAlAhvcqAvw5SzsfBR5Mcu +4Nql6mXEVhHCvS4hdFCGaNF0z9A6eBORKJpdLWnqhpquDQDsghWE+Ga4QKSNFIi1 +fnAaykmZuY3ToqNOIaVlYM6HpMEz0wHQbTWfDLGcTFcElLZgMAk7VlDyiYVOco+E +QX9lXOO1PGpLzXhlDxSe63Y= +-----END PRIVATE KEY----- diff --git a/src/Makefile.in b/src/Makefile.in index 2cd864f..d019af9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -257,6 +257,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -361,9 +363,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile + $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/compat/Makefile.in b/src/compat/Makefile.in index 4f2fcb3..8c5111e 100644 --- a/src/compat/Makefile.in +++ b/src/compat/Makefile.in @@ -249,6 +249,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -368,9 +370,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/compat/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/compat/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/compat/Makefile + $(AUTOMAKE) --foreign src/compat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/openvpn/Makefile.in b/src/openvpn/Makefile.in index 686f79b..ea9547c 100644 --- a/src/openvpn/Makefile.in +++ b/src/openvpn/Makefile.in @@ -319,6 +319,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -470,9 +472,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/ltrc.inc $(am_ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/openvpn/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/openvpn/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/openvpn/Makefile + $(AUTOMAKE) --foreign src/openvpn/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 0a5e83f..aa93a7b 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -403,11 +403,27 @@ crypto_adjust_frame_parameters(struct frame *frame, bool packet_id, bool packet_id_long_form) { - frame_add_to_extra_frame (frame, - (packet_id ? packet_id_size (packet_id_long_form) : 0) + - ((cipher_defined && use_iv) ? cipher_kt_iv_size (kt->cipher) : 0) + - (cipher_defined ? cipher_kt_block_size (kt->cipher) : 0) + /* worst case padding expansion */ - kt->hmac_length); + size_t crypto_overhead = 0; + + if (packet_id) + crypto_overhead += packet_id_size (packet_id_long_form); + + if (cipher_defined) + { + if (use_iv) + crypto_overhead += cipher_kt_iv_size (kt->cipher); + + if (cipher_kt_mode_cbc (kt->cipher)) + /* worst case padding expansion */ + crypto_overhead += cipher_kt_block_size (kt->cipher); + } + + crypto_overhead += kt->hmac_length; + + frame_add_to_extra_frame (frame, crypto_overhead); + + msg(D_MTU_DEBUG, "%s: Adjusting frame parameters for crypto by %zu bytes", + __func__, crypto_overhead); } /* @@ -787,6 +803,7 @@ get_tls_handshake_key (const struct key_type *key_type, msg (M_INFO, "Control Channel Authentication: using '%s' as a free-form passphrase file", passphrase_file); + msg (M_WARN, "DEPRECATED OPTION: Using freeform files for tls-auth is deprecated and is not supported in OpenVPN 2.4 or newer versions"); } } /* handle key direction */ diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index bf2f802..e489827 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -6,7 +6,7 @@ * packet compression. * * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. - * Copyright (C) 2010 Fox Crypto B.V. + * Copyright (C) 2010-2014 Fox Crypto B.V. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -25,6 +25,76 @@ /** * @file Data Channel Cryptography Module + * + * @addtogroup data_crypto Data Channel Crypto module + * + * @par Crypto packet formats + * The Data Channel Crypto module supports a number of crypto modes and + * configurable options. The actual packet format depends on these options. A + * Data Channel packet can consist of: + * - \b Opcode, one byte specifying the packet type (see @ref network_protocol + * "Network protocol"). + * - \b Peer-id, if using the v2 data channel packet format (see @ref + * network_protocol "Network protocol"). + * - \b HMAC, covering the ciphertext IV + ciphertext. The HMAC size depends + * on the \c \-\-auth option. If \c \-\-auth \c none is specified, there is no + * HMAC at all. + * - \b Ciphertext \b IV, if not disabled by \c \-\-no-iv. The IV size depends on + * the \c \-\-cipher option. + * - \b Packet \b ID, a 32-bit incrementing packet counter that provides replay + * protection (if not disabled by \c \-\-no-replay). + * - \b Timestamp, a 32-bit timestamp of the current time. + * - \b Payload, the plain text network packet to be encrypted (unless + * encryption is disabled by using \c \-\-cipher \c none). The payload might + * already be compressed (see @ref compression "Compression module"). + * + * @par + * This section does not discuss the opcode and peer-id, since those do not + * depend on the data channel crypto. See @ref network_protocol + * "Network protocol" for more information on those. + * + * @par + * \e Legenda \n + * [ xxx ] = unprotected \n + * [ - xxx - ] = authenticated \n + * [ * xxx * ] = encrypted and authenticated + * + * @par + * CBC data channel cypto format \n + * In CBC mode, both TLS-mode and static key mode are supported. The IV + * consists of random bits to provide unpredictable IVs. \n + * CBC IV format: \n + * [ - random - ] \n + * CBC data channel crypto format in TLS-mode: \n + * [ HMAC ] [ - IV - ] [ * packet ID * ] [ * packet payload * ] \n + * CBC data channel crypto format in static key mode: \n + * [ HMAC ] [ - IV - ] [ * packet ID * ] [ * timestamp * ] + * [ * packet payload * ] + * + * @par + * CFB/OFB data channel crypto format \n + * CFB and OFB modes are only supported in TLS mode. In these modes, the IV + * consists of the packet counter and a timestamp. If the IV is more than 8 + * bytes long, the remaining space is filled with zeroes. The packet counter may + * not roll over within a single TLS sessions. This results in a unique IV for + * each packet, as required by the CFB and OFB cipher modes. + * + * @par + * CFB/OFB IV format: \n + * [ - packet ID - ] [ - timestamp - ] [ - opt: zero-padding - ] \n + * CFB/OFB data channel crypto format: \n + * [ HMAC ] [ - IV - ] [ * packet payload * ] + * + * @par + * No-crypto data channel format \n + * In no-crypto mode (\c \-\-cipher \c none is specified), both TLS-mode and + * static key mode are supported. No encryption will be performed on the packet, + * but packets can still be authenticated. This mode does not require an IV.\n + * No-crypto data channel crypto format in TLS-mode: \n + * [ HMAC ] [ - packet ID - ] [ - packet payload - ] \n + * No-crypto data channel crypto format in static key mode: \n + * [ HMAC ] [ - packet ID - ] [ - timestamp - ] [ - packet payload - ] + * */ #ifndef CRYPTO_H diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h index bc067a7..4e45df0 100644 --- a/src/openvpn/crypto_backend.h +++ b/src/openvpn/crypto_backend.h @@ -223,7 +223,7 @@ int cipher_kt_block_size (const cipher_kt_t *cipher_kt); /** * Returns the mode that the cipher runs in. * - * @param cipher_kt Static cipher parameters + * @param cipher_kt Static cipher parameters. May not be NULL. * * @return Cipher mode, either \c OPENVPN_MODE_CBC, \c * OPENVPN_MODE_OFB or \c OPENVPN_MODE_CFB @@ -233,22 +233,20 @@ int cipher_kt_mode (const cipher_kt_t *cipher_kt); /** * Check if the supplied cipher is a supported CBC mode cipher. * - * @param cipher Static cipher parameters. May not be NULL. + * @param cipher Static cipher parameters. * * @return true iff the cipher is a CBC mode cipher. */ -bool cipher_kt_mode_cbc(const cipher_kt_t *cipher) - __attribute__((nonnull)); +bool cipher_kt_mode_cbc(const cipher_kt_t *cipher); /** * Check if the supplied cipher is a supported OFB or CFB mode cipher. * - * @param cipher Static cipher parameters. May not be NULL. + * @param cipher Static cipher parameters. * * @return true iff the cipher is a OFB or CFB mode cipher. */ -bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher) - __attribute__((nonnull)); +bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher); /** diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index 4067701..348bdee 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -527,7 +527,7 @@ cipher_kt_mode (const EVP_CIPHER *cipher_kt) bool cipher_kt_mode_cbc(const cipher_kt_t *cipher) { - return cipher_kt_mode(cipher) == OPENVPN_MODE_CBC + return cipher && cipher_kt_mode(cipher) == OPENVPN_MODE_CBC #ifdef EVP_CIPH_FLAG_AEAD_CIPHER /* Exclude AEAD cipher modes, they require a different API */ && !(EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) @@ -538,7 +538,7 @@ cipher_kt_mode_cbc(const cipher_kt_t *cipher) bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher) { - return (cipher_kt_mode(cipher) == OPENVPN_MODE_OFB || + return cipher && (cipher_kt_mode(cipher) == OPENVPN_MODE_OFB || cipher_kt_mode(cipher) == OPENVPN_MODE_CFB) #ifdef EVP_CIPH_FLAG_AEAD_CIPHER /* Exclude AEAD cipher modes, they require a different API */ diff --git a/src/openvpn/crypto_polarssl.c b/src/openvpn/crypto_polarssl.c index 8bf8d8d..af79029 100644 --- a/src/openvpn/crypto_polarssl.c +++ b/src/openvpn/crypto_polarssl.c @@ -419,13 +419,13 @@ cipher_kt_mode (const cipher_info_t *cipher_kt) bool cipher_kt_mode_cbc(const cipher_kt_t *cipher) { - return cipher_kt_mode(cipher) == OPENVPN_MODE_CBC; + return cipher && cipher_kt_mode(cipher) == OPENVPN_MODE_CBC; } bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher) { - return (cipher_kt_mode(cipher) == OPENVPN_MODE_OFB || + return cipher && (cipher_kt_mode(cipher) == OPENVPN_MODE_OFB || cipher_kt_mode(cipher) == OPENVPN_MODE_CFB); } diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 7f0d083..217fbb3 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -331,6 +331,7 @@ void check_server_poll_timeout_dowork (struct context *c) { event_timeout_reset (&c->c2.server_poll_interval); + ASSERT(c->c2.tls_multi); if (!tls_initial_packet_received (c->c2.tls_multi)) { msg (M_INFO, "Server poll timeout, restarting"); diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c index 0ed0b2b..339e2ae 100644 --- a/src/openvpn/helper.c +++ b/src/openvpn/helper.c @@ -534,7 +534,7 @@ helper_tcp_nodelay (struct options *o) } else { - ASSERT (0); + o->sockflags |= SF_TCP_NODELAY; } } #endif diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 18f506c..c99e775 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -910,7 +910,6 @@ do_genkey (const struct options * options) bool do_persist_tuntap (const struct options *options) { -#ifdef ENABLE_FEATURE_TUN_PERSIST if (options->persist_config) { /* sanity check on options for --mktun or --rmtun */ @@ -926,14 +925,21 @@ do_persist_tuntap (const struct options *options) ) msg (M_FATAL|M_OPTERR, "options --mktun or --rmtun should only be used together with --dev"); +#ifdef ENABLE_FEATURE_TUN_PERSIST tuncfg (options->dev, options->dev_type, options->dev_node, options->persist_mode, options->username, options->groupname, &options->tuntap_options); if (options->persist_mode && options->lladdr) set_lladdr(options->dev, options->lladdr, NULL); return true; - } +#else + msg( M_FATAL|M_OPTERR, + "options --mktun and --rmtun are not available on your operating " + "system. Please check 'man tun' (or 'tap'), whether your system " + "supports using 'ifconfig %s create' / 'destroy' to create/remove " + "persistant tunnel interfaces.", options->dev ); #endif + } return false; } @@ -941,23 +947,20 @@ do_persist_tuntap (const struct options *options) * Should we become a daemon? * Return true if we did it. */ -static bool -possibly_become_daemon (const struct options *options, const bool first_time) +bool +possibly_become_daemon (const struct options *options) { bool ret = false; - if (first_time && options->daemon) + if (options->daemon) { ASSERT (!options->inetd); - if (daemon (options->cd_dir != NULL, options->log) < 0) + /* Don't chdir immediately, but the end of the init sequence, if needed */ + if (daemon (1, options->log) < 0) msg (M_ERR, "daemon() failed or unsupported"); restore_signal_state (); if (options->log) set_std_files_to_null (true); -#if defined(ENABLE_PKCS11) - pkcs11_forkFixup (); -#endif - ret = true; } return ret; @@ -1483,6 +1486,9 @@ do_open_tun (struct context *c) msg (M_INFO, "Preserving previous TUN/TAP instance: %s", c->c1.tuntap->actual_name); + /* explicitly set the ifconfig_* env vars */ + do_ifconfig_setenv(c->c1.tuntap, c->c2.es); + /* run the up script if user specified --up-restart */ if (c->options.up_restart) run_up_down (c->options.up_script, @@ -1711,7 +1717,8 @@ pull_permission_mask (const struct context *c) | OPT_P_MESSAGES | OPT_P_EXPLICIT_NOTIFY | OPT_P_ECHO - | OPT_P_PULL_MODE; + | OPT_P_PULL_MODE + | OPT_P_PEER_ID; if (!c->options.route_nopull) flags |= (OPT_P_ROUTE | OPT_P_IPWIN32); @@ -1790,21 +1797,39 @@ do_deferred_options (struct context *c, const unsigned int found) msg (D_PUSH, "OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified"); if (found & OPT_P_SETENV) msg (D_PUSH, "OPTIONS IMPORT: environment modified"); + +#ifdef ENABLE_SSL + if (found & OPT_P_PEER_ID) + { + msg (D_PUSH, "OPTIONS IMPORT: peer-id set"); + c->c2.tls_multi->use_peer_id = true; + c->c2.tls_multi->peer_id = c->options.peer_id; + frame_add_to_extra_frame(&c->c2.frame, +3); /* peer-id overhead */ + if ( !c->options.ce.link_mtu_defined ) + { + frame_add_to_link_mtu(&c->c2.frame, +3); + msg (D_PUSH, "OPTIONS IMPORT: adjusting link_mtu to %d", + EXPANDED_SIZE(&c->c2.frame)); + } + else + { + msg (M_WARN, "OPTIONS IMPORT: WARNING: peer-id set, but link-mtu" + " fixed by config - reducing tun-mtu to %d, expect" + " MTU problems", TUN_MTU_SIZE(&c->c2.frame) ); + } + } +#endif } /* * Possible hold on initialization */ static bool -do_hold (struct context *c) +do_hold (void) { #ifdef ENABLE_MANAGEMENT if (management) { - /* if c is defined, daemonize before hold */ - if (c && c->options.daemon && management_should_daemonize (management)) - do_init_first_time (c); - /* block until management hold is released */ if (management_hold (management)) return true; @@ -1870,7 +1895,7 @@ socket_restart_pause (struct context *c) c->persist.restart_sleep_seconds = 0; /* do managment hold on context restart, i.e. second, third, fourth, etc. initialization */ - if (do_hold (NULL)) + if (do_hold ()) sec = 0; if (sec) @@ -1889,7 +1914,7 @@ do_startup_pause (struct context *c) if (!c->first_time) socket_restart_pause (c); else - do_hold (NULL); /* do management hold on first context initialization */ + do_hold (); /* do management hold on first context initialization */ } /* @@ -2244,6 +2269,7 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.tmp_dir = options->tmp_dir; if (options->ccd_exclusive) to.client_config_dir_exclusive = options->client_config_dir; + to.auth_user_pass_file = options->auth_user_pass_file; #endif #ifdef ENABLE_X509_TRACK @@ -2390,6 +2416,17 @@ do_init_frame (struct context *c) */ frame_finalize_options (c, NULL); + /* packets with peer-id (P_DATA_V2) need 3 extra bytes in frame (on client) + * and need link_mtu+3 bytes on socket reception (on server). + * + * accomodate receive path in f->extra_link + * send path in f->extra_buffer (+leave room for alignment) + * + * f->extra_frame is adjusted when peer-id option is push-received + */ + frame_add_to_extra_link(&c->c2.frame, 3); + frame_add_to_extra_buffer(&c->c2.frame, 8); + #ifdef ENABLE_FRAGMENT /* * Set frame parameter for fragment code. This is necessary because @@ -2726,7 +2763,7 @@ do_compute_occ_strings (struct context *c) static void do_init_first_time (struct context *c) { - if (c->first_time && !c->did_we_daemonize && !c->c0) + if (c->first_time && !c->c0) { struct context_0 *c0; @@ -2741,12 +2778,9 @@ do_init_first_time (struct context *c) /* get --writepid file descriptor */ get_pid_file (c->options.writepid, &c0->pid_state); - /* become a daemon if --daemon */ - c->did_we_daemonize = possibly_become_daemon (&c->options, c->first_time); - - /* should we disable paging? */ - if (c->options.mlock && c->did_we_daemonize) - platform_mlockall (true); /* call again in case we daemonized */ + /* perform postponed chdir if --daemon */ + if (c->did_we_daemonize && c->options.cd_dir == NULL) + platform_chdir("/"); /* save process ID in a file */ write_pid (&c0->pid_state); @@ -3187,7 +3221,7 @@ open_management (struct context *c) } /* initial management hold, called early, before first context initialization */ - do_hold (c); + do_hold (); if (IS_SIG (c)) { msg (M_WARN, "Signal received from management interface, exiting"); diff --git a/src/openvpn/init.h b/src/openvpn/init.h index 5a1d1dc..d1908ed 100644 --- a/src/openvpn/init.h +++ b/src/openvpn/init.h @@ -55,6 +55,8 @@ bool do_genkey (const struct options *options); bool do_persist_tuntap (const struct options *options); +bool possibly_become_daemon (const struct options *options); + void pre_setup (const struct options *options); void init_instance_handle_signals (struct context *c, const struct env_set *env, const unsigned int flags); diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index 29ec21f..bccd681 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -257,6 +257,12 @@ frame_headroom (const struct frame *f, const unsigned int flag_mask) * frame member adjustment functions */ +static inline void +frame_add_to_link_mtu (struct frame *frame, const int increment) +{ + frame->link_mtu += increment; +} + static inline void frame_add_to_extra_frame (struct frame *frame, const int increment) { diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c index fd87fc1..2f327f3 100644 --- a/src/openvpn/openvpn.c +++ b/src/openvpn/openvpn.c @@ -229,6 +229,10 @@ openvpn_main (int argc, char *argv[]) if (do_test_crypto (&c.options)) break; + /* become a daemon if --daemon */ + if (c.first_time) + c.did_we_daemonize = possibly_become_daemon (&c.options); + #ifdef ENABLE_MANAGEMENT /* open management subsystem */ if (!open_management (&c)) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index fa53a17..ff4b07b 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -572,6 +572,7 @@ static const char usage_message[] = "--tls-version-min ['or-highest'] : sets the minimum TLS version we\n" " will accept from the peer. If version is unrecognized and 'or-highest'\n" " is specified, require max TLS version supported by SSL implementation.\n" + "--tls-version-max : sets the maximum TLS version we will use.\n" #ifndef ENABLE_CRYPTO_POLARSSL "--pkcs12 file : PKCS#12 file containing local private key, local certificate\n" " and optionally the root CA certificate.\n" @@ -739,7 +740,11 @@ static const char usage_message[] = #ifdef ENABLE_PKCS11 "\n" "PKCS#11 standalone options:\n" - "--show-pkcs11-ids provider [cert_private] : Show PKCS#11 available ids.\n" +#ifdef DEFAULT_PKCS11_MODULE + "--show-pkcs11-ids [provider] [cert_private] : Show PKCS#11 available ids.\n" +#else + "--show-pkcs11-ids provider [cert_private] : Show PKCS#11 available ids.\n" +#endif " --verb option can be added *BEFORE* this.\n" #endif /* ENABLE_PKCS11 */ "\n" @@ -1266,7 +1271,7 @@ option_iroute_ipv6 (struct options *o, ALLOC_OBJ_GC (ir, struct iroute_ipv6, &o->gc); - if ( get_ipv6_addr (prefix_str, &ir->network, &ir->netbits, NULL, msglevel ) < 0 ) + if ( !get_ipv6_addr (prefix_str, &ir->network, &ir->netbits, NULL, msglevel )) { msg (msglevel, "in --iroute-ipv6 %s: Bad IPv6 prefix specification", prefix_str); @@ -2125,7 +2130,9 @@ options_postprocess_verify_ce (const struct options *options, const struct conne if (options->ssl_flags & SSLF_OPT_VERIFY) msg (M_USAGE, "--opt-verify requires --mode server"); if (options->server_flags & SF_TCP_NODELAY_HELPER) - msg (M_USAGE, "--tcp-nodelay requires --mode server"); + msg (M_WARN, "WARNING: setting tcp-nodelay on the client side will not " + "affect the server. To have TCP_NODELAY in both direction use " + "tcp-nodelay in the server configuration instead."); if (options->auth_user_pass_verify_script) msg (M_USAGE, "--auth-user-pass-verify requires --mode server"); #if PORT_SHARE @@ -2330,6 +2337,9 @@ options_postprocess_verify_ce (const struct options *options, const struct conne MUST_BE_UNDEF (pkcs11_id); MUST_BE_UNDEF (pkcs11_id_management); #endif +#if P2MP + MUST_BE_UNDEF (server_poll_timeout); +#endif if (pull) msg (M_USAGE, err, "--pull"); @@ -2393,7 +2403,7 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce) { #ifdef ENABLE_FRAGMENT if (ce->fragment) - o->ce.mssfix = ce->fragment; + ce->mssfix = ce->fragment; #else msg (M_USAGE, "--mssfix must specify a parameter"); #endif @@ -2463,6 +2473,15 @@ options_postprocess_mutate_invariant (struct options *options) #endif } #endif + +#ifdef DEFAULT_PKCS11_MODULE + /* If p11-kit is present on the system then load its p11-kit-proxy.so + by default if the user asks for PKCS#11 without otherwise specifying + the module to use. */ + if (!options->pkcs11_providers[0] && + (options->pkcs11_id || options->pkcs11_id_management)) + options->pkcs11_providers[0] = DEFAULT_PKCS11_MODULE; +#endif } static void @@ -2537,6 +2556,24 @@ options_postprocess_mutate (struct options *o) else options_postprocess_mutate_ce (o, &o->ce); +#ifdef ENABLE_CRYPTOAPI + if (o->cryptoapi_cert) + { + const int tls_version_max = + (o->ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & + SSLF_TLS_VERSION_MAX_MASK; + + if (tls_version_max == TLS_VER_UNSPEC || tls_version_max > TLS_VER_1_1) + { + msg(M_WARN, "Warning: cryptapicert used, setting maximum TLS " + "version to 1.1."); + o->ssl_flags &= ~(SSLF_TLS_VERSION_MAX_MASK << + SSLF_TLS_VERSION_MAX_SHIFT); + o->ssl_flags |= (TLS_VER_1_1 << SSLF_TLS_VERSION_MAX_SHIFT); + } + } +#endif /* ENABLE_CRYPTOAPI */ + #if P2MP /* * Save certain parms before modifying options via --pull @@ -3718,12 +3755,21 @@ static char * read_inline_file (struct in_src *is, const char *close_tag, struct gc_arena *gc) { char line[OPTION_LINE_SIZE]; - struct buffer buf = alloc_buf (10000); + struct buffer buf = alloc_buf (8*OPTION_LINE_SIZE); char *ret; while (in_src_get (is, line, sizeof (line))) { if (!strncmp (line, close_tag, strlen (close_tag))) break; + if (!buf_safe (&buf, strlen(line))) + { + /* Increase buffer size */ + struct buffer buf2 = alloc_buf (buf.capacity * 2); + ASSERT (buf_copy (&buf2, &buf)); + buf_clear (&buf); + free_buf (&buf); + buf = buf2; + } buf_printf (&buf, "%s", line); } ret = string_alloc (BSTR (&buf), gc); @@ -6570,14 +6616,29 @@ add_option (struct options *options, { int ver; VERIFY_PERMISSION (OPT_P_GENERAL); - ver = tls_version_min_parse(p[1], p[2]); + ver = tls_version_parse(p[1], p[2]); if (ver == TLS_VER_BAD) { msg (msglevel, "unknown tls-version-min parameter: %s", p[1]); goto err; } - options->ssl_flags &= ~(SSLF_TLS_VERSION_MASK << SSLF_TLS_VERSION_SHIFT); - options->ssl_flags |= (ver << SSLF_TLS_VERSION_SHIFT); + options->ssl_flags &= + ~(SSLF_TLS_VERSION_MIN_MASK << SSLF_TLS_VERSION_MIN_SHIFT); + options->ssl_flags |= (ver << SSLF_TLS_VERSION_MIN_SHIFT); + } + else if (streq (p[0], "tls-version-max") && p[1]) + { + int ver; + VERIFY_PERMISSION (OPT_P_GENERAL); + ver = tls_version_parse(p[1], NULL); + if (ver == TLS_VER_BAD) + { + msg (msglevel, "unknown tls-version-max parameter: %s", p[1]); + goto err; + } + options->ssl_flags &= + ~(SSLF_TLS_VERSION_MAX_MASK << SSLF_TLS_VERSION_MAX_SHIFT); + options->ssl_flags |= (ver << SSLF_TLS_VERSION_MAX_SHIFT); } #ifndef ENABLE_CRYPTO_POLARSSL else if (streq (p[0], "pkcs12") && p[1]) @@ -6903,11 +6964,34 @@ add_option (struct options *options, #endif /* ENABLE_SSL */ #endif /* ENABLE_CRYPTO */ #ifdef ENABLE_PKCS11 - else if (streq (p[0], "show-pkcs11-ids") && p[1]) + else if (streq (p[0], "show-pkcs11-ids")) { char *provider = p[1]; bool cert_private = (p[2] == NULL ? false : ( atoi (p[2]) != 0 )); +#ifdef DEFAULT_PKCS11_MODULE + if (!provider) + provider = DEFAULT_PKCS11_MODULE; + else if (!p[2]) + { + char *endp = NULL; + int i = strtol(provider, &endp, 10); + + if (*endp == 0) + { + /* There was one argument, and it was purely numeric. + Interpret it as the cert_private argument */ + provider = DEFAULT_PKCS11_MODULE; + cert_private = i; + } + } +#else + if (!provider) + { + msg (msglevel, "--show-pkcs11-ids requires a provider parameter"); + goto err; + } +#endif VERIFY_PERMISSION (OPT_P_GENERAL); set_debug_level (options->verbosity, SDL_CONSTRAIN); @@ -6966,7 +7050,6 @@ add_option (struct options *options, options->pkcs11_id_management = true; } #endif -#ifdef ENABLE_FEATURE_TUN_PERSIST else if (streq (p[0], "rmtun")) { VERIFY_PERMISSION (OPT_P_GENERAL); @@ -6979,7 +7062,12 @@ add_option (struct options *options, options->persist_config = true; options->persist_mode = 1; } -#endif + else if (streq (p[0], "peer-id") && p[1]) + { + VERIFY_PERMISSION (OPT_P_PEER_ID); + options->use_peer_id = true; + options->peer_id = atoi(p[1]); + } else { int i; diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 2c18838..af9a47f 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -594,6 +594,9 @@ struct options bool show_net_up; int route_method; #endif + + bool use_peer_id; + uint32_t peer_id; }; #define streq(x, y) (!strcmp((x), (y))) @@ -629,6 +632,7 @@ struct options #define OPT_P_SOCKBUF (1<<25) #define OPT_P_SOCKFLAGS (1<<26) #define OPT_P_CONNECTION (1<<27) +#define OPT_P_PEER_ID (1<<28) #define OPT_P_DEFAULT (~(OPT_P_INSTANCE|OPT_P_PULL_MODE)) diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c index 3a15ef6..a1f13c5 100644 --- a/src/openvpn/pkcs11.c +++ b/src/openvpn/pkcs11.c @@ -336,11 +336,6 @@ pkcs11_terminate () { ); } -void -pkcs11_forkFixup () { - pkcs11h_forkFixup (); -} - bool pkcs11_addProvider ( const char * const provider, diff --git a/src/openvpn/pkcs11.h b/src/openvpn/pkcs11.h index 4261871..b49401c 100644 --- a/src/openvpn/pkcs11.h +++ b/src/openvpn/pkcs11.h @@ -38,9 +38,6 @@ pkcs11_initialize ( void pkcs11_terminate (); -void -pkcs11_forkFixup (); - bool pkcs11_addProvider ( const char * const provider, diff --git a/src/openvpn/route.c b/src/openvpn/route.c index cc85e4d..2acfbe8 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -838,7 +838,7 @@ redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *tt, u if ( rl && rl->flags & RG_ENABLE ) { - if (!(rl->spec.flags & RTSA_REMOTE_ENDPOINT)) + if (!(rl->spec.flags & RTSA_REMOTE_ENDPOINT) && (rl->flags & RG_REROUTE_GW)) { msg (M_WARN, "%s VPN gateway parameter (--route-gateway or --ifconfig) is missing", err); } @@ -2601,7 +2601,7 @@ get_default_gateway (struct route_gateway_info *rgi) gc_free (&gc); } -#elif defined(TARGET_FREEBSD)||defined(TARGET_DRAGONFLY) +#elif defined(TARGET_FREEBSD)||defined(TARGET_DRAGONFLY)||defined(TARGET_SOLARIS) #include #include @@ -2629,6 +2629,8 @@ get_default_gateway (struct route_gateway_info *rgi) struct sockaddr *gate = NULL, *sa; struct rt_msghdr *rtm_aux; +#if defined(TARGET_FREEBSD)||defined(TARGET_DRAGONFLY) + #define NEXTADDR(w, u) \ if (rtm_addrs & (w)) {\ l = ROUNDUP(u.sa_len); memmove(cp, &(u), l); cp += l;\ @@ -2636,6 +2638,18 @@ get_default_gateway (struct route_gateway_info *rgi) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +#else /* TARGET_SOLARIS */ + +#define NEXTADDR(w, u) \ + if (rtm_addrs & (w)) {\ + l = ROUNDUP(sizeof(struct sockaddr_in)); memmove(cp, &(u), l); cp += l;\ + } + +#define ADVANCE(x, n) (x += ROUNDUP(sizeof(struct sockaddr_in))) + +#endif + + #define rtm m_rtmsg.m_rtm CLEAR(*rgi); @@ -2655,9 +2669,12 @@ get_default_gateway (struct route_gateway_info *rgi) rtm.rtm_addrs = rtm_addrs; so_dst.sa_family = AF_INET; - so_dst.sa_len = sizeof(struct sockaddr_in); so_mask.sa_family = AF_INET; + +#if defined(TARGET_FREEBSD)||defined(TARGET_DRAGONFLY) + so_dst.sa_len = sizeof(struct sockaddr_in); so_mask.sa_len = sizeof(struct sockaddr_in); +#endif NEXTADDR(RTA_DST, so_dst); NEXTADDR(RTA_NETMASK, so_mask); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 6e68c18..0424c0b 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -137,10 +137,6 @@ openvpn_getaddrinfo (unsigned int flags, ASSERT(res); -#if defined(HAVE_RES_INIT) - res_init (); -#endif - if (!hostname) hostname = "::"; @@ -197,6 +193,9 @@ openvpn_getaddrinfo (unsigned int flags, */ while (true) { +#ifndef WIN32 + res_init (); +#endif /* try hostname lookup */ hints.ai_flags = 0; dmsg (D_SOCKET_DEBUG, "GETADDRINFO flags=0x%04x ai_family=%d ai_socktype=%d", @@ -215,10 +214,13 @@ openvpn_getaddrinfo (unsigned int flags, } else { + /* turn success into failure (interrupted syscall) */ if (0 == status) { ASSERT(res); freeaddrinfo(*res); - res = NULL; + *res = NULL; + status = EAI_AGAIN; /* = temporary failure */ + errno = EINTR; } goto done; } diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index ac6818e..a17c738 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -271,7 +271,7 @@ tls_get_cipher_name_pair (const char * cipher_name, size_t len) { * Max number of bytes we will add * for data structures common to both * data and control channel packets. - * (opcode only). + * (opcode only). */ void tls_adjust_frame_parameters(struct frame *frame) @@ -458,7 +458,7 @@ ssl_put_auth_challenge (const char *cr_str) * return tls_version_max(). */ int -tls_version_min_parse(const char *vstr, const char *extra) +tls_version_parse(const char *vstr, const char *extra) { const int max_version = tls_version_max(); if (!strcmp(vstr, "1.0") && TLS_VER_1_0 <= max_version) @@ -627,6 +627,8 @@ packet_opcode_name (int op) return "P_ACK_V1"; case P_DATA_V1: return "P_DATA_V1"; + case P_DATA_V2: + return "P_DATA_V2"; default: return "P_???"; } @@ -1053,6 +1055,9 @@ tls_multi_init (struct tls_options *tls_options) ret->key_scan[1] = &ret->session[TM_ACTIVE].key[KS_LAME_DUCK]; ret->key_scan[2] = &ret->session[TM_LAME_DUCK].key[KS_LAME_DUCK]; + /* By default not use P_DATA_V2 */ + ret->use_peer_id = false; + return ret; } @@ -1828,6 +1833,8 @@ push_peer_info(struct buffer *buf, struct tls_session *session) #ifdef ENABLE_LZO_STUB buf_printf (&out, "IV_LZO_STUB=1\n"); #endif + /* support for P_DATA_V2 */ + buf_printf(&out, "IV_PROTO=2\n"); if (session->opt->push_peer_info_detail >= 2) { @@ -1898,9 +1905,9 @@ key_method_2_write (struct buffer *buf, struct tls_session *session) if (auth_user_pass_enabled) { #ifdef ENABLE_CLIENT_CR - auth_user_pass_setup (NULL, session->opt->sci); + auth_user_pass_setup (session->opt->auth_user_pass_file, session->opt->sci); #else - auth_user_pass_setup (NULL, NULL); + auth_user_pass_setup (session->opt->auth_user_pass_file, NULL); #endif if (!write_string (buf, auth_user_pass.username, -1)) goto error; @@ -2028,7 +2035,11 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi ASSERT (session->opt->key_method == 2); /* discard leading uint32 */ - ASSERT (buf_advance (buf, 4)); + if (!buf_advance (buf, 4)) { + msg (D_TLS_ERRORS, "TLS ERROR: Plaintext buffer too short (%d bytes).", + buf->len); + goto error; + } /* get key method */ key_method_flags = buf_read_u8 (buf); @@ -2777,8 +2788,9 @@ tls_pre_decrypt (struct tls_multi *multi, key_id = c & P_KEY_ID_MASK; } - if (op == P_DATA_V1) - { /* data channel packet */ + if ((op == P_DATA_V1) || (op == P_DATA_V2)) + { + /* data channel packet */ for (i = 0; i < KEY_SCAN_SIZE; ++i) { struct key_state *ks = multi->key_scan[i]; @@ -2810,7 +2822,19 @@ tls_pre_decrypt (struct tls_multi *multi, opt->pid_persist = NULL; opt->flags &= multi->opt.crypto_flags_and; opt->flags |= multi->opt.crypto_flags_or; + ASSERT (buf_advance (buf, 1)); + if (op == P_DATA_V2) + { + if (buf->len < 4) + { + msg (D_TLS_ERRORS, "Protocol error: received P_DATA_V2 from %s but length is < 4", + print_link_socket_actual (from, &gc)); + goto error; + } + ASSERT (buf_advance (buf, 3)); + } + ++ks->n_packets; ks->n_bytes += buf->len; dmsg (D_TLS_KEYSELECT, @@ -3375,14 +3399,24 @@ tls_post_encrypt (struct tls_multi *multi, struct buffer *buf) { struct key_state *ks; uint8_t *op; + uint32_t peer; ks = multi->save_ks; multi->save_ks = NULL; if (buf->len > 0) { ASSERT (ks); - ASSERT (op = buf_prepend (buf, 1)); - *op = (P_DATA_V1 << P_OPCODE_SHIFT) | ks->key_id; + + if (!multi->opt.server && multi->use_peer_id) + { + peer = htonl(((P_DATA_V2 << P_OPCODE_SHIFT) | ks->key_id) << 24 | (multi->peer_id & 0xFFFFFF)); + ASSERT (buf_write_prepend (buf, &peer, 4)); + } + else + { + ASSERT (op = buf_prepend (buf, 1)); + *op = (P_DATA_V1 << P_OPCODE_SHIFT) | ks->key_id; + } ++ks->n_packets; ks->n_bytes += buf->len; } @@ -3489,7 +3523,7 @@ protocol_dump (struct buffer *buffer, unsigned int flags, struct gc_arena *gc) key_id = c & P_KEY_ID_MASK; buf_printf (&out, "%s kid=%d", packet_opcode_name (op), key_id); - if (op == P_DATA_V1) + if ((op == P_DATA_V1) || (op == P_DATA_V2)) goto print_data; /* diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index cd7cae2..6a14768 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -61,6 +61,7 @@ #define P_CONTROL_V1 4 /* control channel packet (usually TLS ciphertext) */ #define P_ACK_V1 5 /* acknowledgement for packets received */ #define P_DATA_V1 6 /* data channel packet */ +#define P_DATA_V2 9 /* data channel packet with peer-id */ /* indicates key_method >= 2 */ #define P_CONTROL_HARD_RESET_CLIENT_V2 7 /* initial key from client, forget previous state */ @@ -68,7 +69,7 @@ /* define the range of legal opcodes */ #define P_FIRST_OPCODE 1 -#define P_LAST_OPCODE 8 +#define P_LAST_OPCODE 9 /* Should we aggregate TLS * acknowledgements, and tack them onto diff --git a/src/openvpn/ssl_backend.h b/src/openvpn/ssl_backend.h index fc23175..6d47bd0 100644 --- a/src/openvpn/ssl_backend.h +++ b/src/openvpn/ssl_backend.h @@ -114,7 +114,7 @@ void tls_clear_error(); #define TLS_VER_1_0 1 #define TLS_VER_1_1 2 #define TLS_VER_1_2 3 -int tls_version_min_parse(const char *vstr, const char *extra); +int tls_version_parse(const char *vstr, const char *extra); /** * Return the maximum TLS version (as a TLS_VER_x constant) diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index 66b6492..449172d 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -277,6 +277,7 @@ struct tls_options const char *auth_user_pass_verify_script; bool auth_user_pass_verify_script_via_file; const char *tmp_dir; + const char *auth_user_pass_file; /* use the client-config-dir as a positive authenticator */ const char *client_config_dir_exclusive; @@ -291,8 +292,10 @@ struct tls_options # define SSLF_AUTH_USER_PASS_OPTIONAL (1<<2) # define SSLF_OPT_VERIFY (1<<4) # define SSLF_CRL_VERIFY_DIR (1<<5) -# define SSLF_TLS_VERSION_SHIFT 6 -# define SSLF_TLS_VERSION_MASK 0xF /* (uses bit positions 6 to 9) */ +# define SSLF_TLS_VERSION_MIN_SHIFT 6 +# define SSLF_TLS_VERSION_MIN_MASK 0xF /* (uses bit positions 6 to 9) */ +# define SSLF_TLS_VERSION_MAX_SHIFT 10 +# define SSLF_TLS_VERSION_MAX_MASK 0xF /* (uses bit positions 10 to 13) */ unsigned int ssl_flags; #ifdef MANAGEMENT_DEF_AUTH @@ -488,6 +491,10 @@ struct tls_multi time_t tas_last; #endif + /* For P_DATA_V2 */ + uint32_t peer_id; + bool use_peer_id; + /* * Our session objects. */ @@ -498,4 +505,9 @@ struct tls_multi }; +#define SHOW_TLS_CIPHER_LIST_WARNING \ + "Be aware that that whether a cipher suite in this list can actually work\n" \ + "depends on the specific setup of both peers. See the man page entries of\n" \ + "--tls-cipher and --show-tls for more details.\n\n" + #endif /* SSL_COMMON_H_ */ diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index e77b736..be33caa 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -121,14 +121,15 @@ tmp_rsa_cb (SSL * s, int is_export, int keylength) void tls_ctx_server_new(struct tls_root_ctx *ctx, unsigned int ssl_flags) { - const int tls_version_min = (ssl_flags >> SSLF_TLS_VERSION_SHIFT) & SSLF_TLS_VERSION_MASK; + const int tls_version_max = + (ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & SSLF_TLS_VERSION_MAX_MASK; ASSERT(NULL != ctx); - if (tls_version_min > TLS_VER_UNSPEC) - ctx->ctx = SSL_CTX_new (SSLv23_server_method ()); - else + if (tls_version_max == TLS_VER_1_0) ctx->ctx = SSL_CTX_new (TLSv1_server_method ()); + else + ctx->ctx = SSL_CTX_new (SSLv23_server_method ()); if (ctx->ctx == NULL) msg (M_SSLERR, "SSL_CTX_new SSLv23_server_method"); @@ -139,14 +140,15 @@ tls_ctx_server_new(struct tls_root_ctx *ctx, unsigned int ssl_flags) void tls_ctx_client_new(struct tls_root_ctx *ctx, unsigned int ssl_flags) { - const int tls_version_min = (ssl_flags >> SSLF_TLS_VERSION_SHIFT) & SSLF_TLS_VERSION_MASK; + const int tls_version_max = + (ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & SSLF_TLS_VERSION_MAX_MASK; ASSERT(NULL != ctx); - if (tls_version_min > TLS_VER_UNSPEC) - ctx->ctx = SSL_CTX_new (SSLv23_client_method ()); - else + if (tls_version_max == TLS_VER_1_0) ctx->ctx = SSL_CTX_new (TLSv1_client_method ()); + else + ctx->ctx = SSL_CTX_new (SSLv23_client_method ()); if (ctx->ctx == NULL) msg (M_SSLERR, "SSL_CTX_new SSLv23_client_method"); @@ -218,16 +220,27 @@ tls_ctx_set_options (struct tls_root_ctx *ctx, unsigned int ssl_flags) /* process SSL options including minimum TLS version we will accept from peer */ { long sslopt = SSL_OP_SINGLE_DH_USE | SSL_OP_NO_TICKET | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3; - const int tls_version_min = (ssl_flags >> SSLF_TLS_VERSION_SHIFT) & SSLF_TLS_VERSION_MASK; - if (tls_version_min > TLS_VER_1_0) + const int tls_ver_min = + (ssl_flags >> SSLF_TLS_VERSION_MIN_SHIFT) & SSLF_TLS_VERSION_MIN_MASK; + int tls_ver_max = + (ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & SSLF_TLS_VERSION_MAX_MASK; + + if (tls_ver_max <= TLS_VER_UNSPEC) + tls_ver_max = tls_version_max(); + + if (tls_ver_min > TLS_VER_1_0 || tls_ver_max < TLS_VER_1_0) sslopt |= SSL_OP_NO_TLSv1; #ifdef SSL_OP_NO_TLSv1_1 - if (tls_version_min > TLS_VER_1_1) + if (tls_ver_min > TLS_VER_1_1 || tls_ver_max < TLS_VER_1_1) sslopt |= SSL_OP_NO_TLSv1_1; #endif #ifdef SSL_OP_NO_TLSv1_2 - if (tls_version_min > TLS_VER_1_2) + if (tls_ver_min > TLS_VER_1_2 || tls_ver_max < TLS_VER_1_2) sslopt |= SSL_OP_NO_TLSv1_2; +#endif +#ifdef SSL_OP_NO_COMPRESSION + /* Disable compression - flag not available in OpenSSL 0.9.8 */ + sslopt |= SSL_OP_NO_COMPRESSION; #endif SSL_CTX_set_options (ctx->ctx, sslopt); } @@ -1327,7 +1340,7 @@ show_available_tls_ciphers (const char *cipher_list) } } - printf ("\n"); + printf ("\n" SHOW_TLS_CIPHER_LIST_WARNING); SSL_free (ssl); SSL_CTX_free (tls_ctx.ctx); diff --git a/src/openvpn/ssl_polarssl.c b/src/openvpn/ssl_polarssl.c index 5718c8c..30c7395 100644 --- a/src/openvpn/ssl_polarssl.c +++ b/src/openvpn/ssl_polarssl.c @@ -654,6 +654,40 @@ tls_version_max(void) #endif } +/** + * Convert an OpenVPN tls-version variable to PolarSSl format (i.e. a major and + * minor ssl version number). + * + * @param tls_ver The tls-version variable to convert. + * @param major Returns the TLS major version in polarssl format. + * Must be a valid pointer. + * @param minor Returns the TLS minor version in polarssl format. + * Must be a valid pointer. + */ +static void tls_version_to_major_minor(int tls_ver, int *major, int *minor) { + ASSERT(major); + ASSERT(minor); + + switch (tls_ver) + { + case TLS_VER_1_0: + *major = SSL_MAJOR_VERSION_3; + *minor = SSL_MINOR_VERSION_1; + break; + case TLS_VER_1_1: + *major = SSL_MAJOR_VERSION_3; + *minor = SSL_MINOR_VERSION_2; + break; + case TLS_VER_1_2: + *major = SSL_MAJOR_VERSION_3; + *minor = SSL_MINOR_VERSION_3; + break; + default: + msg(M_FATAL, "%s: invalid TLS version %d", __func__, tls_ver); + break; + } +} + void key_state_ssl_init(struct key_state_ssl *ks_ssl, const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session) { @@ -712,30 +746,32 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl, /* Initialize minimum TLS version */ { - const int tls_version_min = (session->opt->ssl_flags >> SSLF_TLS_VERSION_SHIFT) & SSLF_TLS_VERSION_MASK; - int polar_major; - int polar_minor; - switch (tls_version_min) + const int tls_version_min = + (session->opt->ssl_flags >> SSLF_TLS_VERSION_MIN_SHIFT) & + SSLF_TLS_VERSION_MIN_MASK; + + /* default to TLS 1.0 */ + int major = SSL_MAJOR_VERSION_3; + int minor = SSL_MINOR_VERSION_1; + + if (tls_version_min > TLS_VER_UNSPEC) + tls_version_to_major_minor(tls_version_min, &major, &minor); + + ssl_set_min_version(ks_ssl->ctx, major, minor); + } + + /* Initialize maximum TLS version */ + { + const int tls_version_max = + (session->opt->ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT) & + SSLF_TLS_VERSION_MAX_MASK; + + if (tls_version_max > TLS_VER_UNSPEC) { - case TLS_VER_1_0: - default: - polar_major = SSL_MAJOR_VERSION_3; - polar_minor = SSL_MINOR_VERSION_1; - break; -#if defined(SSL_MAJOR_VERSION_3) && defined(SSL_MINOR_VERSION_2) - case TLS_VER_1_1: - polar_major = SSL_MAJOR_VERSION_3; - polar_minor = SSL_MINOR_VERSION_2; - break; -#endif -#if defined(SSL_MAJOR_VERSION_3) && defined(SSL_MINOR_VERSION_3) - case TLS_VER_1_2: - polar_major = SSL_MAJOR_VERSION_3; - polar_minor = SSL_MINOR_VERSION_3; - break; -#endif + int major, minor; + tls_version_to_major_minor(tls_version_max, &major, &minor); + ssl_set_max_version(ks_ssl->ctx, major, minor); } - ssl_set_min_version(ks_ssl->ctx, polar_major, polar_minor); } /* Initialise BIOs */ @@ -1059,7 +1095,7 @@ show_available_tls_ciphers (const char *cipher_list) printf ("%s\n", ssl_get_ciphersuite_name(*ciphers)); ciphers++; } - printf ("\n"); + printf ("\n" SHOW_TLS_CIPHER_LIST_WARNING); } void diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index c90c2c3..9693b81 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -596,7 +596,7 @@ verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_dep { result_t ret = FAILURE; char *subject = NULL; - char common_name[TLS_USERNAME_LEN] = {0}; + char common_name[TLS_USERNAME_LEN+1] = {0}; /* null-terminated */ const struct tls_options *opt; struct gc_arena gc = gc_new(); @@ -619,7 +619,7 @@ verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_dep string_replace_leading (subject, '-', '_'); /* extract the username (default is CN) */ - if (SUCCESS != x509_get_username (common_name, TLS_USERNAME_LEN, + if (SUCCESS != x509_get_username (common_name, sizeof(common_name), opt->x509_username_field, cert)) { if (!cert_depth) @@ -1165,7 +1165,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi, s2 = verify_user_pass_script (session, up); /* check sizing of username if it will become our common name */ - if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME) && strlen (up->username) >= TLS_USERNAME_LEN) + if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME) && strlen (up->username) > TLS_USERNAME_LEN) { msg (D_TLS_ERRORS, "TLS Auth Error: --username-as-common name specified and username is longer than the maximum permitted Common Name length of %d characters", TLS_USERNAME_LEN); s1 = OPENVPN_PLUGIN_FUNC_ERROR; diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index f957a10..7075b96 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -214,10 +214,6 @@ #ifdef TARGET_LINUX -#if defined(HAVE_NETINET_IF_ETHER_H) -#include -#endif - #ifdef HAVE_LINUX_IF_TUN_H #include #endif diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index ba4b15e..285e774 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -395,6 +395,49 @@ is_tun_p2p (const struct tuntap *tt) return tun; } +/* + * Set the ifconfig_* environment variables, both for IPv4 and IPv6 + */ +void +do_ifconfig_setenv (const struct tuntap *tt, struct env_set *es) +{ + struct gc_arena gc = gc_new (); + const char *ifconfig_local = print_in_addr_t (tt->local, 0, &gc); + const char *ifconfig_remote_netmask = print_in_addr_t (tt->remote_netmask, 0, &gc); + + /* + * Set environmental variables with ifconfig parameters. + */ + if (tt->did_ifconfig_setup) + { + bool tun = is_tun_p2p (tt); + + setenv_str (es, "ifconfig_local", ifconfig_local); + if (tun) + { + setenv_str (es, "ifconfig_remote", ifconfig_remote_netmask); + } + else + { + const char *ifconfig_broadcast = print_in_addr_t (tt->broadcast, 0, &gc); + setenv_str (es, "ifconfig_netmask", ifconfig_remote_netmask); + setenv_str (es, "ifconfig_broadcast", ifconfig_broadcast); + } + } + + if (tt->did_ifconfig_ipv6_setup) + { + const char *ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); + const char *ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); + + setenv_str (es, "ifconfig_ipv6_local", ifconfig_ipv6_local); + setenv_int (es, "ifconfig_ipv6_netbits", tt->netbits_ipv6); + setenv_str (es, "ifconfig_ipv6_remote", ifconfig_ipv6_remote); + } + + gc_free (&gc); +} + /* * Init tun/tap object. * @@ -427,9 +470,6 @@ init_tun (const char *dev, /* --dev option */ if (ifconfig_local_parm && ifconfig_remote_netmask_parm) { bool tun = false; - const char *ifconfig_local = NULL; - const char *ifconfig_remote_netmask = NULL; - const char *ifconfig_broadcast = NULL; /* * We only handle TUN/TAP devices here, not --dev null devices. @@ -490,45 +530,20 @@ init_tun (const char *dev, /* --dev option */ check_subnet_conflict (tt->local, IPV4_NETMASK_HOST, "TUN/TAP adapter"); } - /* - * Set ifconfig parameters - */ - ifconfig_local = print_in_addr_t (tt->local, 0, &gc); - ifconfig_remote_netmask = print_in_addr_t (tt->remote_netmask, 0, &gc); - /* * If TAP-style interface, generate broadcast address. */ if (!tun) { tt->broadcast = generate_ifconfig_broadcast_addr (tt->local, tt->remote_netmask); - ifconfig_broadcast = print_in_addr_t (tt->broadcast, 0, &gc); } - /* - * Set environmental variables with ifconfig parameters. - */ - if (es) - { - setenv_str (es, "ifconfig_local", ifconfig_local); - if (tun) - { - setenv_str (es, "ifconfig_remote", ifconfig_remote_netmask); - } - else - { - setenv_str (es, "ifconfig_netmask", ifconfig_remote_netmask); - setenv_str (es, "ifconfig_broadcast", ifconfig_broadcast); - } - } tt->did_ifconfig_setup = true; } if (ifconfig_ipv6_local_parm && ifconfig_ipv6_remote_parm) { - const char *ifconfig_ipv6_local = NULL; - const char *ifconfig_ipv6_remote = NULL; /* * Convert arguments to binary IPv6 addresses. @@ -541,24 +556,14 @@ init_tun (const char *dev, /* --dev option */ } tt->netbits_ipv6 = ifconfig_ipv6_netbits_parm; - /* - * Set ifconfig parameters - */ - ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); - ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); - - /* - * Set environmental variables with ifconfig parameters. - */ - if (es) - { - setenv_str (es, "ifconfig_ipv6_local", ifconfig_ipv6_local); - setenv_int (es, "ifconfig_ipv6_netbits", tt->netbits_ipv6); - setenv_str (es, "ifconfig_ipv6_remote", ifconfig_ipv6_remote); - } tt->did_ifconfig_ipv6_setup = true; } + /* + * Set environmental variables with ifconfig parameters. + */ + if (es) do_ifconfig_setenv(tt, es); + gc_free (&gc); return tt; } @@ -618,6 +623,28 @@ void delete_route_connected_v6_net(struct tuntap * tt, } #endif +#if defined(TARGET_FREEBSD)||defined(TARGET_DRAGONFLY) +/* we can't use true subnet mode on tun on all platforms, as that + * conflicts with IPv6 (wants to use ND then, which we don't do), + * but the OSes want "a remote address that is different from ours" + * - so we construct one, normally the first in the subnet, but if + * this is the same as ours, use the second one. + * The actual address does not matter at all, as the tun interface + * is still point to point and no layer 2 resolution is done... + */ + +char * +create_arbitrary_remote( struct tuntap *tt, struct gc_arena * gc ) +{ + in_addr_t remote; + + remote = (tt->local & tt->remote_netmask) +1; + + if ( remote == tt->local ) remote ++; + + return print_in_addr_t (remote, 0, &gc); +} +#endif /* execute the ifconfig command through the shell */ void @@ -1114,7 +1141,7 @@ do_ifconfig (struct tuntap *tt, IFCONFIG_PATH, actual, ifconfig_local, - ifconfig_local, + create_arbitrary_remote( tt, &gc ), tun_mtu, ifconfig_remote_netmask ); @@ -1710,9 +1737,9 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len) pi.flags = 0; if(iph->version == 6) - pi.proto = htons(ETH_P_IPV6); + pi.proto = htons(OPENVPN_ETH_P_IPV6); else - pi.proto = htons(ETH_P_IP); + pi.proto = htons(OPENVPN_ETH_P_IPV4); vect[0].iov_len = sizeof(pi); vect[0].iov_base = π diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 1931c52..7089f7c 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -241,6 +241,9 @@ void init_tun_post (struct tuntap *tt, const struct frame *frame, const struct tuntap_options *options); +void do_ifconfig_setenv (const struct tuntap *tt, + struct env_set *es); + void do_ifconfig (struct tuntap *tt, const char *actual, /* actual device name */ int tun_mtu, diff --git a/src/openvpnserv/Makefile.in b/src/openvpnserv/Makefile.in index 272fd90..495b569 100644 --- a/src/openvpnserv/Makefile.in +++ b/src/openvpnserv/Makefile.in @@ -261,6 +261,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -376,9 +378,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/ltrc.inc $(am_ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/openvpnserv/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/openvpnserv/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/openvpnserv/Makefile + $(AUTOMAKE) --foreign src/openvpnserv/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index 8b73edc..de927c9 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -257,6 +257,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -361,9 +363,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/plugins/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/plugins/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugins/Makefile + $(AUTOMAKE) --foreign src/plugins/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/plugins/auth-pam/Makefile.in b/src/plugins/auth-pam/Makefile.in index 1e1547a..aee6561 100644 --- a/src/plugins/auth-pam/Makefile.in +++ b/src/plugins/auth-pam/Makefile.in @@ -281,6 +281,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -404,9 +406,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/plugins/auth-pam/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/plugins/auth-pam/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugins/auth-pam/Makefile + $(AUTOMAKE) --foreign src/plugins/auth-pam/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/plugins/down-root/Makefile.in b/src/plugins/down-root/Makefile.in index 26c4912..f19e012 100644 --- a/src/plugins/down-root/Makefile.in +++ b/src/plugins/down-root/Makefile.in @@ -280,6 +280,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -398,9 +400,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/plugins/down-root/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/plugins/down-root/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugins/down-root/Makefile + $(AUTOMAKE) --foreign src/plugins/down-root/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/src/plugins/down-root/down-root.c b/src/plugins/down-root/down-root.c index d51d0e5..6931bec 100644 --- a/src/plugins/down-root/down-root.c +++ b/src/plugins/down-root/down-root.c @@ -5,7 +5,8 @@ * packet encryption, packet authentication, and * packet compression. * - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. + * Copyright (C) 2002-2013 OpenVPN Technologies, Inc. + * Copyright (C) 2013 David Sommerseth * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -40,14 +41,16 @@ #include #include #include +#include +#include #include #define DEBUG(verb) ((verb) >= 7) /* Command codes for foreground -> background communication */ -#define COMMAND_RUN_SCRIPT 0 -#define COMMAND_EXIT 1 +#define COMMAND_RUN_SCRIPT 1 +#define COMMAND_EXIT 2 /* Response codes for background -> foreground communication */ #define RESPONSE_INIT_SUCCEEDED 10 @@ -56,24 +59,24 @@ #define RESPONSE_SCRIPT_FAILED 13 /* Background process function */ -static void down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb); +static void down_root_server (const int fd, char * const * argv, char * const *envp, const int verb); /* * Plugin state, used by foreground */ struct down_root_context { - /* Foreground's socket to background process */ - int foreground_fd; + /* Foreground's socket to background process */ + int foreground_fd; - /* Process ID of background process */ - pid_t background_pid; + /* Process ID of background process */ + pid_t background_pid; - /* Verbosity level of OpenVPN */ - int verb; + /* Verbosity level of OpenVPN */ + int verb; - /* down command */ - char *command; + /* down command */ + char **command; }; /* @@ -84,21 +87,21 @@ struct down_root_context static const char * get_env (const char *name, const char *envp[]) { - if (envp) + if (envp) { - int i; - const int namelen = strlen (name); - for (i = 0; envp[i]; ++i) - { - if (!strncmp (envp[i], name, namelen)) - { - const char *cp = envp[i] + namelen; - if (*cp == '=') - return cp + 1; - } - } + int i; + const int namelen = strlen (name); + for (i = 0; envp[i]; ++i) + { + if (!strncmp (envp[i], name, namelen)) + { + const char *cp = envp[i] + namelen; + if (*cp == '=') + return cp + 1; + } + } } - return NULL; + return NULL; } /* @@ -107,13 +110,13 @@ get_env (const char *name, const char *envp[]) static int string_array_len (const char *array[]) { - int i = 0; - if (array) + int i = 0; + if (array) { - while (array[i]) - ++i; + while (array[i]) + ++i; } - return i; + return i; } /* @@ -123,23 +126,23 @@ string_array_len (const char *array[]) static int recv_control (int fd) { - unsigned char c; - const ssize_t size = read (fd, &c, sizeof (c)); - if (size == sizeof (c)) - return c; - else - return -1; + unsigned char c; + const ssize_t size = read (fd, &c, sizeof (c)); + if (size == sizeof (c)) + return c; + else + return -1; } static int send_control (int fd, int code) { - unsigned char c = (unsigned char) code; - const ssize_t size = write (fd, &c, sizeof (c)); - if (size == sizeof (c)) - return (int) size; - else - return -1; + unsigned char c = (unsigned char) code; + const ssize_t size = write (fd, &c, sizeof (c)); + if (size == sizeof (c)) + return (int) size; + else + return -1; } /* @@ -150,22 +153,22 @@ send_control (int fd, int code) static void daemonize (const char *envp[]) { - const char *daemon_string = get_env ("daemon", envp); - if (daemon_string && daemon_string[0] == '1') + const char *daemon_string = get_env ("daemon", envp); + if (daemon_string && daemon_string[0] == '1') { - const char *log_redirect = get_env ("daemon_log_redirect", envp); - int fd = -1; - if (log_redirect && log_redirect[0] == '1') - fd = dup (2); - if (daemon (0, 0) < 0) - { - fprintf (stderr, "DOWN-ROOT: daemonization failed\n"); - } - else if (fd >= 3) - { - dup2 (fd, 2); - close (fd); - } + const char *log_redirect = get_env ("daemon_log_redirect", envp); + int fd = -1; + if (log_redirect && log_redirect[0] == '1') + fd = dup (2); + if (daemon (0, 0) < 0) + { + warn ("DOWN-ROOT: daemonization failed"); + } + else if (fd >= 3) + { + dup2 (fd, 2); + close (fd); + } } } @@ -182,12 +185,12 @@ daemonize (const char *envp[]) static void close_fds_except (int keep) { - int i; - closelog (); - for (i = 3; i <= 100; ++i) + int i; + closelog (); + for (i = 3; i <= 100; ++i) { - if (i != keep) - close (i); + if (i != keep) + close (i); } } @@ -198,254 +201,261 @@ close_fds_except (int keep) static void set_signals (void) { - signal (SIGTERM, SIG_DFL); + signal (SIGTERM, SIG_DFL); - signal (SIGINT, SIG_IGN); - signal (SIGHUP, SIG_IGN); - signal (SIGUSR1, SIG_IGN); - signal (SIGUSR2, SIG_IGN); - signal (SIGPIPE, SIG_IGN); + signal (SIGINT, SIG_IGN); + signal (SIGHUP, SIG_IGN); + signal (SIGUSR1, SIG_IGN); + signal (SIGUSR2, SIG_IGN); + signal (SIGPIPE, SIG_IGN); } -/* - * convert system() return into a success/failure value - */ -int -system_ok (int stat) + +static void +free_context (struct down_root_context *context) { -#ifdef WIN32 - return stat == 0; -#else - return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0; -#endif + if (context) + { + if (context->command) + { + free (context->command); + } + free (context); + } } -static char * -build_command_line (const char *argv[]) +/* Run the script using execve(). As execve() replaces the + * current process with the new one, do a fork first before + * calling execve() + */ +static int +run_script(char * const *argv, char * const *envp) { - int size = 0; - int n = 0; - int i; - char *string; + pid_t pid; + int ret = 0; - /* precompute size */ - if (argv) + pid = fork(); + if (pid == (pid_t)0) /* child side */ { - for (i = 0; argv[i]; ++i) - { - size += (strlen (argv[i]) + 1); /* string length plus trailing space */ - ++n; - } + execve(argv[0], argv, envp); + /* If execve() fails to run, exit child with exit code 127 */ + err(127, "DOWN-ROOT: Failed execute: %s", argv[0]); } - ++size; /* for null terminator */ - - /* allocate memory */ - string = (char *) malloc (size); - if (!string) + else if (pid < (pid_t)0 ) { - fprintf (stderr, "DOWN-ROOT: out of memory\n"); - exit (1); + warn ("DOWN-ROOT: Failed to fork child to run %s", argv[0]); + return -1; } - string[0] = '\0'; - - /* build string */ - for (i = 0; i < n; ++i) + else /* parent side */ { - strcat (string, argv[i]); - if (i + 1 < n) - strcat (string, " "); + if( waitpid (pid, &ret, 0) != pid ) + { + /* waitpid does not return error information via errno */ + fprintf(stderr, "DOWN-ROOT: waitpid() failed, don't know exit code of child (%s)\n", argv[0]); + return -1; + } } - return string; + return ret; } -static void -free_context (struct down_root_context *context) +OPENVPN_EXPORT openvpn_plugin_handle_t +openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[]) { - if (context) + struct down_root_context *context; + int i = 0; + + /* + * Allocate our context + */ + context = (struct down_root_context *) calloc (1, sizeof (struct down_root_context)); + if (!context) { - if (context->command) - free (context->command); - free (context); + warn ("DOWN-ROOT: Could not allocate memory for plug-in context"); + goto error; + } + context->foreground_fd = -1; + + /* + * Intercept the --up and --down callbacks + */ + *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN); + + /* + * Make sure we have two string arguments: the first is the .so name, + * the second is the script command. + */ + if (string_array_len (argv) < 2) + { + fprintf (stderr, "DOWN-ROOT: need down script command\n"); + goto error; } -} -OPENVPN_EXPORT openvpn_plugin_handle_t -openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[]) -{ - struct down_root_context *context; - - /* - * Allocate our context - */ - context = (struct down_root_context *) calloc (1, sizeof (struct down_root_context)); - if (!context) - goto error; - context->foreground_fd = -1; - - /* - * Intercept the --up and --down callbacks - */ - *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN); - - /* - * Make sure we have two string arguments: the first is the .so name, - * the second is the script command. - */ - if (string_array_len (argv) < 2) + /* + * Save the arguments in our context + */ + context->command = calloc(string_array_len(argv), sizeof(char *)); + if (!context->command) + { + warn ("DOWN-ROOT: Could not allocate memory for command array"); + goto error; + } + + /* Ignore argv[0], as it contains just the plug-in file name */ + for (i = 1; i < string_array_len(argv); i++) + { + context->command[i-1] = (char *) argv[i]; + } + + /* + * Get verbosity level from environment + */ { - fprintf (stderr, "DOWN-ROOT: need down script command\n"); - goto error; + const char *verb_string = get_env ("verb", envp); + if (verb_string) + context->verb = atoi (verb_string); } - /* - * Save our argument in context - */ - context->command = build_command_line (&argv[1]); - - /* - * Get verbosity level from environment - */ - { - const char *verb_string = get_env ("verb", envp); - if (verb_string) - context->verb = atoi (verb_string); - } - - return (openvpn_plugin_handle_t) context; - - error: - free_context (context); - return NULL; + return (openvpn_plugin_handle_t) context; + +error: + free_context (context); + return NULL; } OPENVPN_EXPORT int openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[]) { - struct down_root_context *context = (struct down_root_context *) handle; + struct down_root_context *context = (struct down_root_context *) handle; - if (type == OPENVPN_PLUGIN_UP && context->foreground_fd == -1) /* fork off a process to hold onto root */ + if (type == OPENVPN_PLUGIN_UP && context->foreground_fd == -1) /* fork off a process to hold onto root */ { - pid_t pid; - int fd[2]; - - /* - * Make a socket for foreground and background processes - * to communicate. - */ - if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1) - { - fprintf (stderr, "DOWN-ROOT: socketpair call failed\n"); - return OPENVPN_PLUGIN_FUNC_ERROR; - } - - /* - * Fork off the privileged process. It will remain privileged - * even after the foreground process drops its privileges. - */ - pid = fork (); - - if (pid) - { - int status; - - /* - * Foreground Process - */ - - context->background_pid = pid; - - /* close our copy of child's socket */ - close (fd[1]); - - /* don't let future subprocesses inherit child socket */ - if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0) - fprintf (stderr, "DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed\n"); - - /* wait for background child process to initialize */ - status = recv_control (fd[0]); - if (status == RESPONSE_INIT_SUCCEEDED) - { - context->foreground_fd = fd[0]; - return OPENVPN_PLUGIN_FUNC_SUCCESS; - } - } - else - { - /* - * Background Process - */ - - /* close all parent fds except our socket back to parent */ - close_fds_except (fd[1]); - - /* Ignore most signals (the parent will receive them) */ - set_signals (); - - /* Daemonize if --daemon option is set. */ - daemonize (envp); - - /* execute the event loop */ - down_root_server (fd[1], context->command, argv, envp, context->verb); - - close (fd[1]); - exit (0); - return 0; /* NOTREACHED */ - } + pid_t pid; + int fd[2]; + + /* + * Make a socket for foreground and background processes + * to communicate. + */ + if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1) + { + warn ("DOWN-ROOT: socketpair call failed"); + return OPENVPN_PLUGIN_FUNC_ERROR; + } + + /* + * Fork off the privileged process. It will remain privileged + * even after the foreground process drops its privileges. + */ + pid = fork (); + + if (pid) + { + int status; + + /* + * Foreground Process + */ + + context->background_pid = pid; + + /* close our copy of child's socket */ + close (fd[1]); + + /* don't let future subprocesses inherit child socket */ + if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0) + { + warn ("DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed"); + } + + /* wait for background child process to initialize */ + status = recv_control (fd[0]); + if (status == RESPONSE_INIT_SUCCEEDED) + { + context->foreground_fd = fd[0]; + return OPENVPN_PLUGIN_FUNC_SUCCESS; + } + } + else + { + /* + * Background Process + */ + + /* close all parent fds except our socket back to parent */ + close_fds_except (fd[1]); + + /* Ignore most signals (the parent will receive them) */ + set_signals (); + + /* Daemonize if --daemon option is set. */ + daemonize (envp); + + /* execute the event loop */ + down_root_server (fd[1], context->command, (char * const *) envp, context->verb); + + close (fd[1]); + exit (0); + return 0; /* NOTREACHED */ + } } - else if (type == OPENVPN_PLUGIN_DOWN && context->foreground_fd >= 0) + else if (type == OPENVPN_PLUGIN_DOWN && context->foreground_fd >= 0) { - if (send_control (context->foreground_fd, COMMAND_RUN_SCRIPT) == -1) - { - fprintf (stderr, "DOWN-ROOT: Error sending script execution signal to background process\n"); - } - else - { - const int status = recv_control (context->foreground_fd); - if (status == RESPONSE_SCRIPT_SUCCEEDED) - return OPENVPN_PLUGIN_FUNC_SUCCESS; - if (status == -1) - fprintf (stderr, "DOWN-ROOT: Error receiving script execution confirmation from background process\n"); - } + if (send_control (context->foreground_fd, COMMAND_RUN_SCRIPT) == -1) + { + warn ("DOWN-ROOT: Error sending script execution signal to background process"); + } + else + { + const int status = recv_control (context->foreground_fd); + if (status == RESPONSE_SCRIPT_SUCCEEDED) + return OPENVPN_PLUGIN_FUNC_SUCCESS; + if (status == -1) + { + warn ("DOWN-ROOT: Error receiving script execution confirmation from background process"); + } + } } - return OPENVPN_PLUGIN_FUNC_ERROR; + return OPENVPN_PLUGIN_FUNC_ERROR; } OPENVPN_EXPORT void openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle) { - struct down_root_context *context = (struct down_root_context *) handle; + struct down_root_context *context = (struct down_root_context *) handle; - if (DEBUG (context->verb)) - fprintf (stderr, "DOWN-ROOT: close\n"); + if (DEBUG (context->verb)) + fprintf (stderr, "DOWN-ROOT: close\n"); - if (context->foreground_fd >= 0) + if (context->foreground_fd >= 0) { - /* tell background process to exit */ - if (send_control (context->foreground_fd, COMMAND_EXIT) == -1) - fprintf (stderr, "DOWN-ROOT: Error signaling background process to exit\n"); - - /* wait for background process to exit */ - if (context->background_pid > 0) - waitpid (context->background_pid, NULL, 0); - - close (context->foreground_fd); - context->foreground_fd = -1; + /* tell background process to exit */ + if (send_control (context->foreground_fd, COMMAND_EXIT) == -1) + { + warn ("DOWN-ROOT: Error signalling background process to exit"); + } + + /* wait for background process to exit */ + if (context->background_pid > 0) + waitpid (context->background_pid, NULL, 0); + + close (context->foreground_fd); + context->foreground_fd = -1; } - free_context (context); + free_context (context); } OPENVPN_EXPORT void openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle) { - struct down_root_context *context = (struct down_root_context *) handle; + struct down_root_context *context = (struct down_root_context *) handle; - if (context && context->foreground_fd >= 0) + if (context && context->foreground_fd >= 0) { - /* tell background process to exit */ - send_control (context->foreground_fd, COMMAND_EXIT); - close (context->foreground_fd); - context->foreground_fd = -1; + /* tell background process to exit */ + send_control (context->foreground_fd, COMMAND_EXIT); + close (context->foreground_fd); + context->foreground_fd = -1; } } @@ -453,105 +463,85 @@ openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle) * Background process -- runs with privilege. */ static void -down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb) +down_root_server (const int fd, char * const *argv, char * const *envp, const int verb) { - const char *p[3]; - char *command_line = NULL; - char *argv_cat = NULL; - int i; - - /* - * Do initialization - */ - if (DEBUG (verb)) - fprintf (stderr, "DOWN-ROOT: BACKGROUND: INIT command='%s'\n", command); - - /* - * Tell foreground that we initialized successfully - */ - if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1) + /* + * Do initialization + */ + if (DEBUG (verb)) + fprintf (stderr, "DOWN-ROOT: BACKGROUND: INIT command='%s'\n", argv[0]); + + /* + * Tell foreground that we initialized successfully + */ + if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1) { - fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [1]\n"); - goto done; + warn ("DOWN-ROOT: BACKGROUND: write error on response socket [1]"); + goto done; } - /* - * Build command line - */ - if (string_array_len (argv) >= 2) - argv_cat = build_command_line (&argv[1]); - else - argv_cat = build_command_line (NULL); - p[0] = command; - p[1] = argv_cat; - p[2] = NULL; - command_line = build_command_line (p); - - /* - * Save envp in environment - */ - for (i = 0; envp[i]; ++i) + /* + * Event loop + */ + while (1) { - putenv ((char *)envp[i]); + int command_code; + int exit_code = -1; + + /* get a command from foreground process */ + command_code = recv_control (fd); + + if (DEBUG (verb)) + fprintf (stderr, "DOWN-ROOT: BACKGROUND: received command code: %d\n", command_code); + + switch (command_code) + { + case COMMAND_RUN_SCRIPT: + if ( (exit_code = run_script(argv, envp)) == 0 ) /* Succeeded */ + { + if (send_control (fd, RESPONSE_SCRIPT_SUCCEEDED) == -1) + { + warn ("DOWN-ROOT: BACKGROUND: write error on response socket [2]"); + goto done; + } + } + else /* Failed */ + { + fprintf(stderr, "DOWN-ROOT: BACKGROUND: %s exited with exit code %i\n", argv[0], exit_code); + if (send_control (fd, RESPONSE_SCRIPT_FAILED) == -1) + { + warn ("DOWN-ROOT: BACKGROUND: write error on response socket [3]"); + goto done; + } + } + break; + + case COMMAND_EXIT: + goto done; + + case -1: + warn ("DOWN-ROOT: BACKGROUND: read error on command channel"); + goto done; + + default: + fprintf (stderr, "DOWN-ROOT: BACKGROUND: unknown command code: code=%d, exiting\n", + command_code); + goto done; + } } - /* - * Event loop - */ - while (1) - { - int command_code; - int status; - - /* get a command from foreground process */ - command_code = recv_control (fd); - - if (DEBUG (verb)) - fprintf (stderr, "DOWN-ROOT: BACKGROUND: received command code: %d\n", command_code); - - switch (command_code) - { - case COMMAND_RUN_SCRIPT: - status = system (command_line); - if (system_ok (status)) /* Succeeded */ - { - if (send_control (fd, RESPONSE_SCRIPT_SUCCEEDED) == -1) - { - fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [2]\n"); - goto done; - } - } - else /* Failed */ - { - if (send_control (fd, RESPONSE_SCRIPT_FAILED) == -1) - { - fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [3]\n"); - goto done; - } - } - break; - - case COMMAND_EXIT: - goto done; - - case -1: - fprintf (stderr, "DOWN-ROOT: BACKGROUND: read error on command channel\n"); - goto done; - - default: - fprintf (stderr, "DOWN-ROOT: BACKGROUND: unknown command code: code=%d, exiting\n", - command_code); - goto done; - } - } +done: + if (DEBUG (verb)) + fprintf (stderr, "DOWN-ROOT: BACKGROUND: EXIT\n"); - done: - if (argv_cat) - free (argv_cat); - if (command_line) - free (command_line); - if (DEBUG (verb)) - fprintf (stderr, "DOWN-ROOT: BACKGROUND: EXIT\n"); - - return; + return; } + + +/* +Local variables: +c-file-style: "bsd" +c-basic-offset: 4 +indent-tabs-mode: nil +End: +*/ diff --git a/test-driver b/test-driver deleted file mode 100755 index d306056..0000000 --- a/test-driver +++ /dev/null @@ -1,139 +0,0 @@ -#! /bin/sh -# test-driver - basic testsuite driver script. - -scriptversion=2013-07-13.22; # UTC - -# Copyright (C) 2011-2013 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -# Make unconditional expansion of undefined variables an error. This -# helps a lot in preventing typo-related bugs. -set -u - -usage_error () -{ - echo "$0: $*" >&2 - print_usage >&2 - exit 2 -} - -print_usage () -{ - cat <$log_file 2>&1 -estatus=$? -if test $enable_hard_errors = no && test $estatus -eq 99; then - estatus=1 -fi - -case $estatus:$expect_failure in - 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; - 0:*) col=$grn res=PASS recheck=no gcopy=no;; - 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; - 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; - *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; - *:*) col=$red res=FAIL recheck=yes gcopy=yes;; -esac - -# Report outcome to console. -echo "${col}${res}${std}: $test_name" - -# Register the test result, and other relevant metadata. -echo ":test-result: $res" > $trs_file -echo ":global-test-result: $res" >> $trs_file -echo ":recheck: $recheck" >> $trs_file -echo ":copy-in-global-log: $gcopy" >> $trs_file - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/tests/Makefile.in b/tests/Makefile.in index 80d5d53..1a75ad1 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -91,8 +91,7 @@ build_triplet = @build@ host_triplet = @host@ subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/t_client.sh.in $(dist_noinst_SCRIPTS) \ - $(top_srcdir)/test-driver + $(srcdir)/t_client.sh.in $(dist_noinst_SCRIPTS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_emptyarray.m4 \ $(top_srcdir)/m4/ax_socklen_t.m4 \ @@ -150,188 +149,6 @@ am__tty_colors = { \ std=''; \ fi; \ } -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -405,6 +222,8 @@ OPTIONAL_SELINUX_LIBS = @OPTIONAL_SELINUX_LIBS@ OPTIONAL_SYSTEMD_LIBS = @OPTIONAL_SYSTEMD_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ +P11KIT_CFLAGS = @P11KIT_CFLAGS@ +P11KIT_LIBS = @P11KIT_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -506,7 +325,6 @@ dist_noinst_SCRIPTS = \ all: all-am .SUFFIXES: -.SUFFIXES: .log .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -516,9 +334,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu tests/Makefile + $(AUTOMAKE) --foreign tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -552,182 +370,98 @@ ctags CTAGS: cscope cscopelist: -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ else \ - color_start= color_end=; \ + skipped="($$skip tests were not run)"; \ fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -t_client.sh.log: t_client.sh - @p='t_client.sh'; \ - b='t_client.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -t_lpback.sh.log: t_lpback.sh - @p='t_lpback.sh'; \ - b='t_lpback.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -t_cltsrv.sh.log: t_cltsrv.sh - @p='t_cltsrv.sh'; \ - b='t_cltsrv.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -784,9 +518,6 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: @@ -876,8 +607,8 @@ uninstall-am: install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am recheck tags-am \ - uninstall uninstall-am + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/tests/t_client.sh b/tests/t_client.sh index 674889a..4a8a30f 100755 --- a/tests/t_client.sh +++ b/tests/t_client.sh @@ -86,12 +86,12 @@ fail() get_ifconfig_route() { # linux / iproute2? (-> if configure got a path) - if [ -n "/sbin/ip" ] + if [ -n "/bin/ip" ] then echo "-- linux iproute2 --" - /sbin/ip addr show | grep -v valid_lft - /sbin/ip route show - /sbin/ip -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' + /bin/ip addr show | grep -v valid_lft + /bin/ip route show + /bin/ip -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' return fi diff --git a/tests/t_lpback.sh b/tests/t_lpback.sh index 8f88ad9..d7792cd 100755 --- a/tests/t_lpback.sh +++ b/tests/t_lpback.sh @@ -35,6 +35,9 @@ CIPHERS=$(${top_builddir}/src/openvpn/openvpn --show-ciphers | \ # GD, 2014-07-06 do not test RC5-* either (fails on NetBSD w/o libcrypto_rc5) CIPHERS=$(echo "$CIPHERS" | egrep -v '^(DES-EDE3-CFB1|DES-CFB1|RC5-)' ) +# Also test cipher 'none' +CIPHERS=${CIPHERS}$(printf "\nnone") + "${top_builddir}/src/openvpn/openvpn" --genkey --secret key.$$ set +e diff --git a/version.m4 b/version.m4 index 0bd830f..eacf8a1 100644 --- a/version.m4 +++ b/version.m4 @@ -1,9 +1,9 @@ dnl define the OpenVPN version define([PRODUCT_NAME], [OpenVPN]) define([PRODUCT_TARNAME], [openvpn]) -define([PRODUCT_VERSION], [2.3.5]) +define([PRODUCT_VERSION], [2.3.7]) define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net]) -define([PRODUCT_VERSION_RESOURCE], [2,3,5,0]) +define([PRODUCT_VERSION_RESOURCE], [2,3,7,0]) dnl define the TAP version define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) define([PRODUCT_TAP_WIN_MIN_MAJOR], [9]) -- cgit v1.2.3