mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-23 18:24:58 +02:00
limit auth-zone and rpz transfer amount and time taken. Default is disabled. This hardens against unbounded transfers. Thanks to Qifan Zhang, Palo Alto Networks, for the report.
43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
# #-- auth_transfer_limit.pre--#
|
|
# source the master var file when it's there
|
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
|
# use .tpkg.var.test for in test variable passing
|
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
|
|
|
PRE="../.."
|
|
. ../common.sh
|
|
if grep -e "define HAVE_PTHREAD 1" -e "define HAVE_SOLARIS_THREADS 1" -e "define HAVE_WINDOWS_THREADS 1" $PRE/config.h; then
|
|
TEST_FAST_RELOAD="yes"
|
|
else
|
|
TEST_FAST_RELOAD="no"
|
|
fi
|
|
echo "TEST_FAST_RELOAD=$TEST_FAST_RELOAD" >> .tpkg.var.test
|
|
|
|
get_random_port 2
|
|
UNBOUND_PORT=$RND_PORT
|
|
FWD_PORT=$(($RND_PORT + 1))
|
|
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
|
|
echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
|
|
|
|
# start forwarder
|
|
get_ldns_testns
|
|
$LDNS_TESTNS -p $FWD_PORT auth_transfer_limit.testns >fwd.log 2>&1 &
|
|
FWD_PID=$!
|
|
echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
|
|
|
|
# make config file
|
|
CONTROL_PATH=/tmp
|
|
CONTROL_PID=$$
|
|
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's?@CONTROL_PATH\@?'$CONTROL_PATH'?' -e 's/@CONTROL_PID@/'$CONTROL_PID'/' < auth_transfer_limit.conf > ub.conf
|
|
# start unbound in the background
|
|
$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
|
|
UNBOUND_PID=$!
|
|
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
|
|
echo "CONTROL_PATH=$CONTROL_PATH" >> .tpkg.var.test
|
|
echo "CONTROL_PID=$CONTROL_PID" >> .tpkg.var.test
|
|
|
|
cat .tpkg.var.test
|
|
wait_ldns_testns_up fwd.log
|
|
wait_unbound_up unbound.log
|
|
|