1#!/bin/sh 2#
| 1#!/bin/sh 2#
|
3# $FreeBSD: head/etc/rc.d/local_unbound 271257 2014-09-08 09:33:43Z des $
| 3# $FreeBSD: head/etc/rc.d/local_unbound 271262 2014-09-08 12:26:52Z des $
|
4# 5 6# PROVIDE: local_unbound 7# REQUIRE: FILESYSTEMS netif resolv 8# KEYWORD: shutdown 9 10. /etc/rc.subr 11 12name="local_unbound" 13desc="local caching forwarding resolver" 14rcvar="local_unbound_enable" 15
| 4# 5 6# PROVIDE: local_unbound 7# REQUIRE: FILESYSTEMS netif resolv 8# KEYWORD: shutdown 9 10. /etc/rc.subr 11 12name="local_unbound" 13desc="local caching forwarding resolver" 14rcvar="local_unbound_enable" 15
|
| 16command="/usr/sbin/unbound"
|
16extra_commands="anchor configtest reload setup" 17start_precmd="local_unbound_prestart" 18reload_precmd="local_unbound_configtest" 19anchor_cmd="local_unbound_anchor" 20configtest_cmd="local_unbound_configtest" 21setup_cmd="local_unbound_setup" 22pidfile="/var/run/${name}.pid" 23
| 17extra_commands="anchor configtest reload setup" 18start_precmd="local_unbound_prestart" 19reload_precmd="local_unbound_configtest" 20anchor_cmd="local_unbound_anchor" 21configtest_cmd="local_unbound_configtest" 22setup_cmd="local_unbound_setup" 23pidfile="/var/run/${name}.pid" 24
|
| 25: ${local_unbound_workdir:=/var/unbound} 26: ${local_unbound_config:=${local_unbound_workdir}/unbound.conf} 27: ${local_unbound_flags:=-c${local_unbound_config}} 28: ${local_unbound_forwardconf:=${local_unbound_workdir}/forward.conf} 29: ${local_unbound_anchor:=${local_unbound_workdir}/root.key} 30: ${local_unbound_forwarders:=} 31 32load_rc_config $name 33
|
24do_as_unbound() 25{
| 34do_as_unbound() 35{
|
26 echo "$@" | /usr/bin/su -m unbound
| 36 echo "$@" | su -m unbound
|
27} 28 29# 30# Retrieve or update the DNSSEC root anchor 31# 32local_unbound_anchor() 33{
| 37} 38 39# 40# Retrieve or update the DNSSEC root anchor 41# 42local_unbound_anchor() 43{
|
34 do_as_unbound ${local_unbound_program%/*}/unbound-anchor \ 35 -a ${local_unbound_anchor}
| 44 do_as_unbound /usr/sbin/unbound-anchor -a ${local_unbound_anchor}
|
36 # we can't trust the exit code - check if the file exists 37 [ -f ${local_unbound_anchor} ] 38} 39 40# 41# Check the unbound configuration file 42# 43local_unbound_configtest() 44{
| 45 # we can't trust the exit code - check if the file exists 46 [ -f ${local_unbound_anchor} ] 47} 48 49# 50# Check the unbound configuration file 51# 52local_unbound_configtest() 53{
|
45 do_as_unbound ${local_unbound_program%/*}/unbound-checkconf \ 46 ${local_unbound_config}
| 54 do_as_unbound /usr/sbin/unbound-checkconf ${local_unbound_config}
|
47} 48 49# 50# Create the unbound configuration file and update resolv.conf to 51# point to unbound. 52# 53local_unbound_setup() 54{ 55 echo "Performing initial setup."
| 55} 56 57# 58# Create the unbound configuration file and update resolv.conf to 59# point to unbound. 60# 61local_unbound_setup() 62{ 63 echo "Performing initial setup."
|
56 ${local_unbound_program%/*}/local-unbound-setup -n \
| 64 /usr/sbin/local-unbound-setup -n \
|
57 -u unbound \ 58 -w ${local_unbound_workdir} \ 59 -c ${local_unbound_config} \ 60 -f ${local_unbound_forwardconf} \ 61 -a ${local_unbound_anchor} \ 62 ${local_unbound_forwarders} 63} 64
--- 19 unchanged lines hidden --- | 65 -u unbound \ 66 -w ${local_unbound_workdir} \ 67 -c ${local_unbound_config} \ 68 -f ${local_unbound_forwardconf} \ 69 -a ${local_unbound_anchor} \ 70 ${local_unbound_forwarders} 71} 72
--- 19 unchanged lines hidden --- |