Giter VIP home page Giter VIP logo

rainbow-dns's Introduction

DNS Server with http API

๐ŸŒˆ-dns is a DNS server with an http API for populating it's records. Inspired by skydns.

Install

npm install -g rainbow-dns

Use

rainbow-dns

CLI Options

--apihost       // API host          (default 127.0.0.1)
--apiport       // API port          (default 8080)
--dnshost       // DNS host          (default 127.0.0.1)
--dnsport       // DNS port          (default 53)
--ttl           // Time To Live      (default 300 -> seconds)
--store         // Records datastore (default mem -> memory)
--domain        // Domain            (default random)
--fwdhost       // Forward host
--fwdport       // Forward port
--static        // Path to static records file
--ipv4-for-ipv6 // Broken linux NODATA response handling crutch

fwdhost

By passing a --fwdhost flag you can forward requests to another dns server if rainbow-dns don't have any matching records.

rainbow-dns --fwdhost 8.8.8.8

static

By passing a --static flag you can inject some static records from a json file.

rainbow-dns --static ./static.json --domain dance.kiwi

// Example static.json
{
    "records" : [
        { "name" : "break",   "A"     : [{"address" : "192.168.1.100"}] }
        { "name" : "popping", "CNAME" : [{"data"    : "break.dance.kiwi"}] }
    ]
}

ipv4-for-ipv6

Due to an issue with some recent linux distributions not properly handling (valid) NODATA responses, you can set the --ipv4-for-ipv6 flag to include A records in response to AAAA requests and thereby working around this issue.

Symptom:

curl app.domain.com
// unable to resolve hostname
curl app.domain.com -4
// 200 OK

API

GET /
    List all records
PUT /{name}
    Add record name.domain
DELETE /{name}
    Delete record name.domain

// Valid json payload
{
    "A"     : [{"address" : "192.168.1.1"},{"address" : "192.168.10.1"}],
    "AAAA"  : [{"address" : "2605:f8b0:4006:802:0:0:0:1010"}]
}

Rainbow-dns supports all record types listed here provided that you include the required properties, with appropriate key and value, for the respective record type. Rainbow-dns will not validate your input and will only eject an error message upon requests if your record data is invalid.

The payload for a CNAME record would look something like this:

{
    "CNAME" : [{"data" : "elsewhere.domain.com"}]
}

Defaults (domain, ttl) can be included in the payload and thereby overwritten by PUTs.

Example cURL

curl -X PUT localhost:8080/database -d '{"A": [{"address" : "192.168.1.10"}], "ttl" : 999}' -H 'Content-Type: application/json'

Example dig

dig @localhost database.polychromatic.mo +short
// 192.168.1.10
dig @localhost polychromatic.mo
// polychromatic.mo.             5   IN  A   192.168.1.10
dig @localhost "*.polychromatic.mo"
// database.polychromatic.mo.    5   IN  A   192.168.1.10

Changelog

4.0.0

  • Fixed issue with case sensitive matching. rainbow-dns's matching is now case insensitive ๐Ÿ‘‰ rfc 4343. Thanks to @valentin2105 for catching this one! ๐ŸŒˆ ๐ŸŽ‰

3.0.1

  • Advertising recursion (setting ra header), fixes resolving on some platforms

3.0.0

  • Flexible record support (support any record supported by native-dns as long as you set the correct data)
  • Support for CNAME records ๐ŸŽ‰
  • Renamed --ipv4-only -> --ipv4-for-ipv6

2.0.0

  • Removed default forward host - if no fwdhost is specified, empty results are returned
  • Added --ipv4-only crazy mode for Docker

1.2.1

  • New and improved query matcher
  • Groups now respond with the same name for all matches (!)

1.2.0

  • Added support for group responses

1.1.3

  • Fixed query match but no ipv4/ipv6 data bug

1.1.2

  • TTL sensitive interval for staticloop (with a minimum for 1s -> same as ttloop)

1.1.1

  • Support relative paths for --static

1.1.0

  • Added support for static records

1.0.0

  • Intial release ๐ŸŽ‰

rainbow-dns's People

Contributors

asbjornenge avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.