blob: 9f4adbd184a978e366d01d8620c65b45ee28e4ba (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
description="An open-source turn-key solution for DNSSEC"
depend() {
use logger
}
checkconfig() {
if [ -z "${CHECKCONFIG_BIN}" ]; then
# no config checker configured, skip config check
return 0
fi
if [ -x "${CHECKCONFIG_BIN}" ]; then
output=$(${CHECKCONFIG_BIN} 2>&1| grep -v -E "^/etc/opendnssec/(conf|kasp).xml validates")
if [ -n "$output" ]; then
echo $output
fi
errors=$(echo $output | grep ERROR | wc -l)
if [ $errors -gt 0 ]; then
ewarn "$errors error(s) found in OpenDNSSEC configuration."
fi
return $errors
fi
eerror "Unable to execute ${CHECKCONFIG_BIN:-config binary}"
# can't validate config, just die
return 1
}
start_enforcer() {
if [ -n "${ENFORCER_BIN}" ] && [ -x "${ENFORCER_BIN}" ]; then
ebegin "Starting OpenDNSSEC Enforcer"
${CONTROL_BIN} enforcer start > /dev/null
eend $?
else
if [ -n "${ENFORCER_BIN}" ]; then
eerror "OpenDNSSEC Enforcer binary not executable"
return 1
fi
einfo "OpenDNSSEC Enforcer not used."
fi
}
stop_enforcer() {
if [ -x "${ENFORCER_BIN}" ]; then
ebegin "Stopping OpenDNSSEC Enforcer"
${CONTROL_BIN} enforcer stop > /dev/null
eend $?
fi
}
start_signer() {
if [ -n "${SIGNER_BIN}" ] && [ -x "${SIGNER_BIN}" ]; then
ebegin "Starting OpenDNSSEC Signer"
${CONTROL_BIN} signer start > /dev/null 2>&1
eend $?
else
if [ -n "${SIGNER_BIN}" ]; then
eerror "OpenDNSSEC Signer binary not executable"
return 1
fi
einfo "OpenDNSSEC Signer not used."
fi
}
stop_signer() {
if [ -x "${SIGNER_BIN}" ]; then
ebegin "Stopping OpenDNSSEC Signer"
${CONTROL_BIN} signer stop > /dev/null 2>&1
eend $?
fi
}
start_eppclient() {
if [ -n "${EPPCLIENT_BIN}" ] && [ -x "${EPPCLIENT_BIN}" ]; then
ebegin "Starting OpenDNSSEC Eppclient"
start-stop-daemon \
--start \
--user opendnssec --group opendnssec \
--exec "${EPPCLIENT_BIN}" \
--pidfile "${EPPCLIENT_PIDFILE}" > /dev/null
eend $?
else
# eppclient is ofptional so if we use the default binary and it
# is not used we won't die
if [ -n "${EPPCLIENT_BIN}" ] && \
[ "${EPPCLIENT_BIN}" != "/usr/sbin/eppclientd" ]; then
eerror "OpenDNSSEC Eppclient binary not executable"
return 1
fi
einfo "OpenDNSSEC Eppclient not used."
fi
}
stop_eppclient() {
if [ -x "${EPPCLIENT_BIN}" ]; then
ebegin "Stopping OpenDNSSEC Eppclient"
start-stop-daemon \
--stop \
--exec "${EPPCLIENT_BIN}" \
--pidfile "${EPPCLIENT_PIDFILE}" > /dev/null
eend $?
fi
}
start() {
checkconfig || return $?
test -d /run/opendnssec || mkdir -p /run/opendnssec
chown opendnssec:opendnssec /run/opendnssec
start_enforcer || return $?
start_signer || return $?
start_eppclient || return $?
}
stop() {
stop_eppclient
stop_signer
stop_enforcer
sleep 5
}
|