build: integrate plugins build into core build
PATCH 1/1 build: integrate plugins build into core build
As disucssed[1], keep plugins in repository.
1, Proper automake/libtool build.
2. Move example plugins to samples/sample-plugins.
3. Plugins are installed at LIBDIR/openvpn/plugins.
[1] http://comments.gmane.org/gmane.network.openvpn.devel/6436
--- configure.ac | 63 +++++++ distro/rpm/openvpn.spec.in | 47 +----- doc/Makefile.am | 5 +- doc/README.plugins | 47 +++++ sample/Makefile.am | 1 + sample/sample-plugins/defer/README | 16 ++ sample/sample-plugins/defer/build | 15 ++ sample/sample-plugins/defer/simple.c | 305 +++++++++++++++++++++++++++++++ sample/sample-plugins/defer/simple.def | 6 + sample/sample-plugins/defer/winbuild | 18 ++ sample/sample-plugins/log/build | 15 ++ sample/sample-plugins/log/log.c | 184 +++++++++++++++++++ sample/sample-plugins/log/log_v3.c | 247 +++++++++++++++++++++++++ sample/sample-plugins/log/winbuild | 18 ++ sample/sample-plugins/simple/README | 16 ++ sample/sample-plugins/simple/build | 15 ++ sample/sample-plugins/simple/simple.c | 120 ++++++++++++ sample/sample-plugins/simple/simple.def | 6 + sample/sample-plugins/simple/winbuild | 18 ++ src/Makefile.am | 5 +- src/plugins/Makefile.am | 15 ++ src/plugins/README | 47 ----- src/plugins/auth-pam/Makefile | 32 ---- src/plugins/auth-pam/Makefile.am | 27 +++ src/plugins/auth-pam/README | 74 -------- src/plugins/auth-pam/README.auth-pam | 74 ++++++++ src/plugins/auth-pam/auth-pam.c | 18 +- src/plugins/auth-pam/auth-pam.exports | 4 + src/plugins/auth-pam/pamdl.c | 8 +- src/plugins/auth-pam/pamdl.h | 4 +- src/plugins/defer/README | 16 -- src/plugins/defer/build | 15 -- src/plugins/defer/simple.c | 305 ------------------------------- src/plugins/defer/simple.def | 6 - src/plugins/defer/winbuild | 18 -- src/plugins/down-root/Makefile | 18 -- src/plugins/down-root/Makefile.am | 23 +++ src/plugins/down-root/README | 29 --- src/plugins/down-root/README.down-root | 29 +++ src/plugins/down-root/down-root.c | 6 +- src/plugins/down-root/down-root.exports | 4 + src/plugins/examples/README | 16 -- src/plugins/examples/build | 15 -- src/plugins/examples/log.c | 184 ------------------- src/plugins/examples/log_v3.c | 247 ------------------------- src/plugins/examples/simple.c | 120 ------------ src/plugins/examples/simple.def | 6 - src/plugins/examples/winbuild | 18 -- 48 files changed, 1317 insertions(+), 1228 deletions(-) create mode 100644 doc/README.plugins create mode 100644 sample/sample-plugins/defer/README create mode 100755 sample/sample-plugins/defer/build create mode 100644 sample/sample-plugins/defer/simple.c create mode 100755 sample/sample-plugins/defer/simple.def create mode 100755 sample/sample-plugins/defer/winbuild create mode 100755 sample/sample-plugins/log/build create mode 100644 sample/sample-plugins/log/log.c create mode 100644 sample/sample-plugins/log/log_v3.c create mode 100755 sample/sample-plugins/log/winbuild create mode 100644 sample/sample-plugins/simple/README create mode 100755 sample/sample-plugins/simple/build create mode 100644 sample/sample-plugins/simple/simple.c create mode 100755 sample/sample-plugins/simple/simple.def create mode 100755 sample/sample-plugins/simple/winbuild create mode 100644 src/plugins/Makefile.am delete mode 100644 src/plugins/README delete mode 100755 src/plugins/auth-pam/Makefile create mode 100644 src/plugins/auth-pam/Makefile.am delete mode 100644 src/plugins/auth-pam/README create mode 100644 src/plugins/auth-pam/README.auth-pam create mode 100644 src/plugins/auth-pam/auth-pam.exports delete mode 100644 src/plugins/defer/README delete mode 100755 src/plugins/defer/build delete mode 100644 src/plugins/defer/simple.c delete mode 100755 src/plugins/defer/simple.def delete mode 100755 src/plugins/defer/winbuild delete mode 100755 src/plugins/down-root/Makefile create mode 100644 src/plugins/down-root/Makefile.am delete mode 100644 src/plugins/down-root/README create mode 100644 src/plugins/down-root/README.down-root create mode 100644 src/plugins/down-root/down-root.exports delete mode 100644 src/plugins/examples/README delete mode 100755 src/plugins/examples/build delete mode 100644 src/plugins/examples/log.c delete mode 100644 src/plugins/examples/log_v3.c delete mode 100644 src/plugins/examples/simple.c delete mode 100755 src/plugins/examples/simple.def delete mode 100755 src/plugins/examples/winbuild
configure.ac +63 -0
@@ -194,6 +194,27 @@ AC_ARG_ENABLE( ) AC_ARG_ENABLE( + [plugin-auth-pam], + [AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=yes@:>@])], + , + [enable_plugin_auth_pam="yes"] +) + +AC_ARG_ENABLE( + [plugin-down-root], + [AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=yes@:>@])], + , + [enable_plugin_down_root="yes"] +) + +AC_ARG_ENABLE( + [pam-dlopen], + [AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])], + , + [enable_pam_dlopen="no"] +) + +AC_ARG_ENABLE( [strict], [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])], ,
@@ -258,6 +279,14 @@ AC_ARG_WITH( [with_crypto_library="openssl"] ) +AC_ARG_WITH( + [plugindir], + [AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])], + , + [with_plugindir="\$(libdir)/openvpn/plugins"] +) + + AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host]) case "$host" in *-*-linux*)
@@ -622,6 +651,16 @@ AC_CHECK_LIB( ) AC_SUBST([SELINUX_LIBS]) +AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam]) +AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam]) +if test -z "${LIBPAM_LIBS}"; then + AC_CHECK_LIB( + [pam], + [pam_start], + [LIBPAM_LIBS="-lpam"] + ) +fi + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(
@@ -871,6 +910,9 @@ if test "${enable_plugins}" = "yes"; then OPTIONAL_DL_LIBS="${DL_LIBS}" AC_DEFINE([ENABLE_PLUGIN], [1], [Enable systemd support]) test "${enable_eurephia}" = "yes" && AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in]) +else + enable_plugin_auth_pam="no" + enable_plugin_down_root="no" fi if test "${enable_iproute2}" = "yes"; then
@@ -922,6 +964,17 @@ if test "${WIN32}" = "yes"; then test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) fi +if test "${enable_plugin_auth_pam}" = "yes"; then + PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}" + if test "${enable_pam_dlopen}" = "yes"; then + AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam]) + PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}" + else + test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing]) + PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}" + fi +fi + CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
@@ -944,10 +997,17 @@ AC_SUBST([OPTIONAL_LZO_LIBS]) AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) +AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS]) +AC_SUBST([PLUGIN_AUTH_PAM_LIBS]) + AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"]) +AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"]) +AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"]) +plugindir="${with_plugindir}" sampledir="\$(docdir)/sample" +AC_SUBST([plugindir]) AC_SUBST([sampledir]) AC_CONFIG_FILES([
@@ -964,6 +1024,9 @@ AC_CONFIG_FILES([ src/compat/Makefile src/openvpn/Makefile src/openvpnserv/Makefile + src/plugins/Makefile + src/plugins/auth-pam/Makefile + src/plugins/down-root/Makefile tests/Makefile sample/Makefile doc/Makefile
distro/rpm/openvpn.spec.in +4 -43
73 lines not on this page · raw message
doc/Makefile.am +4 -1
@@ -17,8 +17,11 @@ CLEANFILES = openvpn.8.html dist_doc_DATA = \ management-notes.txt +dist_noinst_DATA = \ + README.plugins + if WIN32 -dist_noinst_DATA = openvpn.8 +dist_noinst_DATA += openvpn.8 nodist_html_DATA = openvpn.8.html openvpn.8.html: $(srcdir)/openvpn.8 $(MAN2HTML) < $(srcdir)/openvpn.8 > openvpn.8.html
doc/README.plugins new file +47 -0
47 lines not on this page · raw message
sample/Makefile.am +1 -0
@@ -13,6 +13,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in EXTRA_DIST = \ + sample-plugins \ sample-config-files \ sample-windows \ sample-keys \
sample/sample-plugins/defer/README new file +16 -0
@@ -0,0 +1,16 @@ +OpenVPN plugin examples. + +Examples provided: + +simple.c -- using the --auth-user-pass-verify callback, + test deferred authentication. + +To build: + + ./build simple (Linux/BSD/etc.) + ./winbuild simple (MinGW on Windows) + +To use in OpenVPN, add to config file: + + plugin simple.so (Linux/BSD/etc.) + plugin simple.dll (MinGW on Windows)
sample/sample-plugins/defer/build new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# +# Build an OpenVPN plugin module on *nix. The argument should +# be the base name of the C source file (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +CPPFLAGS="${CPPFLAGS:--I../../../include}" + +CC="${CC:-gcc}" +CFLAGS="${CFLAGS:--O2 -Wall -g}" + +$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ +$CC $CFLAGS -fPIC -shared ${LDFLAS} -Wl,-soname,$1.so -o $1.so $1.o -lc
sample/sample-plugins/defer/simple.c new file +305 -0
305 lines not on this page · raw message
sample/sample-plugins/defer/simple.def new file +6 -0
@@ -0,0 +1,6 @@ +LIBRARY OpenVPN_PLUGIN_SAMPLE +DESCRIPTION "Sample OpenVPN plug-in module." +EXPORTS + openvpn_plugin_open_v1 @1 + openvpn_plugin_func_v1 @2 + openvpn_plugin_close_v1 @3
sample/sample-plugins/defer/winbuild new file +18 -0
@@ -0,0 +1,18 @@ +# +# Build an OpenVPN plugin module on Windows/MinGW. +# The argument should be the base name of the C source file +# (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +INCLUDE="-I../../../build" + +CC_FLAGS="-O2 -Wall" + +gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c +gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o +rm junk.tmp +dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def +rm base.tmp +gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp +rm temp.exp
sample/sample-plugins/log/build new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# +# Build an OpenVPN plugin module on *nix. The argument should +# be the base name of the C source file (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +CPPFLAGS="${CPPFLAGS:--I../../..}" + +CC="${CC:-gcc}" +CFLAGS="${CFLAGS:--O2 -Wall -g}" + +$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ +$CC $CFLAGS -fPIC -shared $LDFLAGS -Wl,-soname,$1.so -o $1.so $1.o -lc
sample/sample-plugins/log/log.c new file +184 -0
184 lines not on this page · raw message
sample/sample-plugins/log/log_v3.c new file +247 -0
247 lines not on this page · raw message
sample/sample-plugins/log/winbuild new file +18 -0
@@ -0,0 +1,18 @@ +# +# Build an OpenVPN plugin module on Windows/MinGW. +# The argument should be the base name of the C source file +# (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +INCLUDE="-I../../../include" + +CC_FLAGS="-O2 -Wall" + +gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c +gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o +rm junk.tmp +dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def +rm base.tmp +gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp +rm temp.exp
sample/sample-plugins/simple/README new file +16 -0
@@ -0,0 +1,16 @@ +OpenVPN plugin examples. + +Examples provided: + +simple.c -- using the --auth-user-pass-verify callback, verify + that the username/password is "foo"/"bar". + +To build: + + ./build simple (Linux/BSD/etc.) + ./winbuild simple (MinGW on Windows) + +To use in OpenVPN, add to config file: + + plugin simple.so (Linux/BSD/etc.) + plugin simple.dll (MinGW on Windows)
sample/sample-plugins/simple/build new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# +# Build an OpenVPN plugin module on *nix. The argument should +# be the base name of the C source file (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +CPPFLAGS="${CPPFLAGS:--I../../..}" + +CC="${CC:-gcc}" +CFLAGS="${CFLAGS:--O2 -Wall -g}" + +$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ +$CC $CFLAGS -fPIC -shared $LDFLAGS -Wl,-soname,$1.so -o $1.so $1.o -lc
sample/sample-plugins/simple/simple.c new file +120 -0
120 lines not on this page · raw message
sample/sample-plugins/simple/simple.def new file +6 -0
@@ -0,0 +1,6 @@ +LIBRARY OpenVPN_PLUGIN_SAMPLE +DESCRIPTION "Sample OpenVPN plug-in module." +EXPORTS + openvpn_plugin_open_v1 @1 + openvpn_plugin_func_v1 @2 + openvpn_plugin_close_v1 @3
sample/sample-plugins/simple/winbuild new file +18 -0
@@ -0,0 +1,18 @@ +# +# Build an OpenVPN plugin module on Windows/MinGW. +# The argument should be the base name of the C source file +# (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +INCLUDE="-I../../../include" + +CC_FLAGS="-O2 -Wall" + +gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c +gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o +rm junk.tmp +dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def +rm base.tmp +gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp +rm temp.exp
src/Makefile.am +1 -4
@@ -12,7 +12,4 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in -EXTRA_DIST = \ - plugins - -SUBDIRS = compat openvpn openvpnserv +SUBDIRS = compat openvpn openvpnserv plugins
src/plugins/Makefile.am new file +15 -0
@@ -0,0 +1,15 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...> +# Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +SUBDIRS = auth-pam down-root
src/plugins/README deleted +0 -47
47 lines not on this page · raw message
src/plugins/auth-pam/Makefile deleted +0 -32
@@ -1,32 +0,0 @@ -# -# Build the OpenVPN auth-pam plugin module. -# - -# If PAM modules are not linked against libpam.so, set DLOPEN_PAM to 1. This -# must be done on SUSE 9.1, at least. -DLOPEN_PAM=0 - -ifeq ($(DLOPEN_PAM),1) - LIBPAM=-ldl -else - LIBPAM=-lpam -endif - -# This directory is where we will look for openvpn-plugin.h -CPPFLAGS=-I../../../include - -CC=gcc -CFLAGS=-O2 -Wall -DEFS = -DDLOPEN_PAM=$(DLOPEN_PAM) - -openvpn-auth-pam.so : auth-pam.o pamdl.o - $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) -Wl,-soname,openvpn-auth-pam.so -o openvpn-auth-pam.so auth-pam.o pamdl.o -lc $(LIBPAM) - -auth-pam.o : auth-pam.c pamdl.h - $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) -fPIC -c auth-pam.c - -pamdl.o : pamdl.c pamdl.h - $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) -fPIC -c pamdl.c - -clean : - -rm -f *.o *.so
src/plugins/auth-pam/Makefile.am new file +27 -0
@@ -0,0 +1,27 @@ +# +# OpenVPN (TM) PAM Auth Plugin -- OpenVPN Plugin +# +# Copyright (C) 2012 Alon Bar-Lev <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +AM_CFLAGS = \ + -I$(top_srcdir)/include + $(PLUGIN_AUTH_PAM_CFLAGS) + +if ENABLE_PLUGIN_AUTH_PAM +plugin_LTLIBRARIES = openvpn-plugin-auth-pam.la +dist_doc_DATA = README.auth-pam +endif + +openvpn_plugin_auth_pam_la_SOURCES = \ + auth-pam.c \ + pamdl.c pamdl.h \ + auth-pam.exports +openvpn_plugin_auth_pam_la_LIBADD = \ + $(PLUGIN_AUTH_PAM_LIBS) +openvpn_plugin_auth_pam_la_LDFLAGS = $(AM_LDFLAGS) \ + -export-symbols "$(srcdir)/auth-pam.exports" \ + -module -shared -avoid-version -no-undefined
src/plugins/auth-pam/README deleted +0 -74
74 lines not on this page · raw message
src/plugins/auth-pam/README.auth-pam new file +74 -0
74 lines not on this page · raw message
src/plugins/auth-pam/auth-pam.c +10 -8
@@ -26,12 +26,14 @@* OpenVPN plugin module to do PAM authentication using a split * privilege model. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif -#if DLOPEN_PAM -#include <dlfcn.h> -#include "pamdl.h" -#else #include <security/pam_appl.h> + +#ifdef USE_PAM_DLOPEN +#include "pamdl.h" #endif #include <stdio.h>
@@ -46,7 +48,7 @@#include <signal.h> #include <syslog.h> -#include "openvpn-plugin.h" +#include <openvpn-plugin.h> #define DEBUG (verb) ((verb) >= 4)
@@ -693,7 +695,7 @@ pam_server (int fd, const char *service, int verb, const struct name_value_list {struct user_pass up;int command; -#if DLOPEN_PAM +#ifdef USE_PAM_DLOPEN static const char pam_so[] ="libpam.so" ;#endif
@@ -703,7 +705,7 @@ pam_server (int fd, const char *service, int verb, const struct name_value_listif (DEBUG (verb))fprintf (stderr,"AUTH-PAM: BACKGROUND: INIT service='%s'\n" , service); -#if DLOPEN_PAM +#ifdef USE_PAM_DLOPEN /* * Load PAM shared object */
@@ -794,7 +796,7 @@ pam_server (int fd, const char *service, int verb, const struct name_value_list } done: -#if DLOPEN_PAM +#ifdef USE_PAM_DLOPENdlclose_pam ();#endif if (DEBUG (verb))
src/plugins/auth-pam/auth-pam.exports new file +4 -0
@@ -0,0 +1,4 @@ +openvpn_plugin_open_v1 +openvpn_plugin_func_v1 +openvpn_plugin_close_v1 +openvpn_plugin_abort_v1
src/plugins/auth-pam/pamdl.c +6 -2
@@ -1,4 +1,8 @@ -#if DLOPEN_PAM +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef USE_PAM_DLOPEN /* * If you want to dynamically load libpam using dlopen() or something, * then dlopen( ' this shared object ' ); It takes care of exporting
@@ -73,7 +77,7 @@ int pam_set_item(pam_handle_t *pamh, int item_type, const void *item)return real_pam_set_item (pamh, item_type, item); } -int pam_get_item (pam_handle_t *pamh,int item_type,const void **item) +int pam_get_item (const pam_handle_t *pamh,int item_type,const void **item) {int (*real_pam_get_item)(const pam_handle_t *,int ,const void **); RESOLVE_PAM_FUNCTION(pam_get_item, int,
src/plugins/auth-pam/pamdl.h +1 -3
@@ -1,6 +1,4 @@ -#if DLOPEN_PAM -#include <security/pam_appl.h> - +#ifdef USE_PAM_DLOPEN /* Dynamically load and unload the PAM library */ int dlopen_pam (const char *so);void dlclose_pam (void );
src/plugins/defer/README deleted +0 -16
@@ -1,16 +0,0 @@ -OpenVPN plugin examples. - -Examples provided: - -simple.c -- using the --auth-user-pass-verify callback, - test deferred authentication. - -To build: - - ./build simple (Linux/BSD/etc.) - ./winbuild simple (MinGW on Windows) - -To use in OpenVPN, add to config file: - - plugin simple.so (Linux/BSD/etc.) - plugin simple.dll (MinGW on Windows)
src/plugins/defer/build deleted +0 -15
@@ -1,15 +0,0 @@ -#!/bin/sh - -# -# Build an OpenVPN plugin module on *nix. The argument should -# be the base name of the C source file (without the .c). -# - -# This directory is where we will look for openvpn-plugin.h -CPPFLAGS="${CPPFLAGS:--I../../../include}" - -CC="${CC:-gcc}" -CFLAGS="${CFLAGS:--O2 -Wall -g}" - -$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ -$CC $CFLAGS -fPIC -shared ${LDFLAS} -Wl,-soname,$1.so -o $1.so $1.o -lc
src/plugins/defer/simple.c deleted +0 -305
305 lines not on this page · raw message
src/plugins/defer/simple.def deleted +0 -6
@@ -1,6 +0,0 @@ -LIBRARY OpenVPN_PLUGIN_SAMPLE -DESCRIPTION "Sample OpenVPN plug-in module." -EXPORTS - openvpn_plugin_open_v1 @1 - openvpn_plugin_func_v1 @2 - openvpn_plugin_close_v1 @3
src/plugins/defer/winbuild deleted +0 -18
@@ -1,18 +0,0 @@ -# -# Build an OpenVPN plugin module on Windows/MinGW. -# The argument should be the base name of the C source file -# (without the .c). -# - -# This directory is where we will look for openvpn-plugin.h -INCLUDE="-I../../../build" - -CC_FLAGS="-O2 -Wall" - -gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c -gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o -rm junk.tmp -dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def -rm base.tmp -gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp -rm temp.exp
src/plugins/down-root/Makefile deleted +0 -18
@@ -1,18 +0,0 @@ -# -# Build the OpenVPN down-root plugin module. -# - -# This directory is where we will look for openvpn-plugin.h -CPPFLAGS=-I../../../include - -CC=gcc -CFLAGS=-O2 -Wall - -down-root.so : down-root.o - $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc - -down-root.o : down-root.c - $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c down-root.c - -clean : - -rm -f *.o *.so
src/plugins/down-root/Makefile.am new file +23 -0
@@ -0,0 +1,23 @@ +# +# OpenVPN (TM) Down Root Plugin -- OpenVPN Plugin +# +# Copyright (C) 2012 Alon Bar-Lev <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +AM_CFLAGS = \ + -I$(top_srcdir)/include + +if ENABLE_PLUGIN_DOWN_ROOT +plugin_LTLIBRARIES = openvpn-plugin-down-root.la +dist_doc_DATA = README.down-root +endif + +openvpn_plugin_down_root_la_SOURCES = \ + down-root.c \ + down-root.exports +openvpn_plugin_down_root_la_LDFLAGS = $(AM_LDFLAGS) \ + -export-symbols "$(srcdir)/down-root.exports" \ + -module -shared -avoid-version -no-undefined
src/plugins/down-root/README deleted +0 -29
@@ -1,29 +0,0 @@ -down-root -- an OpenVPN Plugin Module - -SYNOPSIS - -The down-root module allows an OpenVPN configuration to -call a down script with root privileges, even when privileges -have been dropped using --user/--group/--chroot. - -This module uses a split privilege execution model which will -fork() before OpenVPN drops root privileges, at the point where -the --up script is usually called. The module will then remain -in a wait state until it receives a message from OpenVPN via -pipe to execute the down script. Thus, the down script will be -run in the same execution environment as the up script. - -BUILD - -Build this module with the "make" command. The plugin -module will be named openvpn-down-root.so - -USAGE - -To use this module, add to your OpenVPN config file: - - plugin openvpn-down-root.so "command ..." - -CAVEATS - -This module will only work on *nix systems, not Windows.
src/plugins/down-root/README.down-root new file +29 -0
@@ -0,0 +1,29 @@ +down-root -- an OpenVPN Plugin Module + +SYNOPSIS + +The down-root module allows an OpenVPN configuration to +call a down script with root privileges, even when privileges +have been dropped using --user/--group/--chroot. + +This module uses a split privilege execution model which will +fork() before OpenVPN drops root privileges, at the point where +the --up script is usually called. The module will then remain +in a wait state until it receives a message from OpenVPN via +pipe to execute the down script. Thus, the down script will be +run in the same execution environment as the up script. + +BUILD + +Build this module with the "make" command. The plugin +module will be named openvpn-down-root.so + +USAGE + +To use this module, add to your OpenVPN config file: + + plugin openvpn-down-root.so "command ..." + +CAVEATS + +This module will only work on *nix systems, not Windows.
src/plugins/down-root/down-root.c +5 -1
@@ -26,6 +26,10 @@* OpenVPN plugin module to do privileged down-script execution. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <stdio.h> #include <string.h> #include <unistd.h>
@@ -37,7 +41,7 @@#include <signal.h> #include <syslog.h> -#include "openvpn-plugin.h" +#include <openvpn-plugin.h> #define DEBUG (verb) ((verb) >= 7)
src/plugins/down-root/down-root.exports new file +4 -0
@@ -0,0 +1,4 @@ +openvpn_plugin_open_v1 +openvpn_plugin_func_v1 +openvpn_plugin_close_v1 +openvpn_plugin_abort_v1
src/plugins/examples/README deleted +0 -16
@@ -1,16 +0,0 @@ -OpenVPN plugin examples. - -Examples provided: - -simple.c -- using the --auth-user-pass-verify callback, verify - that the username/password is "foo"/"bar". - -To build: - - ./build simple (Linux/BSD/etc.) - ./winbuild simple (MinGW on Windows) - -To use in OpenVPN, add to config file: - - plugin simple.so (Linux/BSD/etc.) - plugin simple.dll (MinGW on Windows)
src/plugins/examples/build deleted +0 -15
@@ -1,15 +0,0 @@ -#!/bin/sh - -# -# Build an OpenVPN plugin module on *nix. The argument should -# be the base name of the C source file (without the .c). -# - -# This directory is where we will look for openvpn-plugin.h -CPPFLAGS="${CPPFLAGS:--I../../..}" - -CC="${CC:-gcc}" -CFLAGS="${CFLAGS:--O2 -Wall -g}" - -$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ -$CC $CFLAGS -fPIC -shared $LDFLAGS -Wl,-soname,$1.so -o $1.so $1.o -lc
src/plugins/examples/log.c deleted +0 -184
184 lines not on this page · raw message
src/plugins/examples/log_v3.c deleted +0 -247
247 lines not on this page · raw message
src/plugins/examples/simple.c deleted +0 -120
120 lines not on this page · raw message
src/plugins/examples/simple.def deleted +0 -6
@@ -1,6 +0,0 @@ -LIBRARY OpenVPN_PLUGIN_SAMPLE -DESCRIPTION "Sample OpenVPN plug-in module." -EXPORTS - openvpn_plugin_open_v1 @1 - openvpn_plugin_func_v1 @2 - openvpn_plugin_close_v1 @3
src/plugins/examples/winbuild deleted +0 -18
@@ -1,18 +0,0 @@ -# -# Build an OpenVPN plugin module on Windows/MinGW. -# The argument should be the base name of the C source file -# (without the .c). -# - -# This directory is where we will look for openvpn-plugin.h -INCLUDE="-I../../../include" - -CC_FLAGS="-O2 -Wall" - -gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c -gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o -rm junk.tmp -dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def -rm base.tmp -gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp -rm temp.exp
Signature · 1 line
1.7.3.4
Quoted 11 lines · Alon Bar-Lev
As disucssed[1], keep plugins in repository.
1, Proper automake/libtool build.
2. Move example plugins to
samples/sample-plugins.3. Plugins are installed at LIBDIR/openvpn/plugins.
[1] http://comments.gmane.org/gmane.network.openvpn.devel/6436
Signed-off-by Alon Bar-Lev <[email protected]...>
Hello,
At least finish the build system and reach to a sane state.
This is on top of my build[1] branch, which is waiting... Also unicode[2] branch is waiting.
This one is at[3].
Alon.
[1] https://github.com/alonbl/openvpn/compare/build
[2] https://github.com/alonbl/openvpn/compare/master...unicode
[3] https://github.com/alonbl/openvpn/compare/master...plugins2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 90 lines · Alon Bar-Lev
As disucssed[1], keep plugins in repository.
1, Proper automake/libtool build.
2. Move example plugins to
samples/sample-plugins.3. Plugins are installed at LIBDIR/openvpn/plugins.
[1] http://comments.gmane.org/gmane.network.openvpn.devel/6436
Signed-off-by Alon Bar-Lev <[email protected]...> ---configure.ac | 63 +++++++ distro/rpm/openvpn.spec.in | 47 +----- doc/Makefile.am | 5 +- doc/README.plugins | 47 +++++ sample/Makefile.am | 1 + sample/sample-plugins/defer/README | 16 ++ sample/sample-plugins/defer/build | 15 ++ sample/sample-plugins/defer/simple.c | 305 +++++++++++++++++++++++++++++++ sample/sample-plugins/defer/simple.def | 6 + sample/sample-plugins/defer/winbuild | 18 ++ sample/sample-plugins/log/build | 15 ++ sample/sample-plugins/log/log.c | 184 +++++++++++++++++++ sample/sample-plugins/log/log_v3.c | 247 +++++++++++++++++++++++++ sample/sample-plugins/log/winbuild | 18 ++ sample/sample-plugins/simple/README | 16 ++ sample/sample-plugins/simple/build | 15 ++ sample/sample-plugins/simple/simple.c | 120 ++++++++++++ sample/sample-plugins/simple/simple.def | 6 + sample/sample-plugins/simple/winbuild | 18 ++ src/Makefile.am | 5 +- src/plugins/Makefile.am | 15 ++ src/plugins/README | 47 ----- src/plugins/auth-pam/Makefile | 32 ---- src/plugins/auth-pam/Makefile.am | 27 +++ src/plugins/auth-pam/README | 74 -------- src/plugins/auth-pam/README.auth-pam | 74 ++++++++ src/plugins/auth-pam/auth-pam.c | 18 +- src/plugins/auth-pam/auth-pam.exports | 4 + src/plugins/auth-pam/pamdl.c | 8 +- src/plugins/auth-pam/pamdl.h | 4 +- src/plugins/defer/README | 16 -- src/plugins/defer/build | 15 -- src/plugins/defer/simple.c | 305 ------------------------------- src/plugins/defer/simple.def | 6 - src/plugins/defer/winbuild | 18 -- src/plugins/down-root/Makefile | 18 -- src/plugins/down-root/Makefile.am | 23 +++ src/plugins/down-root/README | 29 --- src/plugins/down-root/README.down-root | 29 +++ src/plugins/down-root/down-root.c | 6 +- src/plugins/down-root/down-root.exports | 4 + src/plugins/examples/README | 16 -- src/plugins/examples/build | 15 -- src/plugins/examples/log.c | 184 ------------------- src/plugins/examples/log_v3.c | 247 ------------------------- src/plugins/examples/simple.c | 120 ------------ src/plugins/examples/simple.def | 6 - src/plugins/examples/winbuild | 18 -- 48 files changed,1317 insertions(+), 1228 deletions(-) create mode 100644 doc/README.plugins create mode 100644 sample/sample-plugins/defer/README create mode 100755 sample/sample-plugins/defer/build create mode 100644
sample/sample-plugins/defer/simple.ccreate mode 100755 sample/sample-plugins/defer/simple.def create mode 100755 sample/sample-plugins/defer/winbuild create mode 100755 sample/sample-plugins/log/build create mode 100644sample/sample-plugins/log/log.ccreate mode 100644sample/sample-plugins/log/log_v3.ccreate mode 100755 sample/sample-plugins/log/winbuild create mode 100644 sample/sample-plugins/simple/README create mode 100755 sample/sample-plugins/simple/build create mode 100644sample/sample-plugins/simple/simple.ccreate mode 100755 sample/sample-plugins/simple/simple.def create mode 100755 sample/sample-plugins/simple/winbuild create mode 100644 src/plugins/Makefile.am delete mode 100644 src/plugins/README delete mode 100755 src/plugins/auth-pam/Makefile create mode 100644 src/plugins/auth-pam/Makefile.am delete mode 100644 src/plugins/auth-pam/README create mode 100644 src/plugins/auth-pam/README.auth-pam create mode 100644 src/plugins/auth-pam/auth-pam.exports delete mode 100644 src/plugins/defer/README delete mode 100755 src/plugins/defer/build delete mode 100644src/plugins/defer/simple.cdelete mode 100755 src/plugins/defer/simple.def delete mode 100755 src/plugins/defer/winbuild delete mode 100755 src/plugins/down-root/Makefile create mode 100644 src/plugins/down-root/Makefile.am delete mode 100644 src/plugins/down-root/README create mode 100644 src/plugins/down-root/README.down-root create mode 100644
Quoted 8 lines
src/plugins/down-root/down-root.exports delete mode 100644 src/plugins/examples/README delete mode 100755 src/plugins/examples/build delete mode 100644
src/plugins/examples/log.cdelete mode 100644src/plugins/examples/log_v3.cdelete mode 100644src/plugins/examples/simple.cdelete mode 100755 src/plugins/examples/simple.def delete mode 100755 src/plugins/examples/winbuild
I'm sorry about this one, it fell of my radar when all my tags got reset in my mail client. Anyhow!
ACK. Applied to master.
commit ce8271f5d435be963c79945f8d7eb6ea2e4369fa
Author: Alon Bar-Lev <[email protected]...> Date: Tue May 15 01:42:03 2012 +0300
build: integrate plugins build into core build
Signed-off-by: Alon Bar-Lev <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: [email protected]...
URL: http://article.gmane.org/gmane.network.openvpn.devel/6591
Signed-off-by: David Sommerseth <[email protected]...>kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk/phRQACgkQDC186MBRfrpJgQCglB3RE2z83zmXOWlYIKtOcEm3 H9IAniuDMQ7g8mk4xwdqY2uJ7uz0d5kz
=mPIo
-----END PGP SIGNATURE-----