Coder Social home page Coder Social logo

grtodd / bind-to-tinydns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from derat/bind-to-tinydns

0.0 2.0 0.0 132 KB

Convert zone files from the BIND DNS server into configs for djbdns's tinydns

Home Page: http://www.erat.org/

License: BSD 3-Clause "New" or "Revised" License

bind-to-tinydns's Introduction

bind-to-tinydns                               Daniel Erat <[email protected]>
================================================================================


What it does / Why it does it
================================================================================
This program attempts to convert a BIND 9 zone file into the tinydns-data
format natively used by the tinydns component of Dan Bernstein's djbdns
package (http://cr.yp.to/djbdns.html).  This can be useful if you need to
periodically convert zones that are stored in BIND format to tinydns format
and you don't have the willingness or the oodles of memory needed to run a
copy of BIND from which you can slave the zones with axfr-get (think >100
MB DNSbl zones, for instance).  For one-time conversions, you should
instead use the AXFR procedure described by Dan
(http://cr.yp.to/djbdns/run-server-bind.html).


Getting / Compiling
================================================================================
The newest version of this program is available from my homepage
(http://erat.org/).  After downloading the source, extract it and run
"make".  Copy bind-to-tinydns wherever you want after this (I would
recommend /usr/local/bin).  Edit the Makefile and source or email me if it
doesn't work.


Usage
================================================================================
bind-to-tinydns is invoked in the following manner:

  bind-to-tinydns <origin> <output file> <temp file>

The BIND zone is read from STDIN.  To convert a BIND zone file named
"input" containing the zone "example.com" to a tinydns-data file named
"output", you would run:

  bind-to-tinydns example.com output output.tmp <input

If the conversion is successful, the program exits with a return value of
0.  Otherwise, it exits with a return value of 1 (after deleting the
temporary file).  It will abort if the temporary file already exists.


Portability
================================================================================
I've only tested this program on Linux.  I hope that it will work on most
UNIX systems.  Please let me know if it doesn't.


Details
================================================================================
The zone file format described in RFC 1035, and by extension, the one used
by BIND, is not parser-friendly.  Without making this program a bigger mess
than it already is, I've tried to make it as close to BIND 9 as possible in
what it accepts and how it interprets data.  I am aware of the following
differences:

- Missing SOA records in zone files do not cause failure.
- Missing NS records in zone files do not cause failure.
- RRs that occur before $TTL directives and before any SOA records do
  not cause failure or warnings (a default TTL of 86400, rather than
  that of the MINIMUM value of the SOA's rdata, is used).
- The parser does not reject or modify RRs with the same owner that
  have different TTLs.
- IN is the only supported record class.  Records in other classes are
  ignored.
- The only supported record types are SOA, NS, MX, A, CNAME, PTR, TXT,
  SRV, and AAAA.  AAAA support is not well-tested.  Records of other types
  are ignored.
- The $INCLUDE directive is not supported, and causes failure.

If you find additional differences (or worse yet, input that makes the
program crash or go into an infinite loop), or if any of these differences
bug you, please let me know so I can fix the problem.


Version History / Changelog
================================================================================
0.3   20030521  Initial release.
0.4   20030601  Added a string structure and modified functions to use it,
                yielding simpler, safer code and a 33% performance increase
                when processing the TXT-record heavy relays.osirusoft.com
                zone.  Spun off tokenizing and parsing/emitting sections of
                main() into new functions.  Tried to mitigate
                aforementioned safety by adding a bunch of nasty code to
                handle $GENERATE directives (including ${offset,width,base}
                parameters).  The program now accepts lines with
                unterminated double- or backslash-quoted strings, but
                prints a warning.  Fixed a silly bug that would allow
                specific out-of-zone data through.
0.4.1 20030608  Fixed a stupid typo that prevented too-large TTLs in RRs
                from being detected.  Changed str_to_uint() to behave
                closer to the way that my other string-handling functions
                behave.  Added size checks for time values in SOA RDATA.
0.4.2 20040326  Mariano Absatz <[email protected]> wrote that he came
                across some zone files generated by Microsoft's DNS software
                that had invalid (too large) TTL values.  Made his
                recommended changes, so the program spits out a warning and
                uses the default TTL instead of exiting with a fatal error.
                I also made the program a bit more lenient in other places
                (RRs of unknown type are skipped with a warning message
                instead of causing failure, for example).  Thanks Mariano!
0.4.3 20050817  Ick, I can't believe that I wrote this ugly code. :(
                Fixed a bug that Rein <[email protected]> ran into, where an
                origin of "." resulted in all records being declared
                out-of-zone.

[For all subsequent changes, check the commit history at
https://github.com/derat/bind-to-tinydns.]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.