MaraDNS: An overviewMaraDNS is a small and lightweight cross-platform open-source DNS server. The server is remarkably easy to configure for someone comfortable editing text configuration files. MaraDNS is released under a BSD license.
Table of contents
What is DNSThe internet uses numbers, not names, to find computers. DNS is the internet’s directory service: It takes a name, like “www.maradns.org”, and converts that name in to an “IP” number that your computer can use to connect to www.maradns.org.
DNS is one of these things many take for granted that is essential to using today’s internet. Without DNS, the internet breaks. It is critical that a DNS server keeps the internet working in a secure and stable manner.
MaraDNS’ historyMaraDNS was started in 2001 in response to concerns that there were only two freely available DNS servers (BIND and DjbDNS) at the time. MaraDNS 1.0 was released in mid-2002, MaraDNS 1.2 was released in late 2005, MaraDNS 2.0 was released in the fall of 2010, and MaraDNS’s version number was updated to 3 in 2019.
MaraDNS 1.0 used a recursive DNS server that was implemented rather quickly and had difficult-to-maintain code. This code was completely rewritten for the MaraDNS 2.0 release, which now uses a separate recursive DNS server.
MaraDNS was fully maintained and actively developed without needing contributions from 2001 until 2010. Some features have been added to MaraDNS since then, mainly during the COVID-19 pandemic: Domain blocking support, a Lua-based DNS server, continuous integration, using Git to make releases, etc.
There are two maintained branches of MaraDNS: The 3.5 branch, which is directly derived from the MaraDNS Git tree, and the legacy 3.4 branch, based on a 2019 version of MaraDNS which is only updated for security and other important updates.
OverviewMaraDNS 3.5 consists of two primary components: A UDP-only authoritative DNS server for hosting domains, and a UDP and TCP-capable recursive DNS server for finding domains on the internet. MaraDNS’ recursive DNS server is called Deadwood, and it shares no code with MaraDNS’ authoritative DNS server.
In more detail: MaraDNS has one daemon, the authoritative daemon (called “maradns”), that provides information to recursive DNS servers on the internet, and another daemon, the recursive daemon (called “Deadwood”), that gets DNS information from the internet for web browsers and other internet clients.
A simplified way to look at it: MaraDNS puts your web page on the Internet; Deadwood looks for web pages on the Internet.
Since MaraDNS’ authoritative daemon does not support TCP, MaraDNS includes a separate DNS-over-TCP server called “zoneserver” that supports both standard DNS-over-TCP and DNS zone transfers.
Neither MaraDNS nor the UNIX version of Deadwood have support for daemonization; this is handled by a separate program included with MaraDNS called Duende. Deadwood’s Windows port, on the other hand, includes support for running as a Windows service.
MaraDNS also includes a simple DNS querying tool called “askmara” and a number of other miscellaneous tools: Scripts for processing MaraDNS’ documentation, a simple webpage password generator, some Unicode conversion utilities, scripts for building and installing MaraDNS, automated SQA tests, etc.
MaraDNS is a native UNIX program with a partial Windows port. Deadwood, MaraDNS’ recursive resolver, is a fully cross-platform application with a full Windows port.
MaraDNS 3.5 has full (albeit not fully tested) IPv6 support.
Estimated costUsing the COCOMO II - Constructive Cost Model and my take-home pay at the time I started developing MaraDNS (which is less than what I actually cost my then-employer), MaraDNS is worth about two million dollars (US currency). I have freely donated all this effort to the Internet for anyone to download and use.
InternalsMaraDNS 3.5’s authoritative server uses code going all the way back to 2001. The core DNS-over-UDP server has a number of components, including two different zone file parsers, a mararc parser, a secure random number generator, and so on.
MaraDNS is written entirely in C. No objective C nor C++ classes are used in MaraDNS' code.
MaraDNS 3.5’s “Deadwood” recursive server was started in 2007 and has far cleaner code. Its random number generator, for example, uses a smaller, simpler, and more secure cryptographic algorithm; its configuration file parser uses a finite state machine interpreter; its handling of multiple simultaneous pending connections is done using select() and a state machine instead of with threads.
Deadwood’s source code can be browsed online, and there are a number of documents describing its internals available.
Other DNS serversThe landscape of open-source DNS servers has changed greatly since 2001 when MaraDNS was started. There are now a number of different DNS servers still actively developed and maintained: BIND, Power DNS, NSD/Unbound, KnotDNS as well as MaraDNS. DjbDNS is no longer being updated and the unofficial forks generally have limited support; notably it took nearly five months for someone to come up with a patch for CVE-2012-1191. The most recently maintained DjbDNS fork is N-DJBDNS (all known security holes have been fixed), but this version hasn’t been updated since 2017; I myself now have a lightly maintained branch of djbdns.
MaraDNS’ strength is that it’s a remarkably small, lightweight, easy to configure, and mostly cross-platform DNS server. Deadwood is a tiny DNS server with full recursion support, perfect for embedded systems.
MaraDNS’ weakness is that it does not have some features other DNS servers have. For example, while Deadwood has the strongest spoof protection available without cryptography, it does not have support for DNSSEC.
As another example, MaraDNS does not have full zone transfer support; while MaraDNS can both serve zones and receive external zone files from other DNS servers, MaraDNS needs to be restarted to update its database of DNS records.