Skip to content


Prior Art: Representing Queries in a DNSBL Lookup

Spam: DNS blocklists are a well-established, low-latency way to query a database of IP addresses for info. If you need to query a database over the internet quickly and in a connectionless manner, they’re ideal.

Declude have a page called how ip4r (DNSBL-style) DNS lookups work, which describes the general method:

  • input: the DNS zone for the DNSBL (e.g. ‘’)
  • input: IP address to query about (e.g. ‘’)
  • perform A, or TXT query to retrieve data: ‘dig TXT’
  • output: data (waves hands… not important right now)

All well and good, if all you have is a single IP address as input. But what if you want to attach more query parameters — such as your user ID, or some numeric value to set a ‘sensitivity’ level, like the SpamAssassin threshold system?

Easy-peasy: encode it in the looked-up hostname. Assuming you want to pass
a user ID number of ‘9583495’ and a threshold value of ‘7’ along with the query above, here’s one way to do it:

  • ‘dig TXT’

Note that to avoid charset issues, marshalling into an ‘-a-z0-9.’ namespace is probably safest. Of course, a dynamic DNS server is required to process these. But the protocol itself, at least, will support it.

(Just brain-dumping here so I have an URL to point to in future, and to get it into etc…)

Comments closed