]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add regression tests for prerpz
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Aug 2016 08:51:00 +0000 (10:51 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 25 Aug 2016 08:52:04 +0000 (10:52 +0200)
regression-tests.recursor/RPZ-Lua/command
regression-tests.recursor/RPZ-Lua/expected_result
regression-tests.recursor/config.sh

index 7e77975e69d77d2f58512f7eeca124e8948be186..2d0d70aadfdce03d0665be7f9d4272752470c71f 100755 (executable)
@@ -1,2 +1,3 @@
 $SDIG $nameserver 5301 www3.example.net a recurse 2>&1
 $SDIG $nameserver 5301 android.marvin.example.net a recurse 2>&1
+$SDIG $nameserver 5301 www5.example.net a recurse 2>&1
index f43f16db5fa12ee55f1406dedb942d2b5550ed7e..1cd6e7a325b8d399c3e5d4e36bc868c1fba3b58a 100644 (file)
@@ -4,3 +4,6 @@ Rcode: 0 (No Error), RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
 Reply to question for qname='android.marvin.example.net.', qtype=A
 Rcode: 0 (No Error), RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
 0      android.marvin.example.net.     IN      A       15      192.0.2.5
+Reply to question for qname='www5.example.net.', qtype=A
+Rcode: 0 (No Error), RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+0      www5.example.net.       IN      A       0       192.0.2.25
index a8fcc249a32bd04c1e57fc44e8a24027c60dc7b6..7e0e6b17971640c86ddc65f2054849d763c0484f 100755 (executable)
@@ -89,6 +89,7 @@ www.example.net.         3600 IN A   192.0.2.1
 www2.example.net.        3600 IN A   192.0.2.2
 www3.example.net.        3600 IN A   192.0.2.3
 www4.example.net.        3600 IN A   192.0.2.4
+www5.example.net.        3600 IN A   192.0.2.5
 weirdtxt.example.net.    3600 IN IN  TXT "x\014x"
 arthur.example.net.      3600 IN NS  ns.arthur.example.net.
 arthur.example.net.      3600 IN NS  ns2.arthur.example.net.
@@ -550,6 +551,7 @@ EOF
 
 cat > recursor-service3/config.lua <<EOF
 rpzFile("$(pwd)/recursor-service3/rpz.zone", {policyName="myRPZ"})
+rpzFile("$(pwd)/recursor-service3/rpz2.zone", {policyName="mySecondRPZ"})
 EOF
 
 IFS=. read REV_PREFIX1 REV_PREFIX2 REV_PREFIX3 <<< $(echo $PREFIX) # This will bite us in the ass if we ever test on IPv6
@@ -565,6 +567,7 @@ arthur.example.net     CNAME .                   ; NXDOMAIN on apex
 srv.arthur.example.net CNAME rpz-passthru.       ; Allow this name though
 www.example.net        CNAME www2.example.net.   ; Local-Data Action
 www3.example.net       CNAME www4.example.net.   ; Local-Data Action (to be changed in preresolve)
+www5.example.net       A     192.0.2.15          ; Override www5.example.net.
 trillian.example.net   CNAME .                   ; NXDOMAIN on apex, allows all sub-names (#4086)
 
 32.4.2.0.192.rpz-ip    CNAME rpz-drop.           ; www4.example.net resolves to 192.0.2.4, drop A responses with that IP
@@ -575,7 +578,24 @@ ns.marvin.example.net.rpz-nsdname CNAME .        ; NXDOMAIN for anything hosted
 
 EOF
 
+cat > recursor-service3/rpz2.zone <<EOF
+\$TTL 2h;
+\$ORIGIN domain.example.
+@ SOA $SOA
+@ NS ns.example.net.
+
+www5.example.net       A     192.0.2.25          ; Override www5.example.net.
+
+EOF
+
 cat > recursor-service3/script.lua <<EOF
+function prerpz(dq)
+  if dq.qname:equal('www5.example.net') then
+    dq:discardPolicy('myRPZ')
+  end
+  return true
+end
+
 function preresolve(dq)
   if dq.qname:equal("android.marvin.example.net") then
     dq.wantsRPZ = false -- disable RPZ