mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
adding docs again
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ dnsconfig.js
|
||||
creds.json
|
||||
integrationTest
|
||||
ExternalDNS
|
||||
docs/_site
|
5
docs/_config.yml
Normal file
5
docs/_config.yml
Normal file
@ -0,0 +1,5 @@
|
||||
collections:
|
||||
providers:
|
||||
output: true
|
||||
functions:
|
||||
|
26
docs/_functions/domain/A.md
Normal file
26
docs/_functions/domain/A.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
name: A
|
||||
parameters:
|
||||
- name
|
||||
- address
|
||||
- modifiers...
|
||||
---
|
||||
|
||||
A adds an A record To a domain. The name should be the relative label for the record. Use `@` for the domain apex.
|
||||
|
||||
The address should be an ip address, either a string, or a numeric value obtained via [IP](#IP).
|
||||
|
||||
Modifers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
A("@", "1.2.3.4"),
|
||||
A("foo", "2.3.4.5"),
|
||||
A("test.foo", IP("1.2.3.4"), TTL(5000)),
|
||||
A("*", "1.2.3.4", {foo: 42})
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
28
docs/_functions/domain/AAAA.md
Normal file
28
docs/_functions/domain/AAAA.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
name: AAAA
|
||||
parameters:
|
||||
- name
|
||||
- address
|
||||
- modifiers...
|
||||
---
|
||||
|
||||
AAAA adds an AAAA record To a domain. The name should be the relative label for the record. Use `@` for the domain apex.
|
||||
|
||||
The address should be an ipv6 address as a string.
|
||||
|
||||
Modifers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
AAAA("@", addrV6),
|
||||
AAAA("foo", addrV6),
|
||||
AAAA("test.foo", addrV6, TTL(5000)),
|
||||
AAAA("*", addrV6, {foo: 42})
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
24
docs/_functions/domain/CNAME.md
Normal file
24
docs/_functions/domain/CNAME.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
name: CNAME
|
||||
parameters:
|
||||
- name
|
||||
- address
|
||||
- modifiers...
|
||||
---
|
||||
|
||||
CNAME adds a CNAME record to the domain. The name should be the relative label for the domain.
|
||||
Using `@` or `*` for CNAME records is not recommended, as different providers support them differently.
|
||||
|
||||
Adress should be a string representing the CNAME target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
CNAME("foo", "google.com."), // foo.example.com -> google.com
|
||||
CNAME("abc", "@"), // abc.example.com -> example.com
|
||||
CNAME("def", "test.subdomain"), // def.example.com -> test.subdomain.example.com
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
20
docs/_functions/domain/DefaultTTL.md
Normal file
20
docs/_functions/domain/DefaultTTL.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: DefaultTTL
|
||||
parameters:
|
||||
- ttl
|
||||
---
|
||||
|
||||
DefaultTTL sets the TTL for all records in a domain that do not explicitly set one with [TTL](#TTL). If neither `DefaultTTl` or `TTL` exist for a record,
|
||||
it will use the DNSControl global default of 300 seconds.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
DefaultTTL(2000),
|
||||
A("@","1.2.3.4"), //has default
|
||||
A("foo", "2.3.4.5", TTL(500)) //overrides default
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
21
docs/_functions/domain/DnsProvider.md
Normal file
21
docs/_functions/domain/DnsProvider.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
name: DnsProvider
|
||||
parameters:
|
||||
- name
|
||||
- nsCount
|
||||
---
|
||||
|
||||
DnsProvider indicates that the specifid provider should be used to manage
|
||||
records for this domain. The name must match the name used with [NewDnsProvider](#NewDnsProvider).
|
||||
|
||||
The nsCount parameter determines how the nameservers will be managed from this provider.
|
||||
|
||||
Leaving the parameter out means "fetch and use all nameservers from this provider as authoritative". ie: `DnsProvider("name")`
|
||||
|
||||
Using `0` for nsCount means "do not fetch nameservers from this domain, or give them to the registrar".
|
||||
|
||||
Using a different number, ie: `DnsProvider("name",2)`, means "fetch all nameservers from this provider,
|
||||
but limit it to this many.
|
||||
|
||||
See [this page]({{site.github.url}}/nameservers) for a detailed explanation of how DNSControl handles nameservers and NS records.
|
||||
|
0
docs/_functions/domain/IMPORT_TRANSFORM.md
Normal file
0
docs/_functions/domain/IMPORT_TRANSFORM.md
Normal file
0
docs/_functions/domain/MX.md
Normal file
0
docs/_functions/domain/MX.md
Normal file
0
docs/_functions/domain/NAMESERVER.md
Normal file
0
docs/_functions/domain/NAMESERVER.md
Normal file
0
docs/_functions/domain/NS.md
Normal file
0
docs/_functions/domain/NS.md
Normal file
0
docs/_functions/domain/PURGE.md
Normal file
0
docs/_functions/domain/PURGE.md
Normal file
0
docs/_functions/domain/TXT.md
Normal file
0
docs/_functions/domain/TXT.md
Normal file
47
docs/_functions/global/D.md
Normal file
47
docs/_functions/global/D.md
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
name: D
|
||||
parameters:
|
||||
- name
|
||||
- registrar
|
||||
- modifiers...
|
||||
---
|
||||
|
||||
`D` adds a new Domain for DNSControl to manage. The first two arguments are required: the domain name (fully qualified `example.com` without a trailing dot), and the
|
||||
name of the registrar (as previously declared with [NewRegistrar](#NewRegistrar)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](#DNSProvider),
|
||||
add records with [A](#A), [CNAME](#CNAME), and so forth, or add metadata.
|
||||
|
||||
Modifier arguments are processed according to type as follows:
|
||||
|
||||
- A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](#domain-modifiers) return such functions.
|
||||
- An object argument will be merged into the domain's metadata collection.
|
||||
- An array arument will have all of it's members evaluated recursively. This allows you to combine multiple common records or modifiers into a variable that can
|
||||
be used like a macro in multiple domains.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
|
||||
var r53 = NewDnsProvider("R53","ROUTE53");
|
||||
|
||||
//simple domain
|
||||
D("example.com", REGISTRAR, DnsProvider(r53),
|
||||
A("@","1.2.3.4"),
|
||||
CNAME("test", "foo.example2.com.")
|
||||
);
|
||||
|
||||
//"macro" for records that can be mixed into any zone
|
||||
var GOOGLE_APPS_DOMAIN_MX = [
|
||||
MX('@', 1, 'aspmx.l.google.com.'),
|
||||
MX('@', 5, 'alt1.aspmx.l.google.com.'),
|
||||
MX('@', 5, 'alt2.aspmx.l.google.com.'),
|
||||
MX('@', 10, 'alt3.aspmx.l.google.com.'),
|
||||
MX('@', 10, 'alt4.aspmx.l.google.com.'),
|
||||
]
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider(r53),
|
||||
A("@","1.2.3.4"),
|
||||
CNAME("test", "foo.example2.com."),
|
||||
GOOGLE_APPS_DOMAIN_MX
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
23
docs/_functions/global/DEFAULTS.md
Normal file
23
docs/_functions/global/DEFAULTS.md
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
name: DEFAULTS
|
||||
parameters:
|
||||
- modifiers...
|
||||
---
|
||||
|
||||
`DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [D](#D) will have these
|
||||
arguments passed as if they were the first modifiers in the argument list.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
var COMMON = NewDnsProvider("foo","BIND");
|
||||
//we want to create backup zone files for all domains, but not actually register them.
|
||||
//also create a default TTL
|
||||
DEFAULTS( DnsProvider(COMMON,0), DefaultTTL(1000));
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will have the defaults set.
|
||||
|
||||
//clear defaults
|
||||
DEFAULTS();
|
||||
D("example2.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will not have the previous defaults.
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
0
docs/_functions/global/IP.md
Normal file
0
docs/_functions/global/IP.md
Normal file
24
docs/_functions/global/NewDnsProvider.md
Normal file
24
docs/_functions/global/NewDnsProvider.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
name: NewDnsProvider
|
||||
parameters:
|
||||
- name
|
||||
- type
|
||||
- meta
|
||||
return: string
|
||||
---
|
||||
|
||||
NewDnsProvider registers a new DNS Service Provider. The name can be any string value you would like to use.
|
||||
The type must match a valid dns provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
|
||||
|
||||
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
|
||||
|
||||
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
|
||||
var r53 = NewDnsProvider("R53","ROUTE53");
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
24
docs/_functions/global/NewRegistrar.md
Normal file
24
docs/_functions/global/NewRegistrar.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
name: NewRegistrar
|
||||
parameters:
|
||||
- name
|
||||
- type
|
||||
- meta
|
||||
return: string
|
||||
---
|
||||
|
||||
NewRegistrar registers a registrar provider. The name can be any string value you would like to use.
|
||||
The type must match a valid registar provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
|
||||
|
||||
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
|
||||
|
||||
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
|
||||
var r53 = NewDnsProvider("R53","ROUTE53");
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
20
docs/_functions/record/TTL.md
Normal file
20
docs/_functions/record/TTL.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: TTL
|
||||
parameters:
|
||||
- ttl
|
||||
---
|
||||
|
||||
TTL sets the TTL for a single record only. This will take precedence
|
||||
over the domain's [DefaultTTL](#DefaultTTL) if supplied.
|
||||
|
||||
{% include startExample.html %}
|
||||
{% highlight js %}
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
DefaultTTL(2000),
|
||||
A("@","1.2.3.4"), //has default
|
||||
A("foo", "2.3.4.5", TTL(500)) //overrides default
|
||||
);
|
||||
|
||||
{%endhighlight%}
|
||||
{% include endExample.html %}
|
1
docs/_includes/alert.html
Normal file
1
docs/_includes/alert.html
Normal file
@ -0,0 +1 @@
|
||||
<div class="alert alert-warning" role="alert"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> {{include.text}}</div>
|
2
docs/_includes/endExample.html
Normal file
2
docs/_includes/endExample.html
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
</div>
|
11
docs/_includes/func.html
Normal file
11
docs/_includes/func.html
Normal file
@ -0,0 +1,11 @@
|
||||
{% assign f = include.f %}
|
||||
|
||||
<div class="panel panel-default" id="{{f.name}}">
|
||||
<div class="panel-heading"><h4><code>
|
||||
{{f.name}}( {% for p in f.parameters %}{% unless forloop.first == true %}, {%endunless%}<i>{{p}}</i>{%endfor%} )
|
||||
{% if f.return %} -> {{f.return}}{%endif%}
|
||||
</code></h4></div>
|
||||
<div class="panel-body">
|
||||
{{f.content}}
|
||||
</div>
|
||||
</div>
|
12
docs/_includes/funcList.md
Normal file
12
docs/_includes/funcList.md
Normal file
@ -0,0 +1,12 @@
|
||||
## {{include.title}}
|
||||
{% assign fs = site.functions %}
|
||||
{% if include.dir == "global" %}
|
||||
{% assign fs = fs | reverse %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% for f in fs %}
|
||||
{% if f.path contains include.dir %}
|
||||
{% include func.html f=f %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
4
docs/_includes/startExample.html
Normal file
4
docs/_includes/startExample.html
Normal file
@ -0,0 +1,4 @@
|
||||
<span style='font-weight: bold' class='example-collapse'> Example{% if include.name %} ({{ include.name }}){%endif%}:
|
||||
<span class='expand-arrow'><i class="fa fa-caret-right" aria-hidden="true"></i></span>
|
||||
<span class='collapse-arrow'><i class="fa fa-caret-down" aria-hidden="true"></i></span></span>
|
||||
<div class='collapse'>
|
62
docs/_layouts/default.html
Normal file
62
docs/_layouts/default.html
Normal file
@ -0,0 +1,62 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r"
|
||||
crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-2.1.4.min.js" integrity="sha384-R4/ztc4ZlRqWjqIuvf6RX5yb/v90qNGx6fS48N0tRxiGkqveZETq72KgDVJCp2TC"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://use.fontawesome.com/03614296b7.js"></script>
|
||||
<link rel="stylesheet" href="{{site.github.url}}/css/site.css">
|
||||
<link rel="stylesheet" href="{{site.github.url}}/css/syntax.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-collapse" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{site.github.url}}/">
|
||||
DNSControl
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="nav-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="{{site.github.url}}/getting-started">Getting Started</a></li>
|
||||
<li><a href="{{site.github.url}}/js">Javascript Docs</a></li>
|
||||
<li><a href="{{site.github.url}}/provider-list">Providers</a></li>
|
||||
<li>
|
||||
<a href="https://github.com/StackExchange/dnscontrol" style="padding:10px 12px"><span class="fa fa-github fa-2x" aria-hidden="true"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class='container'>
|
||||
{{ content}}
|
||||
</div>
|
||||
|
||||
{% comment %} Live reload script. Dev mode only {% endcomment %} {% unless site.github %}
|
||||
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
|
||||
{% endunless %}
|
||||
{% comment %} This script makes the examples collapse appropriately {% endcomment %}
|
||||
|
||||
<script>
|
||||
$('.example-collapse').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().next().collapse('toggle');
|
||||
$(this).toggleClass('expanded')
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
9
docs/_providers/bind.md
Normal file
9
docs/_providers/bind.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
name: Bind
|
||||
layout: default
|
||||
jsId: BIND
|
||||
---
|
||||
# Bind Provider
|
||||
|
||||
This provider simply maintains a directory with a collection of .zone files. We currently copy zone files to our production servers and restart bind via
|
||||
a script external to DNSControl.
|
65
docs/_providers/gcloud.md
Normal file
65
docs/_providers/gcloud.md
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
name: "Google cloud DNS"
|
||||
layout: default
|
||||
jsId: GCLOUD
|
||||
---
|
||||
|
||||
# Google cloud DNS Provider
|
||||
|
||||
## Configuration
|
||||
|
||||
In your providers config json file you must provide the following fields:
|
||||
{% highlight json %}
|
||||
{
|
||||
"gcloud":{
|
||||
"clientId": "abc123",
|
||||
"clientSecret": "abc123",
|
||||
"refreshToken":"abc123",
|
||||
"project": "your-gcloud-project-name",
|
||||
}
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
See [the Activation section](#activation) for some tips on obtaining these credentials.
|
||||
|
||||
## Metadata
|
||||
|
||||
This provider does not recognize any special metadata fields unique to googel cloud dns.
|
||||
|
||||
## Usage
|
||||
|
||||
Use this provider like any other DNS Provider:
|
||||
|
||||
{% highlight js %}
|
||||
var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM");
|
||||
var GCLOUD = NewDnsProvider("gcloud", GCLOUD);
|
||||
|
||||
D("example.tld", REG_NAMECOM, DnsProvider(GCLOUD),
|
||||
A("test","1.2.3.4")
|
||||
);
|
||||
{%endhighlight%}
|
||||
|
||||
## Activation
|
||||
|
||||
Because this provider depends on Oauth for authentication, generating the correct tokens can be a bit daunting. We recommend using the
|
||||
[Google Oauth2 Playground](https://developers.google.com/oauthplayground/) to generate refresh tokens.
|
||||
|
||||
1. In the google cloud platform console, create a project to host your DNS zones.
|
||||
2. Go to API Manager / Credentials and create a new OAuth2 Client ID. Create it for a Web Application.
|
||||
Make sure to add https://developers.google.com/oauthplayground to the "Authorized redirect URIs" section.
|
||||
|
||||

|
||||
|
||||
3. Save your client id and client secret, along with your project name in your providers.json for DNSControl.
|
||||
4. Go to the [Google Oauth2 Playground](https://developers.google.com/oauthplayground/). Click the settings icon on the top right side and select
|
||||
"Use your own OAuth credentials". Enter your client id and client secret as obtained above.
|
||||
|
||||

|
||||
|
||||
5. Select the scope for "Google Cloud DNS API v1 > https://www.googleapis.com/auth/ndev.clouddns.readwrite".
|
||||
6. Make sure you authorize the api as the user you intend to make API requests with.
|
||||
7. Click "Exchange authorization code for tokens" and get a refresh and access token:
|
||||
|
||||

|
||||
|
||||
8. Store the refresh token in your providers.json for DNSControl. It will take care of refreshing the token as needed.
|
56
docs/_providers/name.com.md
Normal file
56
docs/_providers/name.com.md
Normal file
@ -0,0 +1,56 @@
|
||||
---
|
||||
name: "Name.com"
|
||||
layout: default
|
||||
jsId: NAMEDOTCOM
|
||||
---
|
||||
|
||||
# Name.com Provider
|
||||
|
||||
## Configuration
|
||||
|
||||
In your providers config json file you must provide your name.com api username and access token:
|
||||
|
||||
{% highlight json %}
|
||||
{
|
||||
"name.com":{
|
||||
"apikey": "yourApiKeyFromName.com-klasjdkljasdlk235235235235",
|
||||
"apiuser": "yourUsername"
|
||||
}
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
## Metadata
|
||||
|
||||
This provider does not recognize any special metadata fields unique to name.com.
|
||||
|
||||
## Usage
|
||||
|
||||
Example javascript (DNS hosted with name.com):
|
||||
|
||||
{% highlight js %}
|
||||
var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM");
|
||||
var NAMECOM = NewDnsProvider("name.com","NAMEDOTCOM");
|
||||
|
||||
D("example.tld", REG_NAMECOM, DnsProvider(NAMECOM),
|
||||
A("test","1.2.3.4")
|
||||
);
|
||||
{%endhighlight%}
|
||||
|
||||
Example javascript (Registrar only. DNS hosted elsewhere):
|
||||
|
||||
{% highlight js %}
|
||||
var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM");
|
||||
var R53 = NewDnsProvider("r53", ROUTE53);
|
||||
|
||||
D("example.tld", REG_NAMECOM, DnsProvider(R53),
|
||||
A("test","1.2.3.4")
|
||||
);
|
||||
{%endhighlight%}
|
||||
|
||||
{% include alert.html text="Note: name.com does not allow control over the NS records of your zones via the api. It is not recommended to use name.com's dns provider unless it is your only dns host." %}
|
||||
|
||||
## Activation
|
||||
|
||||
In order to activate api functionality on your name.com account, you must apply to the api program.
|
||||
The application form is [located here](https://www.name.com/reseller/apply). It usually takes a few days to get a response.
|
||||
After you are accepted, you should receive your api token via email.
|
40
docs/_providers/route53.md
Normal file
40
docs/_providers/route53.md
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Route 53
|
||||
layout: default
|
||||
jsId: ROUTE53
|
||||
---
|
||||
# Amazon Route 53 Provider
|
||||
|
||||
## Configuration
|
||||
|
||||
In your providers config json file you must provide an aws access key:
|
||||
|
||||
{% highlight json %}
|
||||
{
|
||||
"r53":{
|
||||
"KeyId": "your-aws-key",
|
||||
"SecretKey": "your-aws-secret-key"
|
||||
}
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
## Metadata
|
||||
|
||||
This provider does not recognize any special metadata fields unique to route 53.
|
||||
|
||||
## Usage
|
||||
|
||||
Example javascript:
|
||||
|
||||
{% highlight js %}
|
||||
var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM");
|
||||
var R53 = NewDnsProvider("r53", ROUTE53);
|
||||
|
||||
D("example.tld", REG_NAMECOM, DnsProvider(R53),
|
||||
A("test","1.2.3.4")
|
||||
);
|
||||
{%endhighlight%}
|
||||
|
||||
## Activation
|
||||
|
||||
DNSControl depends on a standard [aws access key](https://aws.amazon.com/developers/access-keys/) with permission to create and update hosted zones.
|
BIN
docs/assets/gcloud-credentials.png
Normal file
BIN
docs/assets/gcloud-credentials.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
BIN
docs/assets/gcloud-settings.png
Normal file
BIN
docs/assets/gcloud-settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
BIN
docs/assets/gcloud-token.png
Normal file
BIN
docs/assets/gcloud-token.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
11
docs/css/site.css
Normal file
11
docs/css/site.css
Normal file
@ -0,0 +1,11 @@
|
||||
.expanded > .expand-arrow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.expanded > .collapse-arrow {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.collapse-arrow {
|
||||
display:none;
|
||||
}
|
60
docs/css/syntax.css
Normal file
60
docs/css/syntax.css
Normal file
@ -0,0 +1,60 @@
|
||||
.highlight { background: #ffffff; }
|
||||
.highlight .c { color: #999988; font-style: italic } /* Comment */
|
||||
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
||||
.highlight .k { font-weight: bold } /* Keyword */
|
||||
.highlight .o { font-weight: bold } /* Operator */
|
||||
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
||||
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
||||
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
||||
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
||||
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
|
||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
||||
.highlight .gr { color: #aa0000 } /* Generic.Error */
|
||||
.highlight .gh { color: #999999 } /* Generic.Heading */
|
||||
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
||||
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
|
||||
.highlight .go { color: #888888 } /* Generic.Output */
|
||||
.highlight .gp { color: #555555 } /* Generic.Prompt */
|
||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
|
||||
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
|
||||
.highlight .kc { font-weight: bold } /* Keyword.Constant */
|
||||
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
|
||||
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
|
||||
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
|
||||
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
||||
.highlight .m { color: #009999 } /* Literal.Number */
|
||||
.highlight .s { color: #d14 } /* Literal.String */
|
||||
.highlight .na { color: #008080 } /* Name.Attribute */
|
||||
.highlight .nb { color: #0086B3 } /* Name.Builtin */
|
||||
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
|
||||
.highlight .no { color: #008080 } /* Name.Constant */
|
||||
.highlight .ni { color: #800080 } /* Name.Entity */
|
||||
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
||||
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
|
||||
.highlight .nn { color: #555555 } /* Name.Namespace */
|
||||
.highlight .nt { color: #000080 } /* Name.Tag */
|
||||
.highlight .nv { color: #008080 } /* Name.Variable */
|
||||
.highlight .ow { font-weight: bold } /* Operator.Word */
|
||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.highlight .mf { color: #009999 } /* Literal.Number.Float */
|
||||
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
|
||||
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
|
||||
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
|
||||
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
|
||||
.highlight .sc { color: #d14 } /* Literal.String.Char */
|
||||
.highlight .sd { color: #d14 } /* Literal.String.Doc */
|
||||
.highlight .s2 { color: #d14 } /* Literal.String.Double */
|
||||
.highlight .se { color: #d14 } /* Literal.String.Escape */
|
||||
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
|
||||
.highlight .si { color: #d14 } /* Literal.String.Interpol */
|
||||
.highlight .sx { color: #d14 } /* Literal.String.Other */
|
||||
.highlight .sr { color: #009926 } /* Literal.String.Regex */
|
||||
.highlight .s1 { color: #d14 } /* Literal.String.Single */
|
||||
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
|
||||
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
||||
.highlight .vc { color: #008080 } /* Name.Variable.Class */
|
||||
.highlight .vg { color: #008080 } /* Name.Variable.Global */
|
||||
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
|
||||
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
|
47
docs/getting-started.md
Normal file
47
docs/getting-started.md
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
# Getting Started
|
||||
|
||||
## 1. Get the binaries
|
||||
|
||||
You can either download the latest [github release](https://github.com/StackExchange/dnscontrol/releases), or build from the go source:
|
||||
|
||||
`go get github.com/StackExchange/dnscontrol`
|
||||
|
||||
## 2. Create files
|
||||
|
||||
The first file you will need is a javascript file to describe your domains.
|
||||
Individual providers will vary slightly. See [the provider docs]({{site.github.url}}/provider-list) for specifics.
|
||||
For this example we will use a domain registered with name.com, using their basic dns hosting.
|
||||
The default name is `dnsconfig.js`:
|
||||
|
||||
{% highlight js %}
|
||||
var registrar = NewRegistrar("name.com",NAMEDOTCOM);
|
||||
var namecom = NewDnsProvider("name.com",NAMEDOTCOM);
|
||||
|
||||
D("example.com", registrar, DnsProvider(namecom),
|
||||
A("@", "1.2.3.4")
|
||||
);
|
||||
{%endhighlight%}
|
||||
|
||||
The second file is a json document to hold your api credentials. By default we use `providers.json`:
|
||||
|
||||
{% highlight json %}
|
||||
{
|
||||
"name.com":{
|
||||
"apikey": "yourApiKeyFromName.com-klasjdkljasdlk235235235235",
|
||||
"apiuser": "yourUsername"
|
||||
}
|
||||
}
|
||||
{%endhighlight%}
|
||||
|
||||
You may modify these files to match your particular providers and domains. See [the javascript docs]({{site.github.url}}/js) for more details.
|
||||
|
||||
## 3. Run `dnscontrol preview`
|
||||
|
||||
This will print out a list of "corrections" that need to be performed. It will not actually make any changes.
|
||||
|
||||
## 4. Run `dnscontrol push`
|
||||
|
||||
This will actually perform the required changes with the various providers.
|
12
docs/index.md
Normal file
12
docs/index.md
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
# DNSControl
|
||||
|
||||
## [Getting Started]({{site.github.url}}/getting-started)
|
||||
|
||||
## [Providers]({{site.github.url}}/provider-list)
|
||||
|
||||
## [Javascript Reference]({{site.github.url}}/js)
|
||||
|
||||
## [Writing Providers]()
|
28
docs/js.md
Normal file
28
docs/js.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Javascript DSL
|
||||
|
||||
DNSControl uses javascript as its primary input language to provide power and flexibility to configure your domains. The ultimate purpose of the javascript is to consturct a
|
||||
[DNSConfig](https://godoc.org/github.com/StackExchange/dnscontrol#DNSConfig) object that will be passed to the go backend and operated on.
|
||||
|
||||
{% include funcList.md title="Top Level Functions" dir="global" %}
|
||||
|
||||
{% include funcList.md title="Domain Modifiers" dir="domain" %}
|
||||
|
||||
{% include funcList.md title="Record Modifiers" dir="record" %}
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var f = function(){
|
||||
$("div.panel").removeClass("panel-success")
|
||||
var jmp = window.location.hash;
|
||||
if(jmp){
|
||||
$("div"+jmp).addClass("panel-success")
|
||||
}
|
||||
}
|
||||
f();
|
||||
$(window).on('hashchange',f);
|
||||
})
|
||||
</script>
|
60
docs/nameservers.md
Normal file
60
docs/nameservers.md
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Nameservers in DNSControl
|
||||
|
||||
DNSControl can handle a variety of provider scenarios for you:
|
||||
|
||||
- A single provider manages everything for your domains (Ex: name.com registers and serves dns)
|
||||
- A single provider serves dns seperately from the registrar (Ex: name.com registers and cloudflare hosts dns records)
|
||||
- Multiple providers "co-host" dns (Ex: Route53 and Google Cloud DNS both serve as authoritative nameservers)
|
||||
- One or more "active" dns hosts and another "backup" dns host. (Ex: route53 hosts dns, but I update a local bind server as a backup)
|
||||
|
||||
All of these scenarios differ in how they manage:
|
||||
|
||||
- The root list of authoritative nameservers stored in the tld zone by your registrar.
|
||||
- The list of NS records for the base domain that is served by each dns host.
|
||||
|
||||
DNSControl attempts to manage these records for you as much as possible, according the the following processes:
|
||||
|
||||
## 1. Specifying Nameservers
|
||||
|
||||
There are several different ways to declare nameservers for a zone:
|
||||
|
||||
1. Explicit [`NAMESERVER`](/js#NAMESERVER) records in a domain:
|
||||
|
||||
`NAMESERVER("ns1.myhost.tld")`
|
||||
2. Request all nameservers to use from a provider (usually via api):
|
||||
|
||||
`DnsProvider(route53)`
|
||||
3. Request a limited number of nameservers from a provider:
|
||||
|
||||
`DnsProvider(route53, 2), DnsProvider(gcloud, 2)`
|
||||
|
||||
This can be useful to limit the total number of NS records when using multiple providers together, for performance reasons.
|
||||
|
||||
## 2. DNSControl processes
|
||||
|
||||
The first step in running a domain is a first pass to collect all nameservers that we should use.
|
||||
DNSControl collects all explicit nameservers, and calls the method on each provider to get nameservers to use.
|
||||
After this process we have a list of "Authoritative Nameservers" for the domain.
|
||||
|
||||
As much as possible, all dns servers should agree on this nameserver list, and serve identical NS records. DNSControl will generate
|
||||
NS records for the authoritative nameserver list and automatically add them to the domain's records.
|
||||
NS records for the base domain should not be specidied manually, as that will result in an error.
|
||||
|
||||
{% include alert.html text="Note: Not all providers allow full control over the NS records of your zone. It is not recommended to use these providers in complicated scenarios such as hosting across multiple providers. See individual provider docs for more info." %}
|
||||
|
||||
DnsControl will also register the authoritative nameserver list with the registrar, so that all nameserver are used in the tld registry.
|
||||
|
||||
## 3. Backup providers
|
||||
|
||||
It is also possible to specify a Dns Provider that is not "authoritative" by using `DnsProvider("name", 0)`. This means the provider will be updated
|
||||
with all records to match the authoritative ones, but it will not be registered in the tld name servers, and will not take traffic.
|
||||
It's nameservers will not be added to the authoritative set. While this may seem an attractive option, there are a few things to note:
|
||||
|
||||
1. Backup nameservers will still be updated with the NS records from the authoritative nameserver list. This means the records
|
||||
will still need to be updated to correctly "activate" the provider.
|
||||
2. Costs generally scale with utilization, so there is often no real savings associated with an active-passive setup vs an active-active one anyway.
|
||||
|
17
docs/provider-list.html
Normal file
17
docs/provider-list.html
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
<h1> Service providers </h1>
|
||||
|
||||
<table class='table table-bordered'>
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Javascript Identifier</th>
|
||||
</thead>
|
||||
{% for p in site.providers %}
|
||||
<tr>
|
||||
<td><a href=".{{p.id}}">{{p.name}}</a></td>
|
||||
<td>{{p.jsId}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
1
docs/runDocker.sh
Executable file
1
docs/runDocker.sh
Executable file
@ -0,0 +1 @@
|
||||
docker run --rm -v "$PWD:/src" -p 4000:4000 -p 35729:35729 markkimsal/jekyll-plus
|
Reference in New Issue
Block a user