Home | History | Annotate | Line # | Download | only in rpzrecurse
      1      1.1  christos Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2      1.1  christos 
      3  1.1.1.3  christos SPDX-License-Identifier: MPL-2.0
      4  1.1.1.3  christos 
      5  1.1.1.3  christos This Source Code Form is subject to the terms of the Mozilla Public
      6  1.1.1.3  christos License, v. 2.0.  If a copy of the MPL was not distributed with this
      7  1.1.1.3  christos file, you can obtain one at https://mozilla.org/MPL/2.0/.
      8  1.1.1.3  christos 
      9  1.1.1.3  christos See the COPYRIGHT file distributed with this work for additional
     10  1.1.1.3  christos information regarding copyright ownership.
     11      1.1  christos 
     12      1.1  christos These tests check RPZ recursion behavior (including skipping
     13      1.1  christos recursion when appropriate).
     14      1.1  christos 
     15      1.1  christos The general structure of the tests is:
     16      1.1  christos 
     17      1.1  christos * The resolver (ns2) with an unqualified view containing the policy
     18      1.1  christos   zones, the response-policy statement, and a root hint zone
     19      1.1  christos 
     20      1.1  christos * The auth server that contains two authoritative zones, l1.l0 and
     21      1.1  christos   l2.l1.l0, both delegated to itself. l2.l1.l0 specifies a non-existent
     22      1.1  christos   zone data file and so will generate SERVFAILs for any queries to it.
     23      1.1  christos 
     24      1.1  christos The l2.l1.l0 zone was chosen to generate SERVFAIL responses because RPZ
     25      1.1  christos evaluation will use that error response whenever it encounters it during
     26      1.1  christos processing, thus making it a binary indicator for whether or not
     27      1.1  christos recursion was attempted.  This also allows us to not worry about having
     28      1.1  christos to craft 'ip', 'nsdname', and 'nsip' rules that matched the queries.
     29      1.1  christos 
     30      1.1  christos Each test is intended to be fed a number of queries constructed as
     31      1.1  christos qXX.l2.l1.l0, where XX is the 1-based query sequence number (e.g. the
     32      1.1  christos first query of each test is q01.l2.l1.l0).
     33      1.1  christos 
     34      1.1  christos For all the tests the triggers are constructed as follows:
     35      1.1  christos client-ip - match 127.0.0.1/32
     36      1.1  christos ip - match 255.255.255.255/32 (does not matter due to SERVFAIL)
     37      1.1  christos nsdname - match ns.example.org (also does not matter)
     38      1.1  christos nsip - match 255.255.255.255/32 (also does not matter)
     39      1.1  christos qname - match qXX.l2.l1.l0, where XX is the query sequence number that
     40      1.1  christos is intended to be matched by this qname rule.
     41      1.1  christos 
     42      1.1  christos Here's the detail on the test cases:
     43      1.1  christos 
     44      1.1  christos Group 1 - testing skipping recursion for a single policy zone with only
     45      1.1  christos records that allow recursion to be skipped
     46      1.1  christos 
     47      1.1  christos Test 1a:
     48      1.1  christos     1 policy zone containing 1 'client-ip' trigger
     49      1.1  christos     1 query, expected to skip recursion
     50      1.1  christos 
     51      1.1  christos Test 1b:
     52      1.1  christos     1 policy zone containing 1 'qname' trigger (q01)
     53      1.1  christos     2 queries, q01 is expected to skip recursion, q02 is expected to
     54      1.1  christos       recurse
     55      1.1  christos 
     56      1.1  christos Test 1c:
     57      1.1  christos     1 policy zone containing both a 'client-ip' and 'qname' trigger (q02)
     58      1.1  christos     1 query, expected to skip recursion
     59      1.1  christos 
     60      1.1  christos Group 2 - testing skipping recursion with multiple policy zones when all
     61      1.1  christos zones have only trigger types eligible to skip recursion with
     62      1.1  christos 
     63      1.1  christos Test 2a:
     64      1.1  christos     32 policy zones, each containing 1 'qname' trigger (qNN, where NN is
     65      1.1  christos        the zone's sequence 1-based sequence number formatted to 2 digits,
     66      1.1  christos        so each of the first 32 queries should match a different zone)
     67      1.1  christos     33 queries, the first 32 of which are expected to skip recursion
     68      1.1  christos        while the 33rd is expected to recurse
     69      1.1  christos 
     70      1.1  christos Group 3 - Testing interaction of triggers that require recursion when in
     71      1.1  christos a single zone, both alone and with triggers that allow recursion to be
     72      1.1  christos skipped
     73      1.1  christos 
     74      1.1  christos Test 3a:
     75      1.1  christos     1 policy zone containing 1 'ip' trigger
     76      1.1  christos     1 query, expected to recurse
     77      1.1  christos 
     78      1.1  christos Test 3b:
     79      1.1  christos     1 policy zone containing 1 'nsdname' trigger
     80      1.1  christos     1 query, expected to recurse
     81      1.1  christos 
     82      1.1  christos Test 3c:
     83      1.1  christos     1 policy zone containing 1 'nsip' trigger
     84      1.1  christos     1 query, expected to recurse
     85      1.1  christos 
     86      1.1  christos Test 3d:
     87      1.1  christos     1 policy zone containing 1 'ip' trigger and 1 'qname' trigger (q02)
     88      1.1  christos     2 queries, the first should not recurse and the second should recurse
     89      1.1  christos 
     90      1.1  christos Test 3e:
     91      1.1  christos     1 policy zone containing 1 'nsdname' trigger and 1 'qname' trigger
     92      1.1  christos       (q02)
     93      1.1  christos     2 queries, the first should not recurse and the second should recurse
     94      1.1  christos 
     95      1.1  christos Test 3f:
     96      1.1  christos     1 policy zone containing 1 'nsip' trigger and 1 'qname' trigger (q02)
     97      1.1  christos     2 queries, the first should not recurse and the second should recurse
     98      1.1  christos 
     99      1.1  christos Group 4 - contains 32 subtests designed to verify that recursion is
    100      1.1  christos skippable for only the appropriate zones based on the order specified in
    101      1.1  christos the 'response-policy' statement
    102      1.1  christos 
    103      1.1  christos Tests 4aa to 4bf:
    104      1.1  christos     32 policy zones per test, one of which is configured with 1 'ip'
    105      1.1  christos        trigger and one 'qname' trigger while the others are configured
    106      1.1  christos        only with 1 'qname' trigger.  The zone with both triggers starts
    107      1.1  christos        listed first and is moved backwards by one position with each
    108      1.1  christos        test.  The 'qname' triggers in the zones are structured so that
    109      1.1  christos        the zones are tested starting with the first zone and the 'ip'
    110      1.1  christos        trigger is tested before the 'qname' trigger for that zone.
    111      1.1  christos     33 queries per test, where the number expected to skip recursion
    112      1.1  christos        matches the test sequence number: e.g. 1 skip for 4aa, 26 skips
    113      1.1  christos        for 4az, and 32 skips for 4bf
    114      1.1  christos 
    115      1.1  christos Group 5 - This test verifies that the "pivot" policy zone for whether or
    116      1.1  christos not recursion can be skipped is the first listed zone with applicable
    117      1.1  christos trigger types rather than a later listed zone.
    118      1.1  christos 
    119      1.1  christos Test 5a:
    120      1.1  christos     5 policy zones, the 1st, 3rd, and 5th configured with 1 'qname'
    121      1.1  christos       trigger each (q01, q04, and q06, respectively), the 2nd and 4th
    122      1.1  christos       each configured with an 'ip' and 'qname' trigger (q02 and q05,
    123      1.1  christos       respectively for the 'qname' triggers
    124      1.1  christos     6 queries, of which only q01 and q02 are expected to skip recursion
    125