summaryrefslogtreecommitdiff
path: root/dns/dnscrypt-proxy2/files/dnscrypt-proxy.in
blob: 77d79cf997d739cefbfecb71469446d653ccd08d (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
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dnscrypt_proxy
# REQUIRE: cleanvar SERVERS
# BEFORE:  dnsmasq local_unbound named nsmasq pdns unbound
#
# Options to configure dnscrypt-proxy via /etc/rc.conf:
#
# dnscrypt_proxy_enable (bool)	Enable service on boot
#				Default: NO
#
# dnscrypt_proxy_conf (str)	Config file to use
#				Default: %%ETCDIR%%/dnscrypt-proxy.toml
#
# dnscrypt_proxy_suexec (bool)	Run dnscrypt_proxy as root
#				Default: NO
#
# dnscrypt_proxy_uid (str)	User to run dnscrypt_proxy as
#				Default: %%USER%%

. /etc/rc.subr

name="dnscrypt_proxy"
rcvar="dnscrypt_proxy_enable"
pidfile="/var/run/dnscrypt-proxy.pid"
procname="%%PREFIX%%/sbin/dnscrypt-proxy"

load_rc_config $name

: ${dnscrypt_proxy_enable:="NO"}
: ${dnscrypt_proxy_conf:="%%ETCDIR%%/dnscrypt-proxy.toml"}
: ${dnscrypt_proxy_suexec:="NO"}
: ${dnscrypt_proxy_uid:="%%USER%%"}

checkyesno dnscrypt_proxy_suexec && dnscrypt_proxy_uid="root"

command="/usr/sbin/daemon"
command_args="-p ${pidfile} -u ${dnscrypt_proxy_uid} -f ${procname} -config ${dnscrypt_proxy_conf}"

run_rc_command "$1"