Project

dns-zone2

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby library for building and parsing DNS zone files for use with Bind and PowerDNS (with Bind backend) DNS servers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 0.6
~> 5.0
>= 9.0
~> 0.7.1
~> 0.8
 Project Readme

dns-zone

Build Status Gem Version License Yard Docs

A Ruby library for building, parsing and manipulating DNS zone files.

Installation

Add this line to your Gemfile:

gem 'dns-zone'

And then execute:

bundle install

Require the gem in your code:

require 'dns/zone'

Usage

Loading a zone file

zone = DNS::Zone.load(zone_as_string)

Loading a zone file, without an $ORIGIN directive

zone = DNS::Zone.load(zone_as_string, "example.com.")

Creating a new zone programmatically

zone = DNS::Zone.new
zone.origin = 'example.com.'
zone.ttl = '1d'

# quick access to SOA RR
zone.soa.nameserver = 'ns0.lividpenguin.com.'
zone.soa.email = 'hostmaster.lividpenguin.com.'

# add an A RR
rec = DNS::Zone::RR::A.new
rec.address = '127.0.0.1'
zone.records << rec

# output using dns zone file format
zone.dump

Development

Development Commands

# install external gem dependencies first
bundle install

# run all tests and build code coverage
bundle exec rake test

# hints where to improve docs
bundle exec inch

# watch for changes and run development commands (tests, documentation, etc)
bundle exec guard

Acknowledgement

Special thanks to Peter J. Philipp centroid.eu for sponsoring the 0.2.0 release of dns-zone.


TODO

Must have

[x] Ability to load a zone made of multiple RR's
[x] Add support for RR Type: SOA
[x] Add support for RR Type: NS
[x] Add support for RR Type: MX
[x] Add support for RR Type: AAAA
[x] Add support for RR Type: A
[x] Add support for RR Type: CNAME
[x] Add support for RR Type: TXT
[x] Add support for RR Type: SRV
[x] Add support for RR Type: PTR
[x] Add support for RR Type: SPF
[x] Add support for RR Type: HINFO
[x] Support loading zone where some records have an empty label

[x] Add support for RR Type: NAPTR (RFC 3403)
[x] Add support for RR Type: SSHFP (RFC 4255)

[ ] Add test using real bind zone file, with DNSSEC RR's.
[ ] Add support for DNSSEC (RFC 4034) RR Types:
    [x] DNSKEY
        [ ] Algorithm may be integer or mnemonic.
    [x] RRSIG
        [ ] Algorithm may be integer or mnemonic.
    [x] NSEC
        [ ] Handle "Type Bit Maps" better, much better...
    [x] DS
[ ] Add support for DNSSEC (RFC 5155) RR Types:
    [x] NSEC3
    [x] NSEC3PARAM
    [ ] Correctly handle "Presentation Format" as defined in RFC.

[x] Add support for DNSSEC (RFC 4431 & RFC 7344) RR Types:
    [x] CDNSKEY (identical to DNSKEY)
    [x] CDS (identical to DS)
    [x] DLV (identical to DS)

[ ] Look at newly added DNSSEC RR's and rename fields to be more appropriate, where required.

Would be nice

[ ] Basic validation, error checking:
    [ ] Only one SOA per zone.
    [ ] CNAMEs can't use a label of `@`.
    [ ] PTR zones have some extra conditions:
        [ ] labels cant be repeated
        [ ] names should end in a dot, otherwise they are invalid after expansion
        [ ] IPv4 and IPv6 cant be mixed

[ ] Ability to 'include' defaults/records into a zone.
    This may or may not mean supporting the `$INCLUDE` directive.

At some point; low priority

[ ] Configuration options:
    [ ] spaces/tabs used between RR params in zone file output
    [ ] time format used in output (should parse both formats, seconds or bind time format (e.g. 1d))
        [ ] add comments to explain TTL's that are in seconds
[ ] Ability to add comment to RR (n.b. currently we strip comments when parsing)
[ ] Add support for RR Type: LOC (RFC 1876)
[ ] Add support for RR Type: DNAME (RFC 2672)
[ ] Add support for RR Type: KEY
[ ] Add support for RR Type: RP
[ ] Add support for RR Type: RT

Misc. Development Notes