How to combine DNS server with a database
Posted on 2009-04-15
I have a commercial product whose licensing I want to track using DNS. To verify the license upon installation the product sends a DNS query for the license number, e.g., 12345-6789.mysite.com.
I want to implement a DNS server for mysite.com that receives these DNS queries and records them in a database. It needs to track the originating IP address of each query. That way if I see a lot of hits for the same license code from many different IP addresses it will tell me that the license code has been pirated.
The DNS server will query the database and respond with different pseudo-addresses depending on the license status. For example, 127.0.0.1 = good license, 127.0.0.2 = pirated license, etc.
My resellers have a license generator that I have given each of them. The licenses generated by each reseller have a unique prefix, but I won't know the entire license number in advance since part of it is randomly generated. So I can't simply populate a DNS zone with a static list of type A records. Basically I need a way to record NXDOMAIN responses for a given 12345-6789.mysite.com license originating from each unique source IP address and then print a summary report sorted by license number.
I have a good background in SQL and Win32 programming. I already have SQL Server and Visual Studio 2008. What I need is source code for a DNS server that compiles on Visual Studio 2008 and runs on Windows Server that I can hack. The question is, where can I find such a thing?
I know about BIND, but it has a reputation for security problems (originally created circa 1980s) and is so big and crufty I'd rather not attempt it. djbdns is lightweight but was abandoned in 2007 and is no longer actively maintained. Is there anything else? Open Source is not a problem since the result will be for internal use only. Commercial products are also okay.