github.com/hexonet/dnscontrol@v0.2.8/README.md (about) 1 # DNSControl 2 3 [![Build Status](https://travis-ci.org/StackExchange/dnscontrol.svg?branch=master)](https://travis-ci.org/StackExchange/dnscontrol) 4 [![Gitter chat](https://badges.gitter.im/dnscontrol/Lobby.png)](https://gitter.im/dnscontrol/Lobby) 5 [![Google Group chat](https://img.shields.io/badge/google%20group-chat-green.svg)](https://groups.google.com/forum/#!forum/dnscontrol-discuss) 6 7 DNSControl is a system for maintaining DNS zones. It has two parts: 8 a domain specific language (DSL) for describing DNS zones plus 9 software that processes the DSL and pushes the resulting zones to 10 DNS providers such as Route53, CloudFlare, and Gandi. It can talk 11 to Microsoft ActiveDirectory and it generates the most beautiful 12 BIND zone files ever. It runs anywhere Go runs (Linux, macOS, 13 Windows). The provider model is extensible, so more providers can be added. 14 15 Currently supported DNS providers: 16 - Active Directory 17 - BIND 18 - CloudFlare 19 - Digitalocean 20 - DNSimple 21 - Gandi 22 - Google 23 - HEXONET 24 - Linode 25 - Namecheap 26 - Name.com 27 - NS1 28 - Route 53 29 - SoftLayer 30 - Vultr 31 - OVH 32 33 At Stack Overflow, we use this system to manage hundreds of domains 34 and subdomains across multiple registrars and DNS providers. 35 36 You can think of it as a DNS compiler. The configuration files are 37 written in a DSL that looks a lot like JavaScript. It is compiled 38 to an intermediate representation (IR). Compiler back-ends use the 39 IR to update your DNS zones on services such as Route53, CloudFlare, 40 and Gandi, or systems such as BIND and ActiveDirectory. 41 42 # An Example 43 44 `dnsconfig.js`: 45 46 ```js 47 // define our registrar and providers 48 var namecom = NewRegistrar("name.com", "NAMEDOTCOM"); 49 var r53 = NewDnsProvider("r53", "ROUTE53") 50 51 D("example.com", namecom, DnsProvider(r53), 52 A("@", "1.2.3.4"), 53 CNAME("www","@"), 54 MX("@",5,"mail.myserver.com."), 55 A("test", "5.6.7.8") 56 ) 57 ``` 58 59 Running `dnscontrol preview` will talk to the providers (here name.com as registrar and route 53 as the dns host), and determine what changes need to be made. 60 61 Running `dnscontrol push` will make those changes with the provider and my dns records will be correctly updated. 62 63 See [Getting Started](https://stackexchange.github.io/dnscontrol/getting-started) page on documentation site. 64 65 # Benefits 66 67 * Editing zone files is error-prone. Clicking buttons on a web 68 page is irreproducible. 69 * Switching DNS providers becomes a no-brainer. The DNSControl 70 language is vendor-agnostic. If you use it to maintain your DNS 71 zone records, you can switch between DNS providers easily. In fact, 72 DNSControl will upload your DNS records to multiple providers, which 73 means you can test one while switching to another. We've switched 74 providers 3 times in three years and we've never lost a DNS record. 75 * Adopt CI/CD principles to DNS! At StackOverflow we maintain our 76 DNSControl configurations in Git and use our CI system to roll out 77 changes. Keeping DNS information in a VCS means we have full 78 history. Using CI enables us to include unit-tests and system-tests. 79 Remember when you forgot to include a "." at the end of an MX record? 80 We haven't had that problem since we included a test to make sure 81 Tom doesn't make that mistake... again. 82 * Variables save time! Assign an IP address to a constant and use 83 the variable name throughout the file. Need to change the IP address 84 globally? Just change the variable and "recompile." 85 * Macros! Define your SPF records, MX records, or other repeated 86 data once and re-use them for all domains. 87 * Control CloudFlare from a single location. Enable/disable 88 Cloudflare proxying (the "orange cloud" button) directly from your 89 DNSControl files. 90 * Keep similar domains in sync with transforms and other features. 91 If one domain is supposed to be the same 92 * It is extendable! All the DNS providers are written as plugins. 93 Writing new plugins is very easy. 94 95 # Installation 96 97 ## From source 98 99 DNSControl can be built with Go version 1.10 or higher. To install, simply run 100 101 `go get github.com/StackExchange/dnscontrol` 102 103 dnscontrol should be installed in $GOPATH/bin 104 105 ## Via packages 106 107 Get prebuilt binaries from [github releases](https://github.com/StackExchange/dnscontrol/releases/latest) 108 109 Alternatively, on Mac you can install it using homebrew: 110 111 `brew install dnscontrol` 112 113 ## Via [docker](https://hub.docker.com/r/stackexchange/dnscontrol/) 114 115 ``` 116 docker run --rm -it -v $(pwd)/dnsconfig.js:/dns/dnsconfig.js -v $(pwd)/creds.json:/dns/creds.json stackexchange/dnscontrol dnscontrol preview 117 ```