Skip to content

Commit 443a167

Browse files
cliffmccarthymissytake
authored andcommitted
Block unbound from starting up on install
- On an IPv4-only system, if unbound is started but not configured, it causes subsequent steps to fail to resolve hosts. - Revised UnboundDeployer.install_impl() to use policy-rc.d to prevent the service from starting when installed. This is the same mechanism used to keep nginx from starting on install.
1 parent ac8a897 commit 443a167

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmdeploy/src/cmdeploy/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,31 @@ def install_impl():
325325
# Run local DNS resolver `unbound`.
326326
# `resolvconf` takes care of setting up /etc/resolv.conf
327327
# to use 127.0.0.1 as the resolver.
328+
329+
#
330+
# On an IPv4-only system, if unbound is started but not
331+
# configured, it causes subsequent steps to fail to resolve hosts.
332+
# Here, we use policy-rc.d to prevent unbound from starting up
333+
# on initial install. Later, we will configure it and start it.
334+
#
335+
# For documentation about policy-rc.d, see:
336+
# https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt
337+
#
338+
files.put(
339+
src=importlib.resources.files(__package__).joinpath("policy-rc.d"),
340+
dest="/usr/sbin/policy-rc.d",
341+
user="root",
342+
group="root",
343+
mode="755",
344+
)
345+
328346
apt.packages(
329347
name="Install unbound",
330348
packages=["unbound", "unbound-anchor", "dnsutils"],
331349
)
332350

351+
files.file("/usr/sbin/policy-rc.d", present=False)
352+
333353
def configure_impl(self):
334354
server.shell(
335355
name="Generate root keys for validating DNSSEC",

0 commit comments

Comments
 (0)