]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Only run system tests as root in developer mode
authorMichał Kępień <michal@isc.org>
Fri, 31 Jul 2020 05:46:27 +0000 (07:46 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 31 Jul 2020 05:46:27 +0000 (07:46 +0200)
Running system tests with root privileges is potentially dangerous.
Only allow it when explicitly requested (by building with
--enable-developer).

(cherry picked from commit 3ef106f69df076340914257df4bdd1a1c22a9440)

bin/tests/system/run.sh

index 51d1bde1ef56a23001516d87256cb413fbe4d35d..a87c2bb956dc29701419999d908e14bba9aded09 100755 (executable)
 SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
 . $SYSTEMTESTTOP/conf.sh
 
+if [ "$(id -u)" -eq "0" ] && ! ${NAMED} -V | grep -q -F -- "enable-developer"; then
+       echofail "Refusing to run test as root. Build with --enable-developer to override." >&2
+       exit 1
+fi
+
 export SYSTEMTESTTOP
 
 date_with_args() (