optional/unbound/start.py
Rama master · réplica de lectura del repositorio original.
#!/usr/bin/env python3
import os
import logging as log
import pwd
import subprocess
import sys
from socrate import conf, system, supervisor
system.set_env()
supervisor.clean_environment()
anchor = "/etc/unbound/trusted-key.key"
result = subprocess.run(["/usr/sbin/unbound-anchor", "-a", anchor], check=False)
if result.returncode:
log.warning("Unable to refresh the DNSSEC trust anchor (exit status %s)", result.returncode)
if os.path.exists(anchor):
unbound = pwd.getpwnam("unbound")
os.chown(anchor, unbound.pw_uid, unbound.pw_gid)
conf.jinja("/unbound.conf", os.environ, "/etc/unbound/unbound.conf")
supervisor.start([
{"name": "unbound", "command": ["/usr/sbin/unbound", "-d", "-c", "/etc/unbound/unbound.conf"]},
])