aboutsummaryrefslogtreecommitdiff
path: root/security/openvpn20
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2011-08-30 17:12:31 +0000
committerMatthias Andree <mandree@FreeBSD.org>2011-08-30 17:12:31 +0000
commit2a9cbca0a092ba13a7ccdead08790f39745a4a08 (patch)
tree42d8492edce4dcacddabb9aad37b8cd0f325f0b8 /security/openvpn20
parenta2cf6822c55e6a28a2b7e1dc9e5ae336f1cd55cb (diff)
downloadports-2a9cbca0a092ba13a7ccdead08790f39745a4a08.tar.gz
ports-2a9cbca0a092ba13a7ccdead08790f39745a4a08.zip
Notes
Diffstat (limited to 'security/openvpn20')
-rw-r--r--security/openvpn20/Makefile2
-rw-r--r--security/openvpn20/files/openvpn.sh.in37
2 files changed, 20 insertions, 19 deletions
diff --git a/security/openvpn20/Makefile b/security/openvpn20/Makefile
index 5ec8bddcb43e..ed49502aa84b 100644
--- a/security/openvpn20/Makefile
+++ b/security/openvpn20/Makefile
@@ -7,7 +7,7 @@
PORTNAME= openvpn
PORTVERSION= 2.0.9
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security net
# MASTER_SITES points to hosts in distinct data centers,
# so just one MASTER_SITES entry should be OK.
diff --git a/security/openvpn20/files/openvpn.sh.in b/security/openvpn20/files/openvpn.sh.in
index b80fe1560c74..d2539131a212 100644
--- a/security/openvpn20/files/openvpn.sh.in
+++ b/security/openvpn20/files/openvpn.sh.in
@@ -2,10 +2,11 @@
#
# openvpn.sh - load tun/tap driver and start OpenVPN daemon
#
-# (C) Copyright 2005 - 2008 by Matthias Andree
+# (C) Copyright 2005 - 2008, 2010 by Matthias Andree
# based on suggestions by Matthias Grimm and Dirk Gouders
# with multi-instance contribution from Denis Shaposhnikov, Gleb Kozyrev
# and Vasil Dimov
+# softrestart feature suggested by Nick Hibma
#
# $FreeBSD$
#
@@ -45,6 +46,7 @@
#
# NAME_enable="NO" # set to YES to enable openvpn
# NAME_if= # driver(s) to load, set to "tun", "tap" or "tun tap"
+# # it is OK to specify the if_ prefix.
#
# # optional:
# NAME_flags= # additional command line arguments
@@ -77,26 +79,21 @@ name="${name##*/}"
rcvar=$(set_rcvar)
-openvpn_precmd()
+stop_postcmd()
{
- for i in $interfaces ; do
- if ! sysctl debug.if_${i}_debug >/dev/null 2>&1 ; then
- if ! kldload if_${i} ; then
- warn "Could not load $i module."
- return 1
- fi
- fi
- done
- return 0
+ rm -f "$pidfile" || warn "Could not remove $pidfile."
}
-stop_postcmd()
+softrestart()
{
- rm -f "$pidfile" || warn "Could not remove $pidfile."
+ sig_reload=USR1 run_rc_command reload
+ exit $?
}
-# support SIGHUP to reparse configuration file
-extra_commands="reload"
+# reload: support SIGHUP to reparse configuration file
+# softrestart: support SIGUSR1 to reconnect without superuser privileges
+extra_commands="reload softrestart"
+softrestart_cmd="softrestart"
# pidfile
pidfile="/var/run/${name}.pid"
@@ -104,9 +101,7 @@ pidfile="/var/run/${name}.pid"
# command and arguments
command="%%PREFIX%%/sbin/openvpn"
-# run this first
-start_precmd="openvpn_precmd"
-# and this last
+# run this last
stop_postcmd="stop_postcmd"
load_rc_config ${name}
@@ -119,7 +114,13 @@ configfile="$(eval echo \${${name}_configfile})"
dir="$(eval echo \${${name}_dir})"
interfaces="$(eval echo \${${name}_if})"
+required_modules=
+for i in $interfaces ; do
+ required_modules="$required_modules${required_modules:+" "}if_${i#if_}"
+done
+
required_files=${configfile}
+
command_args="--cd ${dir} --daemon ${name} --config ${configfile} --writepid ${pidfile}"
run_rc_command "$1"