summaryrefslogtreecommitdiff
path: root/security/dsvpn/files/dsvpn.in
blob: 4cdbd189697fbc7c9600dd2e328359e71846c01f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

# PROVIDE: dsvpn
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# dsvpn_enable		   (bool)	Default: NO
# dsvpn_key		   (str)	Default: %%PREFIX%%/etc/dsvpn.key
# dsvpn_bind		   (str)	Default: auto
# dsvpn_port		   (str)	Default: 443
# dsvpn_remote		   (str)	Default: <empty>
#

. /etc/rc.subr

name="dsvpn"
rcvar="${name}_enable"
pidfile="/var/run/${name}.pid"
procname="%%PREFIX%%/sbin/${name}"

: ${dsvpn_enable:="NO"}
: ${dsvpn_key:="%%PREFIX%%/etc/dsvpn.key"}
: ${dsvpn_bind:="auto"}
: ${dsvpn_port:="443"}
: ${dsvpn_remote:=""}

load_rc_config $name

required_files=${dsvpn_key}

command=/usr/sbin/daemon
[ -z ${dsvpn_remote} ] &&
  command_args_dsvpn="server ${dsvpn_key} ${dsvpn_bind} ${dsvpn_port}" || \
  command_args_dsvpn="client ${dsvpn_key} ${dsvpn_remote} ${dsvpn_port}"
command_args="-o /var/log/${name}.log -p ${pidfile} ${procname} ${command_args_dsvpn}"

run_rc_command "$1"