+++ /dev/null
-#!/usr/bin/env bash
-set -e
-if [ "${PDNS_DEBUG}" = "YES" ]; then
- set -x
-fi
-
-bindwait ()
-{
- configname=$1
- domcount=1
- loopcount=0
- while [ $loopcount -lt 20 ]; do
- sleep 1
- done=$( ($PDNSCONTROL --config-name=$configname --socket-dir=. --no-config bind-domain-status || true) | grep -c 'parsed into memory' || true )
- if [ $done = $domcount ]
- then
- return
- fi
- let loopcount=loopcount+1
- done
- if [ $done != $domcount ]; then
- echo "Domain parsing failed" >> failed_tests
- fi
-}
-
-port=5501
-rm -f pdns*.pid
-
-$PDNS --daemon=no --local-port=$port --socket-dir=./ \
- --no-shuffle --launch=bind --bind-config=lua-policy/named.conf \
- --experimental-lua-policy-script=lua-policy/policy.lua \
- --cache-ttl=60 --no-config --module-dir=../regression-tests/modules &
-bindwait
-
-# plain SOA query
-$SDIG 127.0.0.1 5501 minimal.com SOA | LC_ALL=C sort
-# expect DROP, so timeout
-timeout 3 $SDIG 127.0.0.1 5501 drop.minimal.com SOA || ret=$?
-echo timeout/sdig return value: $ret
-# expect TRUNCATE
-$SDIG 127.0.0.1 5501 truncate.minimal.com SOA
-
-kill $(cat pdns*.pid)
-rm pdns*.pid
+++ /dev/null
-Test the Lua policy engine.
\ No newline at end of file
+++ /dev/null
-policy.lua loaded
-0 minimal.com. IN SOA 120 ns1.example.com. ahu.example.com. 2000081501 28800 7200 604800 86400
-Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
-Reply to question for qname='minimal.com.', qtype=SOA
-dropping!
-timeout/sdig return value: 124
-truncating!
-Reply to question for qname='truncate.minimal.com.', qtype=SOA
-Rcode: 0 (No Error), RD: 0, QR: 1, TC: 1, AA: 1, opcode: 0
+++ /dev/null
-options {
- directory "../regression-tests/zones/";
- recursion no;
- listen-on port 5300 {
- 127.0.0.1;
- };
- version "Meow!Meow!";
- minimal-responses yes;
-};
-
-zone "minimal.com"{
- type master;
- file "./minimal.com";
-};
+++ /dev/null
-print("policy.lua loaded")
-io.flush()
-function police (req, resp, isTcp)
- qname, qtype = req:getQuestion()
-
- if qname == 'drop.minimal.com.' then print 'dropping!' io.flush() return pdns.DROP end
- if qname == 'truncate.minimal.com.' then print 'truncating!' io.flush() return pdns.TRUNCATE end
-
- return pdns.PASS
-end