summaryrefslogtreecommitdiff
path: root/security/openvpn20
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2007-02-23 08:38:53 +0000
committerVasil Dimov <vd@FreeBSD.org>2007-02-23 08:38:53 +0000
commit9d4f5552a9c59e383ecfd2a65cde0c919b641144 (patch)
tree88826b7f844a0ef96b244f64782b8607db9d33d4 /security/openvpn20
parent- Update to 0.3.1 (diff)
* Add support for running multiple instances of openvpn to the startup script
Inspired by [1] * Bump PORTREVISION * Update the comment which says not to send notices about 2.0.8 to 2.0.9 since 2.0.9 also introduces only Windows changes. Remove maintainer's name from this comment since he did not explicitly state this. PR: ports/108371 [1] Submitted by: Denis Shaposhnikov <dsh@vlink.ru>, Gleb Kozyrev <gkozyrev@gmail.com> [1] Approved by: matthias.andree@gmx.de (maintainer timeout, 28 days)
Notes
Notes: svn path=/head/; revision=185735
Diffstat (limited to 'security/openvpn20')
-rw-r--r--security/openvpn20/Makefile6
-rw-r--r--security/openvpn20/files/openvpn.sh.in53
2 files changed, 39 insertions, 20 deletions
diff --git a/security/openvpn20/Makefile b/security/openvpn20/Makefile
index 0e8a956281d6..828ef991a044 100644
--- a/security/openvpn20/Makefile
+++ b/security/openvpn20/Makefile
@@ -7,13 +7,13 @@
PORTNAME= openvpn
# -----------------------------------------------------
-# DO NOT BOTHER TO SEND NOTICES ABOUT 2.0.8 AS IT FIXES
+# DO NOT BOTHER TO SEND NOTICES ABOUT 2.0.9 AS IT FIXES
# WINDOWS-ONLY BUGS THAT DON'T AFFECT *BSD AND THUS
# DOES NOT WARRANT A PORT UPGRADE! AND UPGRADE REQUESTS
-# WILL BE DROPPED. -- Matthias Andree, 2006-10-01
+# WILL BE DROPPED.
# -----------------------------------------------------
PORTVERSION= 2.0.6
-PORTREVISION= 4
+PORTREVISION= 5
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 b4fc4dbba162..728516ba1aa2 100644
--- a/security/openvpn20/files/openvpn.sh.in
+++ b/security/openvpn20/files/openvpn.sh.in
@@ -30,17 +30,29 @@
# -----------------------------------------------------------------------------
#
-# Add the following lines to /etc/rc.conf to enable openvpn at boot-up time:
+# This script supports running multiple instances of openvpn.
+# To run additional instance link this script to something like
+# % ln -s openvpn openvpn_foo
+# and define additional openvpn_foo_* variables in one of
+# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo
#
-# openvpn_enable="YES" # YES or NO
-# openvpn_if="tun" # driver(s) to load, set to "tun", "tap" or "tun tap"
+# Below NAME should be substituted with the name of this script. By default
+# it is openvpn, so read as openvpn_enable. If you linked the script to
+# openvpn_foo, then read as openvpn_foo_enable etc.
+#
+# The following variables are supported (defaults are shown).
+# You can place them in any of
+# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/NAME
+#
+# NAME_enable="NO" # set to YES to enable openvpn
+# NAME_if="" # driver(s) to load, set to "tun", "tap" or "tun tap"
#
# # optional:
-# openvpn_flags="" # openvpn command line flags
-# openvpn_configfile="%%PREFIX%%/etc/openvpn/openvpn.conf" # --config file
-# openvpn_dir="%%PREFIX%%/etc/openvpn" # --cd directory
+# NAME_flags="" # additional command line arguments
+# NAME_configfile="%%PREFIX%%/etc/openvpn/NAME.conf" # --config file
+# NAME_dir="%%PREFIX%%/etc/openvpn" # --cd directory
#
-# You also need to set openvpn_configfile and openvpn_dir, if the configuration
+# You also need to set NAME_configfile and NAME_dir, if the configuration
# file and directory where keys and certificates reside differ from the above
# settings.
#
@@ -51,14 +63,14 @@
. %%RC_SUBR%%
-name=openvpn
+name=`basename ${0}`
rcvar=`set_rcvar`
prefix="%%PREFIX%%"
openvpn_precmd()
{
- for i in $openvpn_if ; do
+ for i in $interfaces ; do
# FreeBSD <= 5.4 does not know kldstat's -m option
# FreeBSD >= 6.0 does not add debug.* sysctl information
# in the default build - we check both to keep things simple
@@ -85,7 +97,7 @@ extra_commands="reload"
pidfile="/var/run/${name}.pid"
# command and arguments
-command="%%PREFIX%%/sbin/${name}"
+command="%%PREFIX%%/sbin/openvpn"
# run this first
start_precmd="openvpn_precmd"
@@ -93,11 +105,18 @@ start_precmd="openvpn_precmd"
stop_postcmd="stop_postcmd"
load_rc_config ${name}
-: ${openvpn_enable="NO"}
-: ${openvpn_flags=""}
-: ${openvpn_if=""}
-: ${openvpn_configfile="${prefix}/etc/openvpn/openvpn.conf"}
-: ${openvpn_dir="${prefix}/etc/openvpn"}
-required_files="${openvpn_configfile}"
-command_args="--cd ${openvpn_dir} --daemon --config ${openvpn_configfile} --writepid ${pidfile}"
+
+eval ": \${${name}_enable:=\"NO\"}"
+eval ": \${${name}_flags:=\"\"}"
+eval ": \${${name}_if:=\"\"}"
+eval ": \${${name}_configfile:=\"${prefix}/etc/openvpn/${name}.conf\"}"
+eval ": \${${name}_dir:=\"${prefix}/etc/openvpn\"}"
+
+configfile="`eval echo \\${${name}_configfile}`"
+dir="`eval echo \\${${name}_dir}`"
+interfaces="`eval echo \\${${name}_if}`"
+
+required_files=${configfile}
+command_args="--cd ${dir} --daemon --config ${configfile} --writepid ${pidfile}"
+
run_rc_command "$1"