aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
Diffstat (limited to 'config/unbound')
-rw-r--r--config/unbound/unbound.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 2b3b30b0..6b7080f4 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -37,9 +37,13 @@ function unbound_initial_setup() {
$config['installedpackages']['unbound']['config'] = array();
$unbound_config = &$config['installedpackages']['unbound']['config'][0];
-
+
+ // Ensure Unbound user exists
+ exec("/usr/sbin/pw useradd unbound");
+
// Setup unbound
mwexec("/bin/mkdir -p /usr/local/etc/unbound /usr/local/etc/unbound/dev");
+ @chown("/usr/local/etc/unbound/.", "unbound");
@touch("/usr/local/etc/unbound/root.hints");
@touch("/usr/local/etc/unbound/root-trust-anchor");
@chown("/usr/local/etc/unbound/root-trust-anchor", "unbound");
@@ -64,6 +68,8 @@ function unbound_initial_setup() {
unbound_resync_config();
unbound_keys_setup();
+ exec("/usr/sbin/chown unbound:wheel /usr/local/etc/unbound/*");
+
// Write out the XML config
write_config();
@@ -399,6 +405,9 @@ function unbound_uninstall() {
mwexec("rm -rf /usr/local/etc/unbound");
mwexec("rm -f /usr/local/etc/rc.d/unbound.sh");
+ // Remove unbound user
+ exec("/usr/sbin/pw userdel unbound");
+
conf_mount_ro();
}