summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wegener <swegener@gentoo.org>2021-06-05 22:57:47 +0200
committerSven Wegener <swegener@gentoo.org>2021-06-05 23:21:01 +0200
commite93b43433306a40fa13304ab365472df313bca67 (patch)
tree8801f5e72660af597ac6aeb295dbaa30203ec062 /net-dns/pdns-recursor
parentnet-dns/pdns-recursor: Cleanup (diff)
downloadgentoo-e93b43433306a40fa13304ab365472df313bca67.tar.gz
gentoo-e93b43433306a40fa13304ab365472df313bca67.tar.bz2
gentoo-e93b43433306a40fa13304ab365472df313bca67.zip
net-dns/pdns-recursor: Create socket-dir with correct user
Package-Manager: Portage-3.0.18, Repoman-3.0.2 Closes: https://bugs.gentoo.org/793854 Signed-off-by: Sven Wegener <swegener@gentoo.org>
Diffstat (limited to 'net-dns/pdns-recursor')
-rw-r--r--net-dns/pdns-recursor/files/pdns-recursor-r214
1 files changed, 10 insertions, 4 deletions
diff --git a/net-dns/pdns-recursor/files/pdns-recursor-r2 b/net-dns/pdns-recursor/files/pdns-recursor-r2
index 01ce79167bbc..0ca3dfc18782 100644
--- a/net-dns/pdns-recursor/files/pdns-recursor-r2
+++ b/net-dns/pdns-recursor/files/pdns-recursor-r2
@@ -1,12 +1,18 @@
#!/sbin/openrc-run
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+get_config_option() {
+ awk -v option="${1}" -F = '$1 == option { print $2 }' "${PDNS_CONFIG}"
+}
+
PDNS_CONFIGDIR="${PDNS_CONFIGDIR:-/etc/powerdns}"
PDNS_CONFIG="${PDNS_CONFIGDIR}/recursor.conf"
-PDNS_CHROOTDIR="$( awk -F = '$1 == "chroot" { print $2 }' "${PDNS_CONFIG}" )"
-PDNS_SOCKETDIR="$( awk -F = '$1 == "socket-dir" { print $2 }' "${PDNS_CONFIG}" )"
+PDNS_CHROOTDIR="$( get_config_option chroot )"
+PDNS_SOCKETDIR="$( get_config_option socket-dir )"
+PDNS_SETUID="$( get_config_option setuid )"
+PDNS_SETGID="$( get_config_option setgid )"
[ -z "${PDNS_SOCKETDIR}" -a -z "${PDNS_CHROOTDIR}" ] && PDNS_SOCKETDIR="/var/run/pdns-recursor"
name="PowerDNS Recursor"
@@ -31,7 +37,7 @@ depend() {
}
start_pre() {
- checkpath --directory --mode 750 "${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}"
+ checkpath --directory --owner "${PDNS_SETUID:-root}:${PDNS_SETGID:-root}" --mode 750 "${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}"
}
ping() {