Trace: Stapler

Stapler

This is an old revision of the document!


Stapler

Stapler is a Perl application developed to simplify server DNS zone file maintenance.

Every time I added a server to my network, I had to change the zone files for all of the domains in which that server would be used. If it was a web or e-mail server, I might have a dozen zone files to edit. If I changed IP addressing schemes, I had to edit all the zone files. And half the time or more I would forget to change the serial number in one or more zone files. What a pain.

Stapler makes this all very easy by keeping your primary and secondary domains, machines, aliases (subdomains) and configuration in simple ASCII text files. You can add a new web server and have the zone files for a hundred domains re-written in seconds. Add a new subdomain for a customer and Stapler will re-write the zone files and refresh BIND's cache in the blink of an eye.

:!: February 2017: Stapler 4.28 now supports single dynamic IP addresses, such as on a residential Internet service, that can be updated using a Cron job on the dynamic host and a simple web page on the DNS server that has Stapler on it. Running the Cron job every four hours, for example, would check your server's IP address every four hours and reload the DNS server if any IP addresses have changed.

To use Stapler you need to be using BIND for DNS resolution (it does not work with things like TinyDNS). You also need Perl with the Term::ANSIColor module, but virtually every Linux distribution is sure to have that by default. To check if you have it, try:

$ locate ANSIColor.pm

You should see something like this (path may be different):

/usr/lib64/perl5/5.22.2/Term/ANSIColor.pm

Download

Download the script and sample configuration files. The latest version is here:

ftp://gloria.ixo.ca/stapler/stapler-latest.tgz

Installation

Paths are preserved in the tar file. The Perl script should placed in /usr/local/bin/ and the configuration files in /etc/stapler/.

To view the archive you can use:

tar -tzf stapler-latest.tgz

To install the file as root do this:

tar -C / -xPpzf stapler-latest.tgz

Configuration

You will find comments within the configuration files, which include:

  1. 192.168.1 — a sample of a netblock configuration, you can have as many of these as you like.
  2. aliases.stapler — machine aliases (a.k.a., sub-domains).
  3. domain.primary — domains for which this DNS server is authoritative (i.e., the master).
  4. domain.secondary — domains names for which this DNS server is a relay (i.e., a slave).
  5. named.root — a copy of the root name servers that is publicly available.
  6. stapler.conf — the main configuration file.

Tips