What if I want to use a simpler walled garden triggered by IP address?
It's possible that the only thing you know about an attacker is the IP address block they will use for their "phishing" web servers. If you don't know what domain names they'll use and you don't know what name servers they'll use, but you do know that every one of their "phishing" web servers is in a small block of IP addresses, then you can trigger on all answers which would include records in this address range using RPZ rules that look like the following example:
$ORIGIN rpz.example.com. 18.104.22.168.109.rpz-ip CNAME drop.garden.example.com. *.212.94.109.in-addr.arpa CNAME . *.213.94.109.in-addr.arpa CNAME . *.214.94.109.in-addr.arpa CNAME . *.215.94.109.in-addr.arpa CNAME .
Here, if a truthful answer would include an A (address) RR (resource record) whose value was within the 22.214.171.124/22 address block, then a synthetic answer will be sent instead of the truthful answer. Assuming the question is www.malicious.net, the synthetic answer will be:
www.malicious.net. CNAME drop.garden.example.com. drop.garden.example.com. A 192.168.7.89
This assumes that you've entered realDNS content (outside of your RPZ):
$ORIGIN example.com. walled-garden A 192.168.7.89
In this example there is no "*" in the CNAME target name, and so the original query name will not be present in your walled garden web server's log file. This is an undesirable loss of information, and is shown here for example purposes only. See "When maintaining a DNS RPZ, how do I put infected users into a walled garden?" for an example policy action that would preserve this information.
Other queries will also be affected by the above RPZ example rules, which are the PTR queries used in address-to-name translation. If your mail or web server receives a connection from an address in the example 126.96.36.199/22 address block, they will perform a PTR (pointer) record lookup to find out domain name is associated with that IP address. This kind of address-to-name translation is usually used for diagnostic or logging purposes, but it is also common for email servers to reject any email from IP addresses which have no address-to-name translation. (Most mail from such IP addresses will be spam, so the lack of a PTR record here has some predictive value.)
By using the "force name-does-not-exist" policy trigger on all lookups in the PTR name space associated with an address block, you can give your servers a hint that these IP addresses are probably sending junk.