summaryrefslogtreecommitdiff
path: root/security/teleport/files/teleport.in
blob: 248b0d7dc4419f601f25d82a285c295d482862dd (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh

# PROVIDE: teleport
# REQUIRE: NETWORKING SERVERS DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# teleport_enable (bool):       Set to NO by default.
#                               Set it to YES to enable teleport.
# teleport_config (str):        Configuration file.
#                               Default is "${LOCALBASE}/etc/teleport.yaml"
# teleport_dir (dir):           Set dir to run teleport in.
#                               Default is "/var/db/teleport".
# teleport_roles (dir):         Set roles to run teleport in.
#                               Default is "node".
#                               Can be any combination of
#                               "node", "app", "proxy" and "auth", separated by commas

. /etc/rc.subr

name=teleport
rcvar=teleport_enable

load_rc_config $name

: ${teleport_enable:="NO"}
: ${teleport_config:="%%PREFIX%%/etc/teleport.yaml"}
: ${teleport_args:="--config=${teleport_config}"}
: ${teleport_dir:="/var/db/teleport"}
: ${teleport_roles:="node"}

pidfile=/var/run/teleport.pid
required_files="${teleport_config}"
procname="%%PREFIX%%/bin/teleport"
command="/usr/sbin/daemon"

DAEMON=$(daemon 2>&1 | grep -q syslog ; echo $?)
if [ ${DAEMON} -eq 0 ]; then
  DAEMON_SYSLOG_FLAGS="-S -T teleport -s info -m 3"
else
  DAEMON_SYSLOG_FLAGS=""
fi

command_args="${DAEMON_SYSLOG_FLAGS} -f -p ${pidfile} /usr/bin/env ${teleport_env} ${procname} start --roles=${teleport_roles} ${teleport_args}"

start_precmd="teleport_prestart"

teleport_prestart()
{
	mkdir -p ${teleport_dir}
}

run_rc_command "$1"