From df31642205de8e16e6be32f52d101d216ee3a9b9 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 18 Mar 2023 15:48:48 +0100 Subject: [PATCH] Refresh --- commands/types/dnscontrol.d.ts | 2038 ++++++++++++-------------- documentation/SUMMARY.md | 319 ++-- documentation/providers/providers.md | 4 +- 3 files changed, 1079 insertions(+), 1282 deletions(-) diff --git a/commands/types/dnscontrol.d.ts b/commands/types/dnscontrol.d.ts index a66d285f95..0369765eaa 100644 --- a/commands/types/dnscontrol.d.ts +++ b/commands/types/dnscontrol.d.ts @@ -182,7 +182,7 @@ declare const DISABLE_REPEATED_DOMAIN_CHECK: RecordModifier; /** * 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](../global/IP.md). + * The address should be an ip address, either a string, or a numeric value obtained via [IP](../top_level_functions/IP.md). * * Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata. * @@ -221,14 +221,6 @@ declare function A(name: string, address: string | number, ...modifiers: RecordM */ declare function AAAA(name: string, address: string, ...modifiers: RecordModifier[]): DomainModifier; -/** - * AKAMAICDN is a proprietary record type that is used to configure [Zone Apex Mapping](https://blogs.akamai.com/2019/08/fast-dns-zone-apex-mapping-dnssec.html). - * The AKAMAICDN target must be preconfigured in the Akamai network. - * - * @see https://dnscontrol.org/js#AKAMAICDN - */ -declare function AKAMAICDN(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; - /** * ALIAS is a virtual record type that points a record at another record. It is analogous to a CNAME, but is usually resolved at request-time and served as an A record. Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`) * @@ -293,53 +285,6 @@ declare const AUTODNSSEC_OFF: DomainModifier; */ declare const AUTODNSSEC_ON: DomainModifier; -/** - * AZURE_ALIAS is a Azure specific virtual record type that points a record at either another record or an Azure entity. - * It is analogous to a CNAME, but is usually resolved at request-time and served as an A record. - * Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`) - * - * Unlike the regular ALIAS directive, AZURE_ALIAS is only supported on AZURE. - * Attempting to use AZURE_ALIAS on another provider than Azure will result in an error. - * - * The name should be the relative label for the domain. - * - * The type can be any of the following: - * * A - * * AAAA - * * CNAME - * - * Target should be the Azure Id representing the target. It starts `/subscription/`. The resource id can be found in https://resources.azure.com/. - * - * The Target can : - * - * * Point to a public IP resource from a DNS `A/AAAA` record set. - * You can create an A/AAAA record set and make it an alias record set to point to a public IP resource (standard or basic). - * The DNS record set changes automatically if the public IP address changes or is deleted. - * Dangling DNS records that point to incorrect IP addresses are avoided. - * There is a current limit of 20 alias records sets per resource. - * * Point to a Traffic Manager profile from a DNS `A/AAAA/CNAME` record set. - * You can create an A/AAAA or CNAME record set and use alias records to point it to a Traffic Manager profile. - * It's especially useful when you need to route traffic at a zone apex, as traditional CNAME records aren't supported for a zone apex. - * For example, say your Traffic Manager profile is myprofile.trafficmanager.net and your business DNS zone is contoso.com. - * You can create an alias record set of type A/AAAA for contoso.com (the zone apex) and point to myprofile.trafficmanager.net. - * * Point to an Azure Content Delivery Network (CDN) endpoint. - * This is useful when you create static websites using Azure storage and Azure CDN. - * * Point to another DNS record set within the same zone. - * Alias records can reference other record sets of the same type. - * For example, a DNS CNAME record set can be an alias to another CNAME record set. - * This arrangement is useful if you want some record sets to be aliases and some non-aliases. - * - * ```javascript - * D("example.com", REGISTRAR, DnsProvider("AZURE_DNS"), - * AZURE_ALIAS("foo", "A", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), // record for traffic manager - * AZURE_ALIAS("foo", "CNAME", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/dnszones/example.com/A/quux."), // record in the same zone - * ); - * ``` - * - * @see https://dnscontrol.org/js#AZURE_ALIAS - */ -declare function AZURE_ALIAS(name: string, type: "A" | "AAAA" | "CNAME", target: string, ...modifiers: RecordModifier[]): DomainModifier; - /** * `CAA()` adds a CAA record to a domain. The name should be the relative label for the record. Use `@` for the domain apex. * @@ -365,100 +310,12 @@ declare function AZURE_ALIAS(name: string, type: "A" | "AAAA" | "CNAME", target: * ); * ``` * - * DNSControl contains a [`CAA_BUILDER`](../record/CAA_BUILDER.md) which can be used to simply create `CAA()` records for your domains. Instead of creating each CAA record individually, you can simply configure your report mail address, the authorized certificate authorities and the builder cares about the rest. + * DNSControl contains a [`CAA_BUILDER`](../record_modifier_functions/CAA_BUILDER.md) which can be used to simply create `CAA()` records for your domains. Instead of creating each CAA record individually, you can simply configure your report mail address, the authorized certificate authorities and the builder cares about the rest. * * @see https://dnscontrol.org/js#CAA */ declare function CAA(name: string, tag: "issue" | "issuewild" | "iodef", value: string, ...modifiers: RecordModifier[]): DomainModifier; -/** - * `CF_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page Rules) to - * generate a HTTP 301 permanent redirect. - * - * If _any_ `CF_REDIRECT` or [`CF_TEMP_REDIRECT`](CF_TEMP_REDIRECT.md) functions are used then - * `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain. - * Page Rule types other than "Forwarding URL” will be left alone. - * - * WARNING: Cloudflare does not currently fully document the Page Rules API and - * this interface is not extensively tested. Take precautions such as making - * backups and manually verifying `dnscontrol preview` output before running - * `dnscontrol push`. This is especially true when mixing Page Rules that are - * managed by DNSControl and those that aren't. - * - * HTTP 301 redirects are cached by browsers forever, usually ignoring any TTLs or - * other cache invalidation techniques. It should be used with great care. We - * suggest using a `CF_TEMP_REDIRECT` initially, then changing to a `CF_REDIRECT` - * only after sufficient time has elapsed to prove this is what you really want. - * - * This example redirects the bare (aka apex, or naked) domain to www: - * - * ```javascript - * D("foo.com", .... , - * CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"), - * ); - * ``` - * - * @see https://dnscontrol.org/js#CF_REDIRECT - */ -declare function CF_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier; - -/** - * `CF_TEMP_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page - * Rules) to generate a HTTP 302 temporary redirect. - * - * If _any_ [`CF_REDIRECT`](CF_REDIRECT.md) or `CF_TEMP_REDIRECT` functions are used then - * `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain. - * Page Rule types other than "Forwarding URL” will be left alone. - * - * WARNING: Cloudflare does not currently fully document the Page Rules API and - * this interface is not extensively tested. Take precautions such as making - * backups and manually verifying `dnscontrol preview` output before running - * `dnscontrol push`. This is especially true when mixing Page Rules that are - * managed by DNSControl and those that aren't. - * - * ```javascript - * D("foo.com", .... , - * CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"), - * ); - * ``` - * - * @see https://dnscontrol.org/js#CF_TEMP_REDIRECT - */ -declare function CF_TEMP_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier; - -/** - * `CF_WORKER_ROUTE` uses the [Cloudflare Workers](https://developers.cloudflare.com/workers/) - * API to manage [worker routes](https://developers.cloudflare.com/workers/platform/routes) - * for a given domain. - * - * If _any_ `CF_WORKER_ROUTE` function is used then `dnscontrol` will manage _all_ - * Worker Routes for the domain. To be clear: this means it will delete existing routes that - * were created outside of DNSControl. - * - * WARNING: This interface is not extensively tested. Take precautions such as making - * backups and manually verifying `dnscontrol preview` output before running - * `dnscontrol push`. - * - * This example assigns the patterns `api.foo.com/*` and `foo.com/api/*` to a `my-worker` script: - * - * ```javascript - * D("foo.com", .... , - * CF_WORKER_ROUTE("api.foo.com/*", "my-worker"), - * CF_WORKER_ROUTE("foo.com/api/*", "my-worker"), - * ); - * ``` - * - * @see https://dnscontrol.org/js#CF_WORKER_ROUTE - */ -declare function CF_WORKER_ROUTE(pattern: string, script: string): DomainModifier; - -/** - * Documentation needed. - * - * @see https://dnscontrol.org/js#CLOUDNS_WR - */ -declare function CLOUDNS_WR(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; - /** * 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. @@ -499,10 +356,10 @@ declare function CNAME(name: string, target: string, ...modifiers: RecordModifie declare function DS(name: string, keytag: number, algorithm: number, digesttype: number, digest: string, ...modifiers: RecordModifier[]): DomainModifier; /** - * DefaultTTL sets the TTL for all subsequent records following it in a domain that do not explicitly set one with [`TTL`](../record/TTL.md). If neither `DefaultTTL` or `TTL` exist for a record, - * the record will inherit the DNSControl global internal default of 300 seconds. See also [`DEFAULTS`](../global/DEFAULTS.md) to override the internal defaults. + * DefaultTTL sets the TTL for all subsequent records following it in a domain that do not explicitly set one with [`TTL`](/documentation/02_language_reference/record_modifier_functions/TTL.md). If neither `DefaultTTL` or `TTL` exist for a record, + * the record will inherit the DNSControl global internal default of 300 seconds. See also [`DEFAULTS`](/documentation/02_language_reference/top_level_functions/DEFAULTS.md) to override the internal defaults. * - * NS records are currently a special case, and do not inherit from `DefaultTTL`. See [`NAMESERVER_TTL`](../domain/NAMESERVER_TTL.md) to set a default TTL for all NS records. + * NS records are currently a special case, and do not inherit from `DefaultTTL`. See [`NAMESERVER_TTL`](/documentation/02_language_reference/domain_modifier_functions/NAMESERVER_TTL.md) to set a default TTL for all NS records. * * ```javascript * D('example.com', REGISTRAR, DnsProvider('R53'), @@ -512,7 +369,7 @@ declare function DS(name: string, keytag: number, algorithm: number, digesttype: * ); * ``` * - * The DefaultTTL duration is the same format as [`TTL`](../record/TTL.md), an integer number of seconds + * The DefaultTTL duration is the same format as [`TTL`](/documentation/02_language_reference/record_modifier_functions/TTL.md), an integer number of seconds * or a string with a unit such as `'4d'`. * * @see https://dnscontrol.org/js#DefaultTTL @@ -521,7 +378,7 @@ declare function DefaultTTL(ttl: Duration): DomainModifier; /** * DnsProvider indicates that the specified provider should be used to manage - * records for this domain. The name must match the name used with [NewDnsProvider](../global/NewDnsProvider.md). + * records for this domain. The name must match the name used with [NewDnsProvider](../top_level_functions/NewDnsProvider.md). * * The nsCount parameter determines how the nameservers will be managed from this provider. * @@ -725,10 +582,10 @@ declare function INCLUDE(domain: string): DomainModifier; * One must supply the `LOC()` js helper all parameters. If that seems like too * much work, see also helper functions: * - * * [`LOC_BUILDER_DD({})`](../record/LOC_BUILDER_DD.md) - build a `LOC` by supplying only **d**ecimal **d**egrees. - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E - * * [`LOC_BUILDER_STR({})`](../record/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * * [`LOC_BUILDER_DD({})`](../record_modifier_functions/LOC_BUILDER_DD.md) - build a `LOC` by supplying only **d**ecimal **d**egrees. + * * [`LOC_BUILDER_DMS_STR({})`](../record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](../record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](../record_modifier_functions/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works * * ## Format ## * @@ -861,7 +718,7 @@ declare function NAMESERVER(name: string, ...modifiers: RecordModifier[]): Domai /** * NAMESERVER_TTL sets the TTL on the domain apex NS RRs defined by [`NAMESERVER`](NAMESERVER.md). * - * The value can be an integer or a string. See [`TTL`](../record/TTL.md) for examples. + * The value can be an integer or a string. See [`TTL`](/documentation/02_language_reference/record_modifier_functions/TTL.md) for examples. * * ```javascript * D('example.com', REGISTRAR, DnsProvider('R53'), @@ -883,7 +740,7 @@ declare function NAMESERVER(name: string, ...modifiers: RecordModifier[]): Domai * ); * ``` * - * To apply a default TTL to all other record types, see [`DefaultTTL`](../domain/DefaultTTL.md) + * To apply a default TTL to all other record types, see [`DefaultTTL`](/documentation/02_language_reference/domain_modifier_functions/DefaultTTL.md) * * @see https://dnscontrol.org/js#NAMESERVER_TTL */ @@ -1143,13 +1000,6 @@ declare const NO_PURGE: DomainModifier; */ declare function NS(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; -/** - * Documentation needed. - * - * @see https://dnscontrol.org/js#NS1_URLFWD - */ -declare function NS1_URLFWD(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; - /** * PTR adds a PTR record to the domain. * @@ -1194,7 +1044,7 @@ declare function NS1_URLFWD(name: string, target: string, ...modifiers: RecordMo * * `PTR('4.3',` // Assuming the domain is `2.1.in-addr.arpa` * * All magic is RFC2317-aware. We use the first format listed in the - * RFC for both [`REV()`](../global/REV.md) and `PTR()`. The format is + * RFC for both [`REV()`](../top_level_functions/REV.md) and `PTR()`. The format is * `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address * of the zone, `MASK` is the netmask of the zone (25-31 inclusive), * and A, B, C are the first 3 octets of the IP address. For example @@ -1274,47 +1124,6 @@ declare function PTR(name: string, target: string, ...modifiers: RecordModifier[ */ declare const PURGE: DomainModifier; -/** - * `R53_ALIAS` is a Route53 specific virtual record type that points a record at either another record or an AWS entity (like a Cloudfront distribution, an ELB, etc...). It is analogous to a `CNAME`, but is usually resolved at request-time and served as an `A` record. Unlike `CNAME` records, `ALIAS` records can be used at the zone apex (`@`) - * - * Unlike the regular [`ALIAS`](ALIAS.md) directive, `R53_ALIAS` is only supported on Route53. Attempting to use `R53_ALIAS` on another provider than Route53 will result in an error. - * - * The name should be the relative label for the domain. - * - * Target should be a string representing the 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 `.`. - * - * The Target can be any of: - * - * * _CloudFront distribution_: in this case specify the domain name that CloudFront assigned when you created your distribution (note that your CloudFront distribution must include an alternate domain name that matches the record you're adding) - * * _Elastic Beanstalk environment_: specify the `CNAME` attribute for the environment. The environment must have a regionalized domain name. To get the `CNAME`, you can use either the [AWS Console](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html), [AWS Elastic Beanstalk API](http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html), or the [AWS CLI](http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/describe-environments.html). - * * _ELB load balancer_: specify the DNS name that is associated with the load balancer. To get the DNS name you can use either the AWS Console (on the EC2 page, choose Load Balancers, select the right one, choose the description tab), [ELB API](http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html), the [AWS ELB CLI](http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html), or the [AWS ELBv2 CLI](http://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-load-balancers.html). - * * _S3 bucket_ (configured as website): specify the domain name of the Amazon S3 website endpoint in which you configured the bucket (for instance s3-website-us-east-2.amazonaws.com). For the available values refer to the [Amazon S3 Website Endpoints](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region). - * * _Another Route53 record_: specify the value of the name of another record in the same hosted zone. - * - * For all the target type, excluding 'another record', you have to specify the `Zone ID` of the target. This is done by using the `R53_ZONE` record modifier. - * - * The zone id can be found depending on the target type: - * - * * _CloudFront distribution_: specify `Z2FDTNDATAQYW2` - * * _Elastic Beanstalk environment_: specify the hosted zone ID for the region in which the environment has been created. Refer to the [List of regions and hosted Zone IDs](http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region). - * * _ELB load balancer_: specify the value of the hosted zone ID for the load balancer. You can find it in [the List of regions and hosted Zone IDs](http://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) - * * _S3 bucket_ (configured as website): specify the hosted zone ID for the region that you created the bucket in. You can find it in [the List of regions and hosted Zone IDs](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) - * * _Another Route 53 record_: you can either specify the correct zone id or do not specify anything and DNSControl will figure out the right zone id. (Note: Route53 alias can't reference a record in a different zone). - * - * ```javascript - * D('example.com', REGISTRAR, DnsProvider('ROUTE53'), - * R53_ALIAS('foo', 'A', 'bar'), // record in same zone - * R53_ALIAS('foo', 'A', 'bar', R53_ZONE('Z35SXDOTRQ7X7K')), // record in same zone, zone specified - * R53_ALIAS('foo', 'A', 'blahblah.elasticloadbalancing.us-west-1.amazonaws.com.', R53_ZONE('Z368ELLRRE2KJ0')), // a classic ELB in us-west-1 - * R53_ALIAS('foo', 'A', 'blahblah.elasticbeanstalk.us-west-2.amazonaws.com.', R53_ZONE('Z38NKT9BP95V3O')), // an Elastic Beanstalk environment in us-west-2 - * R53_ALIAS('foo', 'A', 'blahblah-bucket.s3-website-us-west-1.amazonaws.com.', R53_ZONE('Z2F56UZL2M1ACD')), // a website S3 Bucket in us-west-1 - * ); - * ``` - * - * @see https://dnscontrol.org/js#R53_ALIAS - */ -declare function R53_ALIAS(name: string, target: string, zone_idModifier: DomainModifier & RecordModifier): DomainModifier; - /** * `SOA` adds an `SOA` record to a domain. The name should be `@`. ns and mbox are strings. The other fields are unsigned 32-bit ints. * @@ -1479,7 +1288,7 @@ declare function TLSA(name: string, usage: number, selector: number, type: numbe * * #### How can you tell if a provider will support a particular `TXT()` record? * - * Include the `TXT()` record in a [`D()`](../global/D.md) as usual, along + * Include the `TXT()` record in a [`D()`](../top_level_functions/D.md) as usual, along * with the `DnsProvider()` for that provider. Run `dnscontrol check` to * see if any errors are produced. The check command does not talk to * the provider's API, thus permitting you to do this without having an @@ -1523,1200 +1332,1189 @@ declare function URL(name: string, target: string, ...modifiers: RecordModifier[ declare function URL301(name: string, ...modifiers: RecordModifier[]): DomainModifier; /** - * `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.md)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](NewDnsProvider.md), - * add records with [A](../domain/A.md), [CNAME](../domain/CNAME.md), and so forth, or add metadata. + * DNSControl contains a `CAA_BUILDER` which can be used to simply create + * `CAA` records for your domains. Instead of creating each `CAA` record + * individually, you can simply configure your report mail address, the + * authorized certificate authorities and the builder cares about the rest. * - * Modifier arguments are processed according to type as follows: + * ## Example * - * - A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](https://docs.dnscontrol.org/language-reference/domain-modifiers) return such functions. - * - An object argument will be merged into the domain's metadata collection. - * - An array argument 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. + * For example you can use: * * ```javascript - * var REGISTRAR = NewRegistrar("name.com"); - * var r53 = NewDnsProvider("R53"); - * - * // 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 - * ); + * CAA_BUILDER({ + * label: "@", + * iodef: "mailto:test@domain.tld", + * iodef_critical: true, + * issue: [ + * "letsencrypt.org", + * "comodoca.com", + * ], + * issuewild: "none", + * }) * ``` * - * # Split Horizon DNS + * The parameters are: * - * DNSControl supports Split Horizon DNS. Simply - * define the domain two or more times, each with - * their own unique parameters. + * * `label:` The label of the CAA record. (Optional. Default: `"@"`) + * * `iodef:` Report all violation to configured mail address. + * * `iodef_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`) + * * `issue:` An array of CAs which are allowed to issue certificates. (Use `"none"` to refuse all CAs) + * * `issuewild:` An array of CAs which are allowed to issue wildcard certificates. (Can be simply `"none"` to refuse issuing wildcard certificates for all CAs) * - * To differentiate the different domains, specify the domains as - * `domain.tld!tag`, such as `example.com!inside` and - * `example.com!outside`. + * `CAA_BUILDER()` returns multiple records (when configured as example above): * * ```javascript - * var REG = NewRegistrar("Third-Party"); - * var DNS_INSIDE = NewDnsProvider("Cloudflare"); - * var DNS_OUTSIDE = NewDnsProvider("bind"); - * - * D("example.com!inside", REG, DnsProvider(DNS_INSIDE), - * A("www", "10.10.10.10") - * ); - * - * D("example.com!outside", REG, DnsProvider(DNS_OUTSIDE), - * A("www", "20.20.20.20") - * ); - * - * D_EXTEND("example.com!inside", - * A("internal", "10.99.99.99") - * ); + * CAA("@", "iodef", "mailto:test@domain.tld", CAA_CRITICAL) + * CAA("@", "issue", "letsencrypt.org") + * CAA("@", "issue", "comodoca.com") + * CAA("@", "issuewild", ";") * ``` * - * A domain name without a `!` is assigned a tag that is the empty - * string. For example, `example.com` and `example.com!` are equivalent. - * However, we strongly recommend against using the empty tag, as it - * risks creating confusion. In other words, if you have `domain.tld` - * and `domain.tld!external` you now require humans to remember that - * `domain.tld` is the external one. I mean... the internal one. You - * may have noticed this mistake, but will your coworkers? Will you in - * six months? You get the idea. - * - * DNSControl command line flag `--domains` matches the full name (with the "!"). If you - * define domains `example.com!george` and `example.com!john` then: - * - * * `--domains=example.com` will not match either domain. - * * `--domains='example.com!george'` will match only match the first. - * * `--domains='example.com!george',example.com!john` will match both. - * - * NOTE: The quotes are required if your shell treats `!` as a special - * character, which is probably does. If you see an error that mentions - * `event not found` you probably forgot the quotes. - * - * @see https://dnscontrol.org/js#D + * @see https://dnscontrol.org/js#CAA_BUILDER */ -declare function D(name: string, registrar: string, ...modifiers: DomainModifier[]): void; +declare function CAA_BUILDER(opts: { label?: string; iodef: string; iodef_critical?: boolean; issue: string[]; issuewild: string }): RecordModifier; /** - * `DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [`D`](D.md) will have these - * arguments passed as if they were the first modifiers in the argument list. + * DNSControl contains a `DMARC_BUILDER` which can be used to simply create + * DMARC policies for your domains. * * ## Example * - * We want to create backup zone files for all domains, but not actually register them. Also create a [`DefaultTTL`](../domain/DefaultTTL.md). - * The domain `example.com` will have the defaults set. + * ### Simple example * * ```javascript - * var COMMON = NewDnsProvider("foo"); - * DEFAULTS( - * DnsProvider(COMMON, 0), - * DefaultTTL('1d') - * ); - * - * D("example.com", - * REGISTRAR, - * DnsProvider("R53"), - * A("@","1.2.3.4") - * ); + * DMARC_BUILDER({ + * policy: 'reject', + * ruf: [ + * 'mailto:mailauth-reports@example.com', + * ], + * }) * ``` * - * If you want to clear the defaults, you can do the following. - * The domain `example2.com` will **not** have the defaults set. - * - * ```javascript - * DEFAULTS(); + * This yield the following record: * - * D("example2.com", - * REGISTRAR, - * DnsProvider("R53"), - * A("@","1.2.3.4") - * ); + * ```text + * @ IN TXT "v=DMARC1; p=reject; ruf=mailto:mailauth-reports@example.com" * ``` * - * @see https://dnscontrol.org/js#DEFAULTS - */ -declare function DEFAULTS(...modifiers: DomainModifier[]): void; - -/** - * `DOMAIN_ELSEWHERE()` is a helper macro that lets you easily indicate that - * a domain's zones are managed elsewhere. That is, it permits you easily delegate - * a domain to a hard-coded list of DNS servers. - * - * `DOMAIN_ELSEWHERE` is useful when you control a domain's registrar but not the - * DNS servers. For example, suppose you own a domain but the DNS servers are run - * by someone else, perhaps a SaaS product you've subscribed to or a DNS server - * that is run by your brother-in-law who doesn't trust you with the API keys that - * would let you maintain the domain using DNSControl. You need an easy way to - * point (delegate) the domain at a specific list of DNS servers. - * - * For example these two statements are equivalent: + * ### Advanced example * * ```javascript - * DOMAIN_ELSEWHERE("example.com", REG_NAMEDOTCOM, ["ns1.foo.com", "ns2.foo.com"]); + * DMARC_BUILDER({ + * policy: 'reject', + * subdomainPolicy: 'quarantine', + * percent: 50, + * alignmentSPF: 'r', + * alignmentDKIM: 'strict', + * rua: [ + * 'mailto:mailauth-reports@example.com', + * 'https://dmarc.example.com/submit', + * ], + * ruf: [ + * 'mailto:mailauth-reports@example.com', + * ], + * failureOptions: '1', + * reportInterval: '1h', + * }); * ``` * * ```javascript - * D("example.com", REG_NAMEDOTCOM, - * NO_PURGE, - * NAMESERVER("ns1.foo.com"), - * NAMESERVER("ns2.foo.com") - * ); + * DMARC_BUILDER({ + * label: 'insecure', + * policy: 'none', + * ruf: [ + * 'mailto:mailauth-reports@example.com', + * ], + * failureOptions: { + * SPF: false, + * DKIM: true, + * }, + * }); * ``` * - * NOTE: The [`NO_PURGE`](../domain/NO_PURGE.md) is used out of abundance of caution but since no - * `DnsProvider()` statements exist, no updates would be performed. + * This yields the following records: * - * @see https://dnscontrol.org/js#DOMAIN_ELSEWHERE + * ```text + * @ IN TXT "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=50; rua=mailto:mailauth-reports@example.com,https://dmarc.example.com/submit; ruf=mailto:mailauth-reports@example.com; fo=1; ri=3600" + * insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com; fo=d" + * ``` + * + * ### Parameters + * + * * `label:` The DNS label for the DMARC record (`_dmarc` prefix is added, default: `'@'`) + * * `version:` The DMARC version to be used (default: `DMARC1`) + * * `policy:` The DMARC policy (`p=`), must be one of `'none'`, `'quarantine'`, `'reject'` + * * `subdomainPolicy:` The DMARC policy for subdomains (`sp=`), must be one of `'none'`, `'quarantine'`, `'reject'` (optional) + * * `alignmentSPF:` `'strict'`/`'s'` or `'relaxed'`/`'r'` alignment for SPF (`aspf=`, default: `'r'`) + * * `alignmentDKIM:` `'strict'`/`'s'` or `'relaxed'`/`'r'` alignment for DKIM (`adkim=`, default: `'r'`) + * * `percent:` Number between `0` and `100`, percentage for which policies are applied (`pct=`, default: `100`) + * * `rua:` Array of aggregate report targets (optional) + * * `ruf:` Array of failure report targets (optional) + * * `failureOptions:` Object or string; Object containing booleans `SPF` and `DKIM`, string is passed raw (`fo=`, default: `'0'`) + * * `failureFormat:` Format in which failure reports are requested (`rf=`, default: `'afrf'`) + * * `reportInterval:` Interval in which reports are requested (`ri=`) + * * `ttl:` Input for `TTL` method (optional) + * + * ### Caveats + * + * * TXT records are automatically split using `AUTOSPLIT`. + * * URIs in the `rua` and `ruf` arrays are passed raw. You must percent-encode all commas and exclamation points in the URI itself. + * + * @see https://dnscontrol.org/js#DMARC_BUILDER */ -declare function DOMAIN_ELSEWHERE(name: string, registrar: string, nameserver_names: string[]): void; +declare function DMARC_BUILDER(opts: { label?: string; version?: string; policy: 'none' | 'quarantine' | 'reject'; subdomainPolicy?: 'none' | 'quarantine' | 'reject'; alignmentSPF?: 'strict' | 's' | 'relaxed' | 'r'; alignmentDKIM?: 'strict' | 's' | 'relaxed' | 'r'; percent?: number; rua?: string[]; ruf?: string[]; failureOptions?: { SPF: boolean, DKIM: boolean } | string; failureFormat?: string; reportInterval?: Duration; ttl?: Duration }): RecordModifier; /** - * `DOMAIN_ELSEWHERE_AUTO()` is similar to `DOMAIN_ELSEWHERE()` but instead of - * a hardcoded list of nameservers, a DnsProvider() is queried. + * `LOC_BUILDER_DD({})` actually takes an object with the following properties: * - * `DOMAIN_ELSEWHERE_AUTO` is useful when you control a domain's registrar but the - * DNS zones are managed by another system. Luckily you have enough access to that - * other system that you can query it to determine the zone's nameservers. + * - label (optional, defaults to `@`) + * - x + * - y + * - alt + * - ttl (optional) * - * For example, suppose you own a domain but the DNS servers for it are in Azure. - * Further suppose that something in Azure maintains the zones (automatic or - * human). Azure picks the nameservers for the domains automatically, and that - * list may change occasionally. `DOMAIN_ELSEWHERE_AUTO` allows you to easily - * query Azure to determine the domain's delegations so that you do not need to - * hard-code them in your dnsconfig.js file. + * A helper to build [`LOC`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) records. Supply four parameters instead of 12. * - * For example these two statements are equivalent: + * Internally assumes some defaults for [`LOC`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) records. * - * ```javascript - * DOMAIN_ELSEWHERE_AUTO("example.com", REG_NAMEDOTCOM, DSP_AZURE); - * ``` + * The cartesian coordinates are decimal degrees, like you typically find in e.g. Google Maps. + * + * Examples. + * + * Big Ben: + * `51.50084265331501, -0.12462541415599787` + * + * The White House: + * `38.89775977858357, -77.03655125982903` * * ```javascript - * D("example.com", REG_NAMEDOTCOM, - * NO_PURGE, - * DnsProvider(DSP_AZURE) + * D("example.com","none" + * , LOC_BUILDER_DD({ + * label: "big-ben", + * x: 51.50084265331501, + * y: -0.12462541415599787, + * alt: 6, + * }) + * , LOC_BUILDER_DD({ + * label: "white-house", + * x: 38.89775977858357, + * y: -77.03655125982903, + * alt: 19, + * }) + * , LOC_BUILDER_DD({ + * label: "white-house-ttl", + * x: 38.89775977858357, + * y: -77.03655125982903, + * alt: 19, + * ttl: "5m", + * }) * ); + * * ``` * - * NOTE: The [`NO_PURGE`](../domain/NO_PURGE.md) is used to prevent DNSControl from changing the records. + * Part of the series: + * * [`LOC()`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works * - * @see https://dnscontrol.org/js#DOMAIN_ELSEWHERE_AUTO + * @see https://dnscontrol.org/js#LOC_BUILDER_DD */ -declare function DOMAIN_ELSEWHERE_AUTO(name: string, domain: string, registrar: string, dnsProvider: string): void; +declare function LOC_BUILDER_DD(label: string, x: float32, y: float32, alt: float32, ttl: int): RecordModifier; /** - * `D_EXTEND` adds records (and metadata) to a domain previously defined - * by [`D()`](D.md). It can also be used to add subdomain records (and metadata) - * to a previously defined domain. + * `LOC_BUILDER_DMM({})` actually takes an object with the following properties: * - * The first argument is a domain name. If it exactly matches a - * previously defined domain, `D_EXTEND()` behaves the same as [`D()`](D.md), - * simply adding records as if they had been specified in the original - * [`D()`](D.md). + * - label (optional, defaults to `@`) + * - str + * - alt + * - ttl (optional) * - * If the domain name does not match an existing domain, but could be a - * (non-delegated) subdomain of an existing domain, the new records (and - * metadata) are added with the subdomain part appended to all record - * names (labels), and targets (as appropriate). See the examples below. + * A helper to build [`LOC`](../domain_modifier_functions/LOC.md) records. Supply three parameters instead of 12. * - * Matching the domain name to previously-defined domains is done using a - * `longest match` algorithm. If `domain.tld` and `sub.domain.tld` are - * defined as separate domains via separate [`D()`](D.md) statements, then - * `D_EXTEND('sub.sub.domain.tld', ...)` would match `sub.domain.tld`, - * not `domain.tld`. + * Internally assumes some defaults for [`LOC`](../domain_modifier_functions/LOC.md) records. * - * Some operators only act on an apex domain (e.g. - * [`CF_REDIRECT`](../domain/CF_REDIRECT.md) and [`CF_TEMP_REDIRECT`](../domain/CF_TEMP_REDIRECT.md)). Using them - * in a `D_EXTEND` subdomain may not be what you expect. + * Accepts a string with decimal minutes (DMM) coordinates in the form: 25.24°S 153.15°E + * + * Note that the following are acceptable forms (symbols differ): + * * `25.24°S 153.15°E` + * * `25.24 S 153.15 E` + * * `25.24° S 153.15° E` + * * `25.24S 153.15E` * * ```javascript - * D("domain.tld", REG, DnsProvider(DNS), - * A("@", "127.0.0.1"), // domain.tld - * A("www", "127.0.0.2"), // www.domain.tld - * CNAME("a", "b") // a.domain.tld -> b.domain.tld - * ); - * D_EXTEND("domain.tld", - * A("aaa", "127.0.0.3"), // aaa.domain.tld - * CNAME("c", "d") // c.domain.tld -> d.domain.tld - * ); - * D_EXTEND("sub.domain.tld", - * A("bbb", "127.0.0.4"), // bbb.sub.domain.tld - * A("ccc", "127.0.0.5"), // ccc.sub.domain.tld - * CNAME("e", "f") // e.sub.domain.tld -> f.sub.domain.tld - * ); - * D_EXTEND("sub.sub.domain.tld", - * A("ddd", "127.0.0.6"), // ddd.sub.sub.domain.tld - * CNAME("g", "h") // g.sub.sub.domain.tld -> h.sub.sub.domain.tld - * ); - * D_EXTEND("sub.domain.tld", - * A("@", "127.0.0.7"), // sub.domain.tld - * CNAME("i", "j") // i.sub.domain.tld -> j.sub.domain.tld + * D("example.com","none" + * LOC_BUILDER_STR({ + * label: "tasmania", + * str: '42°S 147°E', + * alt: 3, + * }) * ); - * ``` - * - * This will end up in the following modifications: (This output assumes the `--full` flag) * - * ```text - * ******************** Domain: domain.tld - * ----- Getting nameservers from: cloudflare - * ----- DNS Provider: cloudflare...7 corrections - * #1: CREATE A aaa.domain.tld 127.0.0.3 - * #2: CREATE A bbb.sub.domain.tld 127.0.0.4 - * #3: CREATE A ccc.sub.domain.tld 127.0.0.5 - * #4: CREATE A ddd.sub.sub.domain.tld 127.0.0.6 - * #5: CREATE A sub.domain.tld 127.0.0.7 - * #6: CREATE A www.domain.tld 127.0.0.2 - * #7: CREATE A domain.tld 127.0.0.1 - * #8: CREATE CNAME a.domain.tld b.domain.tld. - * #9: CREATE CNAME c.domain.tld d.domain.tld. - * #10: CREATE CNAME e.sub.domain.tld f.sub.domain.tld. - * #11: CREATE CNAME g.sub.sub.domain.tld h.sub.sub.domain.tld. - * #12: CREATE CNAME i.sub.domain.tld j.sub.domain.tld. * ``` * - * ProTips: `D_EXTEND()` permits you to create very complex and - * sophisticated configurations, but you shouldn't. Be nice to the next - * person that edits the file, who may not be as expert as yourself. - * Enhance readability by putting any `D_EXTEND()` statements immediately - * after the original [`D()`](D.md), like in above example. Avoid the temptation - * to obscure the addition of records to existing domains with randomly - * placed `D_EXTEND()` statements. Don't build up a domain using loops of - * `D_EXTEND()` statements. You'll be glad you didn't. + * Part of the series: + * * [`LOC()`](../domain_modifier_functions/LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](../record_modifier_functions/LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](../record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](../record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](../record_modifier_functions/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works * - * @see https://dnscontrol.org/js#D_EXTEND + * @see https://dnscontrol.org/js#LOC_BUILDER_DMM_STR */ -declare function D_EXTEND(name: string, ...modifiers: DomainModifier[]): void; +declare function LOC_BUILDER_DMM_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; /** - * Converts an IPv4 address from string to an integer. This allows performing mathematical operations with the IP address. + * `LOC_BUILDER_DMS_STR({})` actually takes an object with the following properties: * - * ```javascript - * var addrA = IP('1.2.3.4') - * var addrB = addrA + 1 - * // addrB = 1.2.3.5 - * ``` + * - label (optional, defaults to `@`) + * - str + * - alt + * - ttl (optional) * - * NOTE: `IP()` does not accept IPv6 addresses (PRs gladly accepted!). IPv6 addresses are simply strings: + * A helper to build [`LOC`](../domain_modifier_functions/LOC.md) records. Supply three parameters instead of 12. + * + * Internally assumes some defaults for [`LOC`](../domain_modifier_functions/LOC.md) records. + * + * Accepts a string with degrees, minutes, and seconds (DMS) coordinates in the form: 41°24'12.2"N 2°10'26.5"E + * + * Note that the following are acceptable forms (symbols differ): + * * `33°51′31″S 151°12′51″E` + * * `33°51'31"S 151°12'51"E` + * * `33d51m31sS 151d12m51sE` + * * `33d51m31s S 151d12m51s E` * * ```javascript - * // IPv4 Var - * var addrA1 = IP("1.2.3.4"); - * var addrA2 = "1.2.3.4"; + * D("example.com","none" + * LOC_BUILDER_DMS_STR({ + * label: "sydney-opera-house", + * str: '33°51′31″S 151°12′51″E', + * alt: 4, + * ttl: "5m", + * }) + * ); * - * // IPv6 Var - * var addrAAAA = "0:0:0:0:0:0:0:0"; * ``` * - * @see https://dnscontrol.org/js#IP + * Part of the series: + * * [`LOC()`](../domain_modifier_functions/LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](../record_modifier_functions/LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](../record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](../record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](../record_modifier_functions/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://dnscontrol.org/js#LOC_BUILDER_DMS_STR */ -declare function IP(ip: string): number; +declare function LOC_BUILDER_DMS_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; /** - * NewDnsProvider activates a DNS Service Provider (DSP) specified in `creds.json`. - * A DSP stores a DNS zone's records and provides DNS service for the zone (i.e. - * answers on port 53 to queries related to the zone). + * `LOC_BUILDER_STR({})` actually takes an object with the following: properties. * - * * `name` must match the name of an entry in `creds.json`. - * * `type` specifies a valid DNS provider type identifier listed on the [provider page](../../providers.md). - * * Starting with [v3.16](../../v316.md), the type is optional. If it is absent, the `TYPE` field in `creds.json` is used instead. You can leave it out. (Thanks to JavaScript magic, you can leave it out even when there are more fields). - * * Starting with v4.0, specifying the type may be an error. Please add the `TYPE` field to `creds.json` and remove this parameter from `dnsconfig.js` to prepare. - * * `meta` is a way to send additional parameters to the provider. It is optional and only certain providers use it. See the [individual provider docs](../../providers.md) for details. + * - label (optional, defaults to `@`) + * - str + * - alt + * - ttl (optional) * - * This function will return an opaque string that should be assigned to a variable name for use in [D](D.md) directives. + * A helper to build [`LOC`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) records. Supply three parameters instead of 12. * - * Prior to [v3.16](../../v316.md): + * Internally assumes some defaults for [`LOC`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) records. * - * ```javascript - * var REG_MYNDC = NewRegistrar("mynamedotcom", "NAMEDOTCOM"); - * var DNS_MYAWS = NewDnsProvider("myaws", "ROUTE53"); - * - * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), - * A("@","1.2.3.4") - * ); - * ``` - * - * In [v3.16](../../v316.md) and later: + * Accepts a string and tries all `LOC_BUILDER_DM*_STR({})` methods: + * * [`LOC_BUILDER_DMS_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E * * ```javascript - * var REG_MYNDC = NewRegistrar("mynamedotcom"); - * var DNS_MYAWS = NewDnsProvider("myaws"); - * - * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), - * A("@","1.2.3.4") + * D("example.com","none" + * , LOC_BUILDER_STR({ + * label: "old-faithful", + * str: '44.46046°N 110.82815°W', + * alt: 2240, + * }) + * , LOC_BUILDER_STR({ + * label: "ribblehead-viaduct", + * str: '54.210436°N 2.370231°W', + * alt: 300, + * }) + * , LOC_BUILDER_STR({ + * label: "guinness-brewery", + * str: '53°20′40″N 6°17′20″W', + * alt: 300, + * }) * ); + * * ``` * - * @see https://dnscontrol.org/js#NewDnsProvider + * Part of the series: + * * [`LOC()`](/documentation/02_language_reference/domain_modifier_functions/LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](/documentation/02_language_reference/record_modifier_functions/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://dnscontrol.org/js#LOC_BUILDER_STR */ -declare function NewDnsProvider(name: string, type?: string, meta?: object): string; +declare function LOC_BUILDER_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; /** - * NewRegistrar activates a Registrar Provider specified in `creds.json`. - * A registrar maintains the domain's registration and delegation (i.e. the - * nameservers for the domain). DNSControl only manages the delegation. + * DNSControl can optimize the SPF settings on a domain by flattening + * (inlining) includes and removing duplicates. DNSControl also makes + * it easier to document your SPF configuration. * - * * `name` must match the name of an entry in `creds.json`. - * * `type` specifies a valid DNS provider type identifier listed on the [provider page](../../providers.md). - * * Starting with [v3.16](../../v316.md), the type is optional. If it is absent, the `TYPE` field in `creds.json` is used instead. You can leave it out. (Thanks to JavaScript magic, you can leave it out even when there are more fields). - * * Starting with v4.0, specifying the type may be an error. Please add the `TYPE` field to `creds.json` and remove this parameter from `dnsconfig.js` to prepare. - * * `meta` is a way to send additional parameters to the provider. It is optional and only certain providers use it. See the [individual provider docs](../../providers.md) for details. + * WARNING: Flattening SPF includes is risky. Only flatten an SPF + * setting if it is absolutely needed to bring the number of "lookups" + * to be less than 10. In fact, it is debatable whether or not ISPs + * enforce the "10 lookup rule". * - * This function will return an opaque string that should be assigned to a variable name for use in [D](D.md) directives. + * ## The old way * - * Prior to [v3.16](../../v316.md): + * Here is an example of how SPF settings are normally done: * * ```javascript - * var REG_MYNDC = NewRegistrar("mynamedotcom", "NAMEDOTCOM"); - * var DNS_MYAWS = NewDnsProvider("myaws", "ROUTE53"); - * - * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), - * A("@","1.2.3.4") - * ); + * D("example.tld", REG, DNS, ... + * TXT("v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 include:_spf.google.com include:mailgun.org include:spf-basic.fogcreek.com include:mail.zendesk.com include:servers.mcsv.net include:sendgrid.net include:450622.spf05.hubspotemail.net ~all") + * ) * ``` * - * In [v3.16](../../v316.md) and later: - * - * ```javascript - * var REG_MYNDC = NewRegistrar("mynamedotcom"); - * var DNS_MYAWS = NewDnsProvider("myaws"); + * This has a few problems: * - * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), - * A("@","1.2.3.4") - * ); - * ``` + * * No comments. It is difficult to add a comment. In particular, we want to be able to list which ticket requested each item in the SPF setting so that history is retained. + * * Ugly diffs. If you add an element to the SPF setting, the diff will show the entire line changed, which is difficult to read. + * * Too many lookups. The SPF RFC says that SPF settings should not require more than 10 DNS lookups. If we manually flatten (i.e. "inline") an include, we have to remember to check back to see if the settings have changed. Humans are not good at that kind of thing. * - * @see https://dnscontrol.org/js#NewRegistrar - */ -declare function NewRegistrar(name: string, type?: string, meta?: object): string; - -/** - * `PANIC` terminates the script and therefore DNSControl with an exit code of 1. This should be used if your script cannot gather enough information to generate records, for example when a HTTP request failed. + * ## The DNSControl way * * ```javascript - * PANIC("Something really bad has happened"); + * D("example.tld", REG, DSP, ... + * A("@", "10.2.2.2"), + * MX("@", "example.tld."), + * SPF_BUILDER({ + * label: "@", + * overflow: "_spf%d", + * raw: "_rawspf", + * ttl: "5m", + * parts: [ + * "v=spf1", + * "ip4:198.252.206.0/24", // ny-mail* + * "ip4:192.111.0.0/24", // co-mail* + * "include:_spf.google.com", // GSuite + * "include:mailgun.org", // Greenhouse.io + * "include:spf-basic.fogcreek.com", // Fogbugz + * "include:mail.zendesk.com", // Zenddesk + * "include:servers.mcsv.net", // MailChimp + * "include:sendgrid.net", // SendGrid + * "include:450622.spf05.hubspotemail.net", // Hubspot (Ticket# SREREQ-107) + * "~all" + * ], + * flatten: [ + * "spf-basic.fogcreek.com", // Rationale: Being deprecated. Low risk if it breaks. + * "450622.spf05.hubspotemail.net" // Rationale: Unlikely to change without warning. + * ] + * }), + * ); * ``` * - * @see https://dnscontrol.org/js#PANIC - */ -declare function PANIC(message: string): never; - -/** - * `REV` returns the reverse lookup domain for an IP network. For - * example `REV('1.2.3.0/24')` returns `3.2.1.in-addr.arpa.` and - * `REV('2001:db8:302::/48)` returns `2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.`. - * This is used in [`D()`](D.md) functions to create reverse DNS lookup zones. - * - * This is a convenience function. You could specify `D('3.2.1.in-addr.arpa', - * ...` if you like to do things manually but why would you risk making - * typos? + * By using the `SPF_BUILDER()` we gain many benefits: * - * `REV` complies with RFC2317, "Classless in-addr.arpa delegation" - * for netmasks of size /25 through /31. - * While the RFC permits any format, we abide by the recommended format: - * `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address - * of the zone, `MASK` is the netmask of the zone (25-31 inclusive), - * and A, B, C are the first 3 octets of the IP address. For example - * `172.20.18.130/27` is located in a zone named - * `128/27.18.20.172.in-addr.arpa` + * * Comments can appear next to the element they refer to. + * * Diffs will be shorter and more specific; therefore easier to read. + * * Automatic flattening. We can specify which includes should be flattened and DNSControl will do the work. It will even warn us if the includes change. * - * If the address does not include a "/" then `REV` assumes /32 for IPv4 addresses - * and /128 for IPv6 addresses. + * ## Syntax * - * Note that the lower bits (the ones outside the netmask) must be zeros. They are not - * zeroed out automatically. Thus, `REV('1.2.3.4/24')` is an error. This is done - * to catch typos. + * When you want to specify SPF settings for a domain, use the + * `SPF_BUILDER()` function. * * ```javascript - * D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND), - * PTR("1", 'foo.example.com.'), - * PTR("2", 'bar.example.com.'), - * PTR("3", 'baz.example.com.'), - * // These take advantage of DNSControl's ability to generate the right name: - * PTR("1.2.3.10", 'ten.example.com.'), - * ); - * - * D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND), - * PTR("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0", 'foo.example.com.'), // 2001:db8:302::1 - * // These take advantage of DNSControl's ability to generate the right name: - * PTR("2001:db8:302::2", 'two.example.com.'), // 2.0.0... - * PTR("2001:db8:302::3", 'three.example.com.'), // 3.0.0... + * D("example.tld", REG, DSP, ... + * ... + * ... + * ... + * SPF_BUILDER({ + * label: "@", + * overflow: "_spf%d", // Delete this line if you don't want big strings split. + * overhead1: "20", // There are 20 bytes of other TXT records on this domain. Compensate for this. + * raw: "_rawspf", // Delete this line if the default is sufficient. + * parts: [ + * "v=spf1", + * // fill in your SPF items here + * "~all" + * ], + * flatten: [ + * // fill in any domains to inline. + * ] + * }), + * ... + * ... * ); * ``` * - * In the future we plan on adding a flag to [`A()`](../domain/A.md)which will insert - * the correct PTR() record in the appropriate `D(REV())` domain (i.e. `.arpa` domain) has been - * defined. - * - * @see https://dnscontrol.org/js#REV - */ -declare function REV(address: string): string; - -/** - * `getConfiguredDomains` getConfiguredDomains is a helper function that returns the domain names - * configured at the time the function is called. Calling this function early or later in - * `dnsconfig.js` may return different results. Typical usage is to iterate over all - * domains at the end of your configuration file. + * The parameters are: * - * Example for adding records to all configured domains: - * ```javascript - * var domains = getConfiguredDomains(); - * for(i = 0; i < domains.length; i++) { - * D_EXTEND(domains[i], - * TXT('_important', 'BLA') // I know, not really creative. - * ) - * } - * ``` + * * `label:` The label of the first TXT record. (Optional. Default: `"@"`) + * * `overflow:` If set, SPF strings longer than 255 chars will be split into multiple TXT records. The value of this setting determines the template for what the additional labels will be named. If not set, no splitting will occur and DNSControl may generate TXT strings that are too long. + * * `overhead1:` "Overhead for the 1st TXT record". When calculating the max length of each TXT record, reduce the maximum for the first TXT record in the chain by this amount. + * * `raw:` The label of the unaltered SPF settings. Setting to an empty string `''` will disable this. (Optional. Default: `"_rawspf"`) + * * `ttl:` This allows setting a specific TTL on this SPF record. (Optional. Default: using default record TTL) + * * `txtMaxSize` The maximum size for each TXT record. Values over 255 will result in [multiple strings][multi-string]. General recommendation is to [not go higher than 450][record-size] so that DNS responses will still fit in a UDP packet. (Optional. Default: `"255"`) + * * `parts:` The individual parts of the SPF settings. + * * `flatten:` Which includes should be inlined. For safety purposes the flattening is done on an opt-in basis. If `"*"` is listed, all includes will be flattened... this might create more problems than is solves due to length limitations. * - * This will end up in following modifications: (All output assumes the `--full` flag) + * [multi-string]: https://tools.ietf.org/html/rfc4408#section-3.1.3 + * [record-size]: https://tools.ietf.org/html/rfc4408#section-3.1.4 * - * ```text - * ******************** Domain: domain1.tld - * ----- Getting nameservers from: registrar - * ----- DNS Provider: registrar...2 corrections - * #1: CREATE TXT _important.domain1.tld "BLA" ttl=43200 - * #2: REFRESH zone domain1.tld + * `SPF_BUILDER()` returns multiple `TXT()` records: * - * ******************** Domain: domain2.tld - * ----- Getting nameservers from: registrar - * ----- DNS Provider: registrar...2 corrections - * #1: CREATE TXT _important.domain2.tld "BLA" ttl=43200 - * #2: REFRESH zone domain2.tld - * ``` + * * `TXT("@", "v=spf1 .... ~all")` + * * This is the optimized configuration. + * * `TXT("_spf1", "...")` + * * If the optimizer needs to split a long string across multiple TXT records, the additional TXT records will have labels `_spf1`, `_spf2`, `_spf3`, etc. + * * `TXT("_rawspf", "v=spf1 .... ~all")` + * * This is the unaltered SPF configuration. This is purely for debugging purposes and is not used by any email or anti-spam system. It is only generated if flattening is requested. * - * Example for adding DMARC report records: + * We recommend first using this without any flattening. Make sure + * `dnscontrol preview` works as expected. Once that is done, add the + * flattening required to reduce the number of lookups to 10 or less. * - * This example might be more useful, specially for configuring the DMARC report records. According to DMARC RFC you need to specify `domain2.tld._report.dmarc.domain1.tld` to allow `domain2.tld` to send aggregate/forensic email reports to `domain1.tld`. This can be used to do this in an easy way, without using the wildcard from the RFC. + * To count the number of lookups, you can use our interactive SPF + * debugger at [https://stackexchange.github.io/dnscontrol/flattener/index.html](https://stackexchange.github.io/dnscontrol/flattener/index.html) * - * ```javascript - * var domains = getConfiguredDomains(); - * for(i = 0; i < domains.length; i++) { - * D_EXTEND("domain1.tld", - * TXT(domains[i] + '._report._dmarc', 'v=DMARC1') - * ); - * } - * ``` + * # The first in a chain is special * - * This will end up in following modifications: + * When generating the chain of SPF + * records, each one is max length 255. For the first item in + * the chain, the max is 255 - "overhead1". Setting this to 255 or + * higher has undefined behavior. * - * ```text - * ******************** Domain: domain2.tld - * ----- Getting nameservers from: registrar - * ----- DNS Provider: registrar...4 corrections - * #1: CREATE TXT domain1.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 - * #2: CREATE TXT domain3.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 - * #3: CREATE TXT domain4.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 - * #4: REFRESH zone domain2.tld - * ``` + * Why is this useful? * - * @see https://dnscontrol.org/js#getConfiguredDomains - */ -declare function getConfiguredDomains(): string[]; - -/** - * `require_glob()` can recursively load `.js` files, optionally non-recursive as well. + * Some sites desire having all DNS queries fit in a single packet so + * that UDP, not TCP, can be used to satisfy all requests. That means all + * responses have to be relatively small. * - * Possible parameters are: + * When an SPF system does a "TXT" lookup, it gets SPF and non-SPF + * records. This makes the first link in the chain extra large. * - * - Path as string, where you would like to start including files. Mandatory. Pattern matching possible, see [GoLand path/filepath/#Match docs](https://golang.org/pkg/path/filepath/#Match). - * - If being recursive. This is a boolean if the search should be recursive or not. Define either `true` or `false`. Default is `true`. + * The bottom line is that if you want the TXT records to fit in a UDP + * packet, keep increasing the value of `overhead1` until the packet + * is no longer truncated. * - * Example to load `.js` files recursively: + * Example: * - * ```javascript - * require_glob("./domains/"); + * ```shell + * dig +short whatexit.org txt | wc -c + * 118 * ``` * - * Example to load `.js` files only in `domains/`: + * Setting `overhead1` to 118 should be sufficient. * - * ```javascript - * require_glob("./domains/", false); + * ```shell + * dig +short stackoverflow.com txt | wc -c + * 582 * ``` * - * One more important thing to note: `require_glob()` is as smart as `require()` is. It loads files always relative to the JavaScript - * file where it's being executed in. Let's go with an example, as it describes it better: + * Since 582 is bigger than 255, it might not be possible to achieve the + * goal. Any value larger than 255 will disable all flattening. Try + * 170, then 180, 190 until you get the desired results. * - * ```javascript - * require("domains/index.js"); - * ``` + * A validator such as + * [https://www.kitterman.com/spf/validate.html](https://www.kitterman.com/spf/validate.html) + * will tell you if the queries are being truncated and TCP was required + * to get the entire record. (Sadly it caches heavily.) * - * ```javascript - * require_glob("./user1/"); + * ## Notes about the `spfcache.json` + * + * DNSControl keeps a cache of the DNS lookups performed during + * optimization. The cache is maintained so that the optimizer does + * not produce different results depending on the ups and downs of + * other people's DNS servers. This makes it possible to do `dnscontrol + * push` even if your or third-party DNS servers are down. + * + * The DNS cache is kept in a file called `spfcache.json`. If it needs + * to be updated, the proper data will be written to a file called + * `spfcache.updated.json` and instructions such as the ones below + * will be output telling you exactly what to do: + * + * ```shell + * dnscontrol preview + * 1 Validation errors: + * WARNING: 2 spf record lookups are out of date with cache (_spf.google.com,_netblocks3.google.com). + * Wrote changes to spfcache.updated.json. Please rename and commit: + * $ mv spfcache.updated.json spfcache.json + * $ git commit spfcache.json * ``` * - * This will now load files being present underneath `./domains/user1/` and **NOT** at below `./domains/`, as `require_glob()` - * is called in the subfolder `domains/`. + * In this case, you are being asked to replace `spfcache.json` with + * the newly generated data in `spfcache.updated.json`. * - * @see https://dnscontrol.org/js#require_glob - */ -declare function require_glob(path: string, recursive: boolean): void; - -/** - * DNSControl contains a `CAA_BUILDER` which can be used to simply create - * [`CAA()`](../domain/CAA.md) records for your domains. Instead of creating each [`CAA()`](../domain/CAA.md) record - * individually, you can simply configure your report mail address, the - * authorized certificate authorities and the builder cares about the rest. + * Needing to do this kind of update is considered a validation error + * and will block `dnscontrol push` from running. * - * ## Example + * Note: The instructions are hardcoded strings. The filenames will + * not change. * - * For example you can use: + * Note: The instructions assume you use git. If you use something + * else, please do the appropriate equivalent command. * - * ```javascript - * CAA_BUILDER({ - * label: "@", - * iodef: "mailto:test@domain.tld", - * iodef_critical: true, - * issue: [ - * "letsencrypt.org", - * "comodoca.com", - * ], - * issuewild: "none", - * }) - * ``` + * ## Caveats * - * The parameters are: + * 1. DNSControl 'gives up' if it sees SPF records it can't understand. + * This includes: syntax errors, features that our spflib doesn't know + * about, overly complex SPF settings, and anything else that we we + * didn't feel like implementing. * - * * `label:` The label of the CAA record. (Optional. Default: `"@"`) - * * `iodef:` Report all violation to configured mail address. - * * `iodef_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`) - * * `issue:` An array of CAs which are allowed to issue certificates. (Use `"none"` to refuse all CAs) - * * `issuewild:` An array of CAs which are allowed to issue wildcard certificates. (Can be simply `"none"` to refuse issuing wildcard certificates for all CAs) + * 2. The TXT record that is generated may exceed DNS limits. dnscontrol + * will not generate a single TXT record that exceeds DNS limits, but + * it ignores the fact that there may be other TXT records on the same + * label. For example, suppose it generates a TXT record on the bare + * domain (stackoverflow.com) that is 250 bytes long. That's fine and + * doesn't require a continuation record. However if there is another + * TXT record (not an SPF record, perhaps a TXT record used to verify + * domain ownership), the total packet size of all the TXT records + * could exceed 512 bytes, and will require EDNS or a TCP request. * - * `CAA_BUILDER()` returns multiple records (when configured as example above): + * 3. DNSControl does not warn if the number of lookups exceeds 10. + * We hope to implement this some day. * - * ```javascript - * CAA("@", "iodef", "mailto:test@domain.tld", CAA_CRITICAL) - * CAA("@", "issue", "letsencrypt.org") - * CAA("@", "issue", "comodoca.com") - * CAA("@", "issuewild", ";") - * ``` + * 4. The `redirect=` directive is only partially implemented. We only + * handle the case where redirect is the last item in the SPF record. + * In which case, it is equivalent to `include:`. * - * @see https://dnscontrol.org/js#CAA_BUILDER - */ -declare function CAA_BUILDER(opts: { label?: string; iodef: string; iodef_critical?: boolean; issue: string[]; issuewild: string }): RecordModifier; - -/** - * DNSControl contains a `DMARC_BUILDER` which can be used to simply create - * DMARC policies for your domains. + * ## Advanced Technique: Interactive SPF Debugger * - * ## Example + * DNSControl includes an experimental system for viewing + * SPF settings: * - * ### Simple example + * [https://stackexchange.github.io/dnscontrol/flattener/index.html](https://stackexchange.github.io/dnscontrol/flattener/index.html) * - * ```javascript - * DMARC_BUILDER({ - * policy: 'reject', - * ruf: [ - * 'mailto:mailauth-reports@example.com', - * ], - * }) - * ``` + * You can also run this locally (it is self-contained) by opening + * `dnscontrol/docs/flattener/index.html` in your browser. * - * This yield the following record: + * You can use this to determine the minimal number of domains you + * need to flatten to have fewer than 10 lookups. * - * ```text - * @ IN TXT "v=DMARC1; p=reject; ruf=mailto:mailauth-reports@example.com" - * ``` + * The output is as follows: * - * ### Advanced example + * 1. The top part lists the domain as it current is configured, how + * many lookups it requires, and includes a checkbox for each item + * that could be flattened. * - * ```javascript - * DMARC_BUILDER({ - * policy: 'reject', - * subdomainPolicy: 'quarantine', - * percent: 50, - * alignmentSPF: 'r', - * alignmentDKIM: 'strict', - * rua: [ - * 'mailto:mailauth-reports@example.com', - * 'https://dmarc.example.com/submit', - * ], - * ruf: [ - * 'mailto:mailauth-reports@example.com', - * ], - * failureOptions: '1', - * reportInterval: '1h', - * }); - * ``` + * 2. Fully flattened: This section shows the SPF configuration if you + * fully flatten it. i.e. This is what it would look like if all the + * checkboxes were checked. Note that this result is likely to be + * longer than 255 bytes, the limit for a single TXT string. + * + * 3. Fully flattened split: This takes the "fully flattened" result + * and splits it into multiple DNS records. To continue to the next + * record an include is added. + * + * ## Advanced Technique: Define once, use many + * + * In some situations we define an SPF setting once and want to re-use + * it on many domains. Here's how to do this: * * ```javascript - * DMARC_BUILDER({ - * label: 'insecure', - * policy: 'none', - * ruf: [ - * 'mailto:mailauth-reports@example.com', + * var SPF_MYSETTINGS = SPF_BUILDER({ + * label: "@", + * overflow: "_spf%d", + * raw: "_rawspf", + * parts: [ + * "v=spf1", + * ... + * "~all" * ], - * failureOptions: { - * SPF: false, - * DKIM: true, - * }, + * flatten: [ + * ... + * ] * }); - * ``` * - * This yields the following records: + * D("example.tld", REG, DSP, ... + * SPF_MYSETTINGS + * ); * - * ```text - * @ IN TXT "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=50; rua=mailto:mailauth-reports@example.com,https://dmarc.example.com/submit; ruf=mailto:mailauth-reports@example.com; fo=1; ri=3600" - * insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com; fo=d" + * D("example2.tld", REG, DSP, ... + * SPF_MYSETTINGS + * ); * ``` * - * ### Parameters - * - * * `label:` The DNS label for the DMARC record (`_dmarc` prefix is added, default: `'@'`) - * * `version:` The DMARC version to be used (default: `DMARC1`) - * * `policy:` The DMARC policy (`p=`), must be one of `'none'`, `'quarantine'`, `'reject'` - * * `subdomainPolicy:` The DMARC policy for subdomains (`sp=`), must be one of `'none'`, `'quarantine'`, `'reject'` (optional) - * * `alignmentSPF:` `'strict'`/`'s'` or `'relaxed'`/`'r'` alignment for SPF (`aspf=`, default: `'r'`) - * * `alignmentDKIM:` `'strict'`/`'s'` or `'relaxed'`/`'r'` alignment for DKIM (`adkim=`, default: `'r'`) - * * `percent:` Number between `0` and `100`, percentage for which policies are applied (`pct=`, default: `100`) - * * `rua:` Array of aggregate report targets (optional) - * * `ruf:` Array of failure report targets (optional) - * * `failureOptions:` Object or string; Object containing booleans `SPF` and `DKIM`, string is passed raw (`fo=`, default: `'0'`) - * * `failureFormat:` Format in which failure reports are requested (`rf=`, default: `'afrf'`) - * * `reportInterval:` Interval in which reports are requested (`ri=`) - * * `ttl:` Input for `TTL` method (optional) - * - * ### Caveats - * - * * TXT records are automatically split using `AUTOSPLIT`. - * * URIs in the `rua` and `ruf` arrays are passed raw. You must percent-encode all commas and exclamation points in the URI itself. - * - * @see https://dnscontrol.org/js#DMARC_BUILDER + * @see https://dnscontrol.org/js#SPF_BUILDER */ -declare function DMARC_BUILDER(opts: { label?: string; version?: string; policy: 'none' | 'quarantine' | 'reject'; subdomainPolicy?: 'none' | 'quarantine' | 'reject'; alignmentSPF?: 'strict' | 's' | 'relaxed' | 'r'; alignmentDKIM?: 'strict' | 's' | 'relaxed' | 'r'; percent?: number; rua?: string[]; ruf?: string[]; failureOptions?: { SPF: boolean, DKIM: boolean } | string; failureFormat?: string; reportInterval?: Duration; ttl?: Duration }): RecordModifier; +declare function SPF_BUILDER(opts: { label?: string; overflow?: string; overhead1?: string; raw?: string; ttl?: Duration; txtMaxSize: string[]; parts?: number; flatten?: string[] }): RecordModifier; /** - * `LOC_BUILDER_DD({})` actually takes an object with the following properties: + * TTL sets the TTL for a single record only. This will take precedence + * over the domain's [DefaultTTL](/documentation/02_language_reference/domain_modifier_functions/DefaultTTL.md) if supplied. * - * - label (optional, defaults to `@`) - * - x - * - y - * - alt - * - ttl (optional) - * - * A helper to build [`LOC`](../domain/LOC.md) records. Supply four parameters instead of 12. - * - * Internally assumes some defaults for [`LOC`](../domain/LOC.md) records. - * - * The cartesian coordinates are decimal degrees, like you typically find in e.g. Google Maps. - * - * Examples. - * - * Big Ben: - * `51.50084265331501, -0.12462541415599787` + * The value can be: * - * The White House: - * `38.89775977858357, -77.03655125982903` + * * An integer (number of seconds). Example: `600` + * * A string: Integer with single-letter unit: Example: `5m` + * * The unit denotes: + * * s (seconds) + * * m (minutes) + * * h (hours) + * * d (days) + * * w (weeks) + * * n (nonths) (30 days in a nonth) + * * y (years) (If you set a TTL to a year, we assume you also do crossword puzzles in pen. Show off!) + * * If no unit is specified, the default is seconds. + * * We highly recommend using units instead of the number of seconds. Would your coworkers understand your intention better if you wrote `14400` or `'4h'`? * * ```javascript - * D("example.com","none" - * , LOC_BUILDER_DD({ - * label: "big-ben", - * x: 51.50084265331501, - * y: -0.12462541415599787, - * alt: 6, - * }) - * , LOC_BUILDER_DD({ - * label: "white-house", - * x: 38.89775977858357, - * y: -77.03655125982903, - * alt: 19, - * }) - * , LOC_BUILDER_DD({ - * label: "white-house-ttl", - * x: 38.89775977858357, - * y: -77.03655125982903, - * alt: 19, - * ttl: "5m", - * }) + * D('example.com', REGISTRAR, DnsProvider('R53'), + * DefaultTTL(2000), + * A('@','1.2.3.4'), // uses default + * A('foo', '2.3.4.5', TTL(500)), // overrides default + * A('demo1', '3.4.5.11', TTL('5d')), // 5 days + * A('demo2', '3.4.5.12', TTL('5w')), // 5 weeks * ); - * * ``` * - * Part of the series: - * * [`LOC()`](../domain/LOC.md) - build a `LOC` by supplying all 12 parameters - * * [`LOC_BUILDER_DD({})`](../record/LOC_BUILDER_DD.md) - accepts cartesian x, y - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E - * * [`LOC_BUILDER_STR({})`](../record/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works - * - * @see https://dnscontrol.org/js#LOC_BUILDER_DD + * @see https://dnscontrol.org/js#TTL */ -declare function LOC_BUILDER_DD(label: string, x: float32, y: float32, alt: float32, ttl: int): RecordModifier; +declare function TTL(ttl: Duration): RecordModifier; /** - * `LOC_BUILDER_DMM({})` actually takes an object with the following properties: + * `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.md)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](NewDnsProvider.md), + * add records with [A](/documentation/02_language_reference/domain_modifier_functions/A.md), [CNAME](/documentation/02_language_reference/domain_modifier_functions/CNAME.md), and so forth, or add metadata. * - * - label (optional, defaults to `@`) - * - str - * - alt - * - ttl (optional) + * Modifier arguments are processed according to type as follows: * - * A helper to build [`LOC`](../domain/LOC.md) records. Supply three parameters instead of 12. + * - A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](https://docs.dnscontrol.org/language-reference/domain-modifiers) return such functions. + * - An object argument will be merged into the domain's metadata collection. + * - An array argument 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. * - * Internally assumes some defaults for [`LOC`](../domain/LOC.md) records. + * ```javascript + * var REGISTRAR = NewRegistrar("name.com"); + * var r53 = NewDnsProvider("R53"); * - * Accepts a string with decimal minutes (DMM) coordinates in the form: 25.24°S 153.15°E + * // simple domain + * D("example.com", REGISTRAR, DnsProvider(r53), + * A("@","1.2.3.4"), + * CNAME("test", "foo.example2.com.") + * ); * - * Note that the following are acceptable forms (symbols differ): - * * `25.24°S 153.15°E` - * * `25.24 S 153.15 E` - * * `25.24° S 153.15° E` - * * `25.24S 153.15E` + * // "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.'), + * ] * - * ```javascript - * D("example.com","none" - * LOC_BUILDER_STR({ - * label: "tasmania", - * str: '42°S 147°E', - * alt: 3, - * }) + * D("example.com", REGISTRAR, DnsProvider(r53), + * A("@","1.2.3.4"), + * CNAME("test", "foo.example2.com."), + * GOOGLE_APPS_DOMAIN_MX * ); - * * ``` * - * Part of the series: - * * [`LOC()`](../domain/LOC.md) - build a `LOC` by supplying all 12 parameters - * * [`LOC_BUILDER_DD({})`](../record/LOC_BUILDER_DD.md) - accepts cartesian x, y - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E - * * [`LOC_BUILDER_STR({})`](../record/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works - * - * @see https://dnscontrol.org/js#LOC_BUILDER_DMM_STR - */ -declare function LOC_BUILDER_DMM_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; - -/** - * `LOC_BUILDER_DMS_STR({})` actually takes an object with the following properties: - * - * - label (optional, defaults to `@`) - * - str - * - alt - * - ttl (optional) + * # Split Horizon DNS * - * A helper to build [`LOC`](../domain/LOC.md) records. Supply three parameters instead of 12. + * DNSControl supports Split Horizon DNS. Simply + * define the domain two or more times, each with + * their own unique parameters. * - * Internally assumes some defaults for [`LOC`](../domain/LOC.md) records. + * To differentiate the different domains, specify the domains as + * `domain.tld!tag`, such as `example.com!inside` and + * `example.com!outside`. * - * Accepts a string with degrees, minutes, and seconds (DMS) coordinates in the form: 41°24'12.2"N 2°10'26.5"E + * ```javascript + * var REG = NewRegistrar("Third-Party"); + * var DNS_INSIDE = NewDnsProvider("Cloudflare"); + * var DNS_OUTSIDE = NewDnsProvider("bind"); * - * Note that the following are acceptable forms (symbols differ): - * * `33°51′31″S 151°12′51″E` - * * `33°51'31"S 151°12'51"E` - * * `33d51m31sS 151d12m51sE` - * * `33d51m31s S 151d12m51s E` + * D("example.com!inside", REG, DnsProvider(DNS_INSIDE), + * A("www", "10.10.10.10") + * ); * - * ```javascript - * D("example.com","none" - * LOC_BUILDER_DMS_STR({ - * label: "sydney-opera-house", - * str: '33°51′31″S 151°12′51″E', - * alt: 4, - * ttl: "5m", - * }) + * D("example.com!outside", REG, DnsProvider(DNS_OUTSIDE), + * A("www", "20.20.20.20") * ); * + * D_EXTEND("example.com!inside", + * A("internal", "10.99.99.99") + * ); * ``` * - * Part of the series: - * * [`LOC()`](../domain/LOC.md) - build a `LOC` by supplying all 12 parameters - * * [`LOC_BUILDER_DD({})`](../record/LOC_BUILDER_DD.md) - accepts cartesian x, y - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E - * * [`LOC_BUILDER_STR({})`](../record/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * A domain name without a `!` is assigned a tag that is the empty + * string. For example, `example.com` and `example.com!` are equivalent. + * However, we strongly recommend against using the empty tag, as it + * risks creating confusion. In other words, if you have `domain.tld` + * and `domain.tld!external` you now require humans to remember that + * `domain.tld` is the external one. I mean... the internal one. You + * may have noticed this mistake, but will your coworkers? Will you in + * six months? You get the idea. * - * @see https://dnscontrol.org/js#LOC_BUILDER_DMS_STR + * DNSControl command line flag `--domains` matches the full name (with the "!"). If you + * define domains `example.com!george` and `example.com!john` then: + * + * * `--domains=example.com` will not match either domain. + * * `--domains='example.com!george'` will match only match the first. + * * `--domains='example.com!george',example.com!john` will match both. + * + * NOTE: The quotes are required if your shell treats `!` as a special + * character, which is probably does. If you see an error that mentions + * `event not found` you probably forgot the quotes. + * + * @see https://dnscontrol.org/js#D */ -declare function LOC_BUILDER_DMS_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; +declare function D(name: string, registrar: string, ...modifiers: DomainModifier[]): void; /** - * `LOC_BUILDER_STR({})` actually takes an object with the following: properties. - * - * - label (optional, defaults to `@`) - * - str - * - alt - * - ttl (optional) - * - * A helper to build [`LOC`](../domain/LOC.md) records. Supply three parameters instead of 12. + * `DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [`D`](D.md) will have these + * arguments passed as if they were the first modifiers in the argument list. * - * Internally assumes some defaults for [`LOC`](../domain/LOC.md) records. + * ## Example * - * Accepts a string and tries all `LOC_BUILDER_DM*_STR({})` methods: - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * We want to create backup zone files for all domains, but not actually register them. Also create a [`DefaultTTL`](/documentation/02_language_reference/domain_modifier_functions/DefaultTTL.md). + * The domain `example.com` will have the defaults set. * * ```javascript - * D("example.com","none" - * , LOC_BUILDER_STR({ - * label: "old-faithful", - * str: '44.46046°N 110.82815°W', - * alt: 2240, - * }) - * , LOC_BUILDER_STR({ - * label: "ribblehead-viaduct", - * str: '54.210436°N 2.370231°W', - * alt: 300, - * }) - * , LOC_BUILDER_STR({ - * label: "guinness-brewery", - * str: '53°20′40″N 6°17′20″W', - * alt: 300, - * }) + * var COMMON = NewDnsProvider("foo"); + * DEFAULTS( + * DnsProvider(COMMON, 0), + * DefaultTTL('1d') * ); * + * D("example.com", + * REGISTRAR, + * DnsProvider("R53"), + * A("@","1.2.3.4") + * ); * ``` * - * Part of the series: - * * [`LOC()`](../domain/LOC.md) - build a `LOC` by supplying all 12 parameters - * * [`LOC_BUILDER_DD({})`](../record/LOC_BUILDER_DD.md) - accepts cartesian x, y - * * [`LOC_BUILDER_DMS_STR({})`](../record/LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E - * * [`LOC_BUILDER_DMM_STR({})`](../record/LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E - * * [`LOC_BUILDER_STR({})`](../record/LOC_BUILDER_STR.md) - tries the cooordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works - * - * @see https://dnscontrol.org/js#LOC_BUILDER_STR - */ -declare function LOC_BUILDER_STR(label: string, str: string, alt: float32, ttl: int): RecordModifier; - -/** - * R53_ZONE lets you specify the AWS Zone ID for an entire domain (D()) or a specific R53_ALIAS() record. + * If you want to clear the defaults, you can do the following. + * The domain `example2.com` will **not** have the defaults set. * - * When used with D(), it sets the zone id of the domain. This can be used to differentiate between split horizon domains in public and private zones. + * ```javascript + * DEFAULTS(); * - * When used with R53_ALIAS() it sets the required Route53 hosted zone id in a R53_ALIAS record. See [R53_ALIAS's documentation](../domain/R53_ALIAS.md) for details. + * D("example2.com", + * REGISTRAR, + * DnsProvider("R53"), + * A("@","1.2.3.4") + * ); + * ``` * - * @see https://dnscontrol.org/js#R53_ZONE + * @see https://dnscontrol.org/js#DEFAULTS */ -declare function R53_ZONE(zone_id: string): DomainModifier & RecordModifier; +declare function DEFAULTS(...modifiers: DomainModifier[]): void; /** - * DNSControl can optimize the SPF settings on a domain by flattening - * (inlining) includes and removing duplicates. DNSControl also makes - * it easier to document your SPF configuration. - * - * WARNING: Flattening SPF includes is risky. Only flatten an SPF - * setting if it is absolutely needed to bring the number of "lookups" - * to be less than 10. In fact, it is debatable whether or not ISPs - * enforce the "10 lookup rule". + * `DOMAIN_ELSEWHERE()` is a helper macro that lets you easily indicate that + * a domain's zones are managed elsewhere. That is, it permits you easily delegate + * a domain to a hard-coded list of DNS servers. * - * ## The old way + * `DOMAIN_ELSEWHERE` is useful when you control a domain's registrar but not the + * DNS servers. For example, suppose you own a domain but the DNS servers are run + * by someone else, perhaps a SaaS product you've subscribed to or a DNS server + * that is run by your brother-in-law who doesn't trust you with the API keys that + * would let you maintain the domain using DNSControl. You need an easy way to + * point (delegate) the domain at a specific list of DNS servers. * - * Here is an example of how SPF settings are normally done: + * For example these two statements are equivalent: * * ```javascript - * D("example.tld", REG, DNS, ... - * TXT("v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 include:_spf.google.com include:mailgun.org include:spf-basic.fogcreek.com include:mail.zendesk.com include:servers.mcsv.net include:sendgrid.net include:450622.spf05.hubspotemail.net ~all") - * ) + * DOMAIN_ELSEWHERE("example.com", REG_NAMEDOTCOM, ["ns1.foo.com", "ns2.foo.com"]); * ``` * - * This has a few problems: - * - * * No comments. It is difficult to add a comment. In particular, we want to be able to list which ticket requested each item in the SPF setting so that history is retained. - * * Ugly diffs. If you add an element to the SPF setting, the diff will show the entire line changed, which is difficult to read. - * * Too many lookups. The SPF RFC says that SPF settings should not require more than 10 DNS lookups. If we manually flatten (i.e. "inline") an include, we have to remember to check back to see if the settings have changed. Humans are not good at that kind of thing. + * ```javascript + * D("example.com", REG_NAMEDOTCOM, + * NO_PURGE, + * NAMESERVER("ns1.foo.com"), + * NAMESERVER("ns2.foo.com") + * ); + * ``` * - * ## The DNSControl way + * NOTE: The [`NO_PURGE`](/documentation/02_language_reference/domain_modifier_functions/NO_PURGE.md) is used out of abundance of caution but since no + * `DnsProvider()` statements exist, no updates would be performed. + * + * @see https://dnscontrol.org/js#DOMAIN_ELSEWHERE + */ +declare function DOMAIN_ELSEWHERE(name: string, registrar: string, nameserver_names: string[]): void; + +/** + * `DOMAIN_ELSEWHERE_AUTO()` is similar to `DOMAIN_ELSEWHERE()` but instead of + * a hardcoded list of nameservers, a DnsProvider() is queried. + * + * `DOMAIN_ELSEWHERE_AUTO` is useful when you control a domain's registrar but the + * DNS zones are managed by another system. Luckily you have enough access to that + * other system that you can query it to determine the zone's nameservers. + * + * For example, suppose you own a domain but the DNS servers for it are in Azure. + * Further suppose that something in Azure maintains the zones (automatic or + * human). Azure picks the nameservers for the domains automatically, and that + * list may change occasionally. `DOMAIN_ELSEWHERE_AUTO` allows you to easily + * query Azure to determine the domain's delegations so that you do not need to + * hard-code them in your dnsconfig.js file. + * + * For example these two statements are equivalent: * * ```javascript - * D("example.tld", REG, DSP, ... - * A("@", "10.2.2.2"), - * MX("@", "example.tld."), - * SPF_BUILDER({ - * label: "@", - * overflow: "_spf%d", - * raw: "_rawspf", - * ttl: "5m", - * parts: [ - * "v=spf1", - * "ip4:198.252.206.0/24", // ny-mail* - * "ip4:192.111.0.0/24", // co-mail* - * "include:_spf.google.com", // GSuite - * "include:mailgun.org", // Greenhouse.io - * "include:spf-basic.fogcreek.com", // Fogbugz - * "include:mail.zendesk.com", // Zenddesk - * "include:servers.mcsv.net", // MailChimp - * "include:sendgrid.net", // SendGrid - * "include:450622.spf05.hubspotemail.net", // Hubspot (Ticket# SREREQ-107) - * "~all" - * ], - * flatten: [ - * "spf-basic.fogcreek.com", // Rationale: Being deprecated. Low risk if it breaks. - * "450622.spf05.hubspotemail.net" // Rationale: Unlikely to change without warning. - * ] - * }), + * DOMAIN_ELSEWHERE_AUTO("example.com", REG_NAMEDOTCOM, DSP_AZURE); + * ``` + * + * ```javascript + * D("example.com", REG_NAMEDOTCOM, + * NO_PURGE, + * DnsProvider(DSP_AZURE) * ); * ``` * - * By using the `SPF_BUILDER()` we gain many benefits: + * NOTE: The [`NO_PURGE`](/documentation/02_language_reference/domain_modifier_functions/NO_PURGE.md) is used to prevent DNSControl from changing the records. * - * * Comments can appear next to the element they refer to. - * * Diffs will be shorter and more specific; therefore easier to read. - * * Automatic flattening. We can specify which includes should be flattened and DNSControl will do the work. It will even warn us if the includes change. + * @see https://dnscontrol.org/js#DOMAIN_ELSEWHERE_AUTO + */ +declare function DOMAIN_ELSEWHERE_AUTO(name: string, domain: string, registrar: string, dnsProvider: string): void; + +/** + * `D_EXTEND` adds records (and metadata) to a domain previously defined + * by [`D()`](D.md). It can also be used to add subdomain records (and metadata) + * to a previously defined domain. * - * ## Syntax + * The first argument is a domain name. If it exactly matches a + * previously defined domain, `D_EXTEND()` behaves the same as [`D()`](D.md), + * simply adding records as if they had been specified in the original + * [`D()`](D.md). * - * When you want to specify SPF settings for a domain, use the - * `SPF_BUILDER()` function. + * If the domain name does not match an existing domain, but could be a + * (non-delegated) subdomain of an existing domain, the new records (and + * metadata) are added with the subdomain part appended to all record + * names (labels), and targets (as appropriate). See the examples below. + * + * Matching the domain name to previously-defined domains is done using a + * `longest match` algorithm. If `domain.tld` and `sub.domain.tld` are + * defined as separate domains via separate [`D()`](D.md) statements, then + * `D_EXTEND('sub.sub.domain.tld', ...)` would match `sub.domain.tld`, + * not `domain.tld`. + * + * Some operators only act on an apex domain (e.g. + * [`CF_REDIRECT`](/documentation/02_language_reference/domain_modifier_functions/service_provider_specific/cloudflare_dns/CF_REDIRECT.md) and [`CF_TEMP_REDIRECT`](/documentation/02_language_reference/domain_modifier_functions/service_provider_specific/cloudflare_dns/CF_TEMP_REDIRECT.md)). Using them + * in a `D_EXTEND` subdomain may not be what you expect. * * ```javascript - * D("example.tld", REG, DSP, ... - * ... - * ... - * ... - * SPF_BUILDER({ - * label: "@", - * overflow: "_spf%d", // Delete this line if you don't want big strings split. - * overhead1: "20", // There are 20 bytes of other TXT records on this domain. Compensate for this. - * raw: "_rawspf", // Delete this line if the default is sufficient. - * parts: [ - * "v=spf1", - * // fill in your SPF items here - * "~all" - * ], - * flatten: [ - * // fill in any domains to inline. - * ] - * }), - * ... - * ... + * D("domain.tld", REG, DnsProvider(DNS), + * A("@", "127.0.0.1"), // domain.tld + * A("www", "127.0.0.2"), // www.domain.tld + * CNAME("a", "b") // a.domain.tld -> b.domain.tld + * ); + * D_EXTEND("domain.tld", + * A("aaa", "127.0.0.3"), // aaa.domain.tld + * CNAME("c", "d") // c.domain.tld -> d.domain.tld + * ); + * D_EXTEND("sub.domain.tld", + * A("bbb", "127.0.0.4"), // bbb.sub.domain.tld + * A("ccc", "127.0.0.5"), // ccc.sub.domain.tld + * CNAME("e", "f") // e.sub.domain.tld -> f.sub.domain.tld + * ); + * D_EXTEND("sub.sub.domain.tld", + * A("ddd", "127.0.0.6"), // ddd.sub.sub.domain.tld + * CNAME("g", "h") // g.sub.sub.domain.tld -> h.sub.sub.domain.tld + * ); + * D_EXTEND("sub.domain.tld", + * A("@", "127.0.0.7"), // sub.domain.tld + * CNAME("i", "j") // i.sub.domain.tld -> j.sub.domain.tld * ); * ``` * - * The parameters are: - * - * * `label:` The label of the first TXT record. (Optional. Default: `"@"`) - * * `overflow:` If set, SPF strings longer than 255 chars will be split into multiple TXT records. The value of this setting determines the template for what the additional labels will be named. If not set, no splitting will occur and DNSControl may generate TXT strings that are too long. - * * `overhead1:` "Overhead for the 1st TXT record". When calculating the max length of each TXT record, reduce the maximum for the first TXT record in the chain by this amount. - * * `raw:` The label of the unaltered SPF settings. Setting to an empty string `''` will disable this. (Optional. Default: `"_rawspf"`) - * * `ttl:` This allows setting a specific TTL on this SPF record. (Optional. Default: using default record TTL) - * * `txtMaxSize` The maximum size for each TXT record. Values over 255 will result in [multiple strings][multi-string]. General recommendation is to [not go higher than 450][record-size] so that DNS responses will still fit in a UDP packet. (Optional. Default: `"255"`) - * * `parts:` The individual parts of the SPF settings. - * * `flatten:` Which includes should be inlined. For safety purposes the flattening is done on an opt-in basis. If `"*"` is listed, all includes will be flattened... this might create more problems than is solves due to length limitations. + * This will end up in the following modifications: (This output assumes the `--full` flag) * - * [multi-string]: https://tools.ietf.org/html/rfc4408#section-3.1.3 - * [record-size]: https://tools.ietf.org/html/rfc4408#section-3.1.4 + * ```text + * ******************** Domain: domain.tld + * ----- Getting nameservers from: cloudflare + * ----- DNS Provider: cloudflare...7 corrections + * #1: CREATE A aaa.domain.tld 127.0.0.3 + * #2: CREATE A bbb.sub.domain.tld 127.0.0.4 + * #3: CREATE A ccc.sub.domain.tld 127.0.0.5 + * #4: CREATE A ddd.sub.sub.domain.tld 127.0.0.6 + * #5: CREATE A sub.domain.tld 127.0.0.7 + * #6: CREATE A www.domain.tld 127.0.0.2 + * #7: CREATE A domain.tld 127.0.0.1 + * #8: CREATE CNAME a.domain.tld b.domain.tld. + * #9: CREATE CNAME c.domain.tld d.domain.tld. + * #10: CREATE CNAME e.sub.domain.tld f.sub.domain.tld. + * #11: CREATE CNAME g.sub.sub.domain.tld h.sub.sub.domain.tld. + * #12: CREATE CNAME i.sub.domain.tld j.sub.domain.tld. + * ``` * - * `SPF_BUILDER()` returns multiple `TXT()` records: + * ProTips: `D_EXTEND()` permits you to create very complex and + * sophisticated configurations, but you shouldn't. Be nice to the next + * person that edits the file, who may not be as expert as yourself. + * Enhance readability by putting any `D_EXTEND()` statements immediately + * after the original [`D()`](D.md), like in above example. Avoid the temptation + * to obscure the addition of records to existing domains with randomly + * placed `D_EXTEND()` statements. Don't build up a domain using loops of + * `D_EXTEND()` statements. You'll be glad you didn't. * - * * `TXT("@", "v=spf1 .... ~all")` - * * This is the optimized configuration. - * * `TXT("_spf1", "...")` - * * If the optimizer needs to split a long string across multiple TXT records, the additional TXT records will have labels `_spf1`, `_spf2`, `_spf3`, etc. - * * `TXT("_rawspf", "v=spf1 .... ~all")` - * * This is the unaltered SPF configuration. This is purely for debugging purposes and is not used by any email or anti-spam system. It is only generated if flattening is requested. + * @see https://dnscontrol.org/js#D_EXTEND + */ +declare function D_EXTEND(name: string, ...modifiers: DomainModifier[]): void; + +/** + * Converts an IPv4 address from string to an integer. This allows performing mathematical operations with the IP address. * - * We recommend first using this without any flattening. Make sure - * `dnscontrol preview` works as expected. Once that is done, add the - * flattening required to reduce the number of lookups to 10 or less. + * ```javascript + * var addrA = IP('1.2.3.4') + * var addrB = addrA + 1 + * // addrB = 1.2.3.5 + * ``` * - * To count the number of lookups, you can use our interactive SPF - * debugger at [https://stackexchange.github.io/dnscontrol/flattener/index.html](https://stackexchange.github.io/dnscontrol/flattener/index.html) + * NOTE: `IP()` does not accept IPv6 addresses (PRs gladly accepted!). IPv6 addresses are simply strings: * - * # The first in a chain is special + * ```javascript + * // IPv4 Var + * var addrA1 = IP("1.2.3.4"); + * var addrA2 = "1.2.3.4"; * - * When generating the chain of SPF - * records, each one is max length 255. For the first item in - * the chain, the max is 255 - "overhead1". Setting this to 255 or - * higher has undefined behavior. + * // IPv6 Var + * var addrAAAA = "0:0:0:0:0:0:0:0"; + * ``` * - * Why is this useful? + * @see https://dnscontrol.org/js#IP + */ +declare function IP(ip: string): number; + +/** + * NewDnsProvider activates a DNS Service Provider (DSP) specified in `creds.json`. + * A DSP stores a DNS zone's records and provides DNS service for the zone (i.e. + * answers on port 53 to queries related to the zone). * - * Some sites desire having all DNS queries fit in a single packet so - * that UDP, not TCP, can be used to satisfy all requests. That means all - * responses have to be relatively small. + * * `name` must match the name of an entry in `creds.json`. + * * `type` specifies a valid DNS provider type identifier listed on the [provider page](../../providers.md). + * * Starting with [v3.16](../../v316.md), the type is optional. If it is absent, the `TYPE` field in `creds.json` is used instead. You can leave it out. (Thanks to JavaScript magic, you can leave it out even when there are more fields). + * * Starting with v4.0, specifying the type may be an error. Please add the `TYPE` field to `creds.json` and remove this parameter from `dnsconfig.js` to prepare. + * * `meta` is a way to send additional parameters to the provider. It is optional and only certain providers use it. See the [individual provider docs](../../providers.md) for details. * - * When an SPF system does a "TXT" lookup, it gets SPF and non-SPF - * records. This makes the first link in the chain extra large. + * This function will return an opaque string that should be assigned to a variable name for use in [D](D.md) directives. * - * The bottom line is that if you want the TXT records to fit in a UDP - * packet, keep increasing the value of `overhead1` until the packet - * is no longer truncated. + * Prior to [v3.16](../../v316.md): * - * Example: + * ```javascript + * var REG_MYNDC = NewRegistrar("mynamedotcom", "NAMEDOTCOM"); + * var DNS_MYAWS = NewDnsProvider("myaws", "ROUTE53"); * - * ```shell - * dig +short whatexit.org txt | wc -c - * 118 + * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), + * A("@","1.2.3.4") + * ); * ``` * - * Setting `overhead1` to 118 should be sufficient. + * In [v3.16](../../v316.md) and later: * - * ```shell - * dig +short stackoverflow.com txt | wc -c - * 582 + * ```javascript + * var REG_MYNDC = NewRegistrar("mynamedotcom"); + * var DNS_MYAWS = NewDnsProvider("myaws"); + * + * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), + * A("@","1.2.3.4") + * ); * ``` * - * Since 582 is bigger than 255, it might not be possible to achieve the - * goal. Any value larger than 255 will disable all flattening. Try - * 170, then 180, 190 until you get the desired results. + * @see https://dnscontrol.org/js#NewDnsProvider + */ +declare function NewDnsProvider(name: string, type?: string, meta?: object): string; + +/** + * NewRegistrar activates a Registrar Provider specified in `creds.json`. + * A registrar maintains the domain's registration and delegation (i.e. the + * nameservers for the domain). DNSControl only manages the delegation. * - * A validator such as - * [https://www.kitterman.com/spf/validate.html](https://www.kitterman.com/spf/validate.html) - * will tell you if the queries are being truncated and TCP was required - * to get the entire record. (Sadly it caches heavily.) + * * `name` must match the name of an entry in `creds.json`. + * * `type` specifies a valid DNS provider type identifier listed on the [provider page](../../providers.md). + * * Starting with [v3.16](../../v316.md), the type is optional. If it is absent, the `TYPE` field in `creds.json` is used instead. You can leave it out. (Thanks to JavaScript magic, you can leave it out even when there are more fields). + * * Starting with v4.0, specifying the type may be an error. Please add the `TYPE` field to `creds.json` and remove this parameter from `dnsconfig.js` to prepare. + * * `meta` is a way to send additional parameters to the provider. It is optional and only certain providers use it. See the [individual provider docs](../../providers.md) for details. * - * ## Notes about the `spfcache.json` + * This function will return an opaque string that should be assigned to a variable name for use in [D](D.md) directives. * - * DNSControl keeps a cache of the DNS lookups performed during - * optimization. The cache is maintained so that the optimizer does - * not produce different results depending on the ups and downs of - * other people's DNS servers. This makes it possible to do `dnscontrol - * push` even if your or third-party DNS servers are down. + * Prior to [v3.16](../../v316.md): * - * The DNS cache is kept in a file called `spfcache.json`. If it needs - * to be updated, the proper data will be written to a file called - * `spfcache.updated.json` and instructions such as the ones below - * will be output telling you exactly what to do: + * ```javascript + * var REG_MYNDC = NewRegistrar("mynamedotcom", "NAMEDOTCOM"); + * var DNS_MYAWS = NewDnsProvider("myaws", "ROUTE53"); * - * ```shell - * dnscontrol preview - * 1 Validation errors: - * WARNING: 2 spf record lookups are out of date with cache (_spf.google.com,_netblocks3.google.com). - * Wrote changes to spfcache.updated.json. Please rename and commit: - * $ mv spfcache.updated.json spfcache.json - * $ git commit spfcache.json + * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), + * A("@","1.2.3.4") + * ); * ``` * - * In this case, you are being asked to replace `spfcache.json` with - * the newly generated data in `spfcache.updated.json`. + * In [v3.16](../../v316.md) and later: * - * Needing to do this kind of update is considered a validation error - * and will block `dnscontrol push` from running. + * ```javascript + * var REG_MYNDC = NewRegistrar("mynamedotcom"); + * var DNS_MYAWS = NewDnsProvider("myaws"); * - * Note: The instructions are hardcoded strings. The filenames will - * not change. + * D("example.com", REG_MYNDC, DnsProvider(DNS_MYAWS), + * A("@","1.2.3.4") + * ); + * ``` * - * Note: The instructions assume you use git. If you use something - * else, please do the appropriate equivalent command. + * @see https://dnscontrol.org/js#NewRegistrar + */ +declare function NewRegistrar(name: string, type?: string, meta?: object): string; + +/** + * `PANIC` terminates the script and therefore DNSControl with an exit code of 1. This should be used if your script cannot gather enough information to generate records, for example when a HTTP request failed. * - * ## Caveats + * ```javascript + * PANIC("Something really bad has happened"); + * ``` * - * 1. DNSControl 'gives up' if it sees SPF records it can't understand. - * This includes: syntax errors, features that our spflib doesn't know - * about, overly complex SPF settings, and anything else that we we - * didn't feel like implementing. + * @see https://dnscontrol.org/js#PANIC + */ +declare function PANIC(message: string): never; + +/** + * `REV` returns the reverse lookup domain for an IP network. For + * example `REV('1.2.3.0/24')` returns `3.2.1.in-addr.arpa.` and + * `REV('2001:db8:302::/48)` returns `2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.`. + * This is used in [`D()`](D.md) functions to create reverse DNS lookup zones. * - * 2. The TXT record that is generated may exceed DNS limits. dnscontrol - * will not generate a single TXT record that exceeds DNS limits, but - * it ignores the fact that there may be other TXT records on the same - * label. For example, suppose it generates a TXT record on the bare - * domain (stackoverflow.com) that is 250 bytes long. That's fine and - * doesn't require a continuation record. However if there is another - * TXT record (not an SPF record, perhaps a TXT record used to verify - * domain ownership), the total packet size of all the TXT records - * could exceed 512 bytes, and will require EDNS or a TCP request. + * This is a convenience function. You could specify `D('3.2.1.in-addr.arpa', + * ...` if you like to do things manually but why would you risk making + * typos? * - * 3. DNSControl does not warn if the number of lookups exceeds 10. - * We hope to implement this some day. + * `REV` complies with RFC2317, "Classless in-addr.arpa delegation" + * for netmasks of size /25 through /31. + * While the RFC permits any format, we abide by the recommended format: + * `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address + * of the zone, `MASK` is the netmask of the zone (25-31 inclusive), + * and A, B, C are the first 3 octets of the IP address. For example + * `172.20.18.130/27` is located in a zone named + * `128/27.18.20.172.in-addr.arpa` * - * 4. The `redirect=` directive is only partially implemented. We only - * handle the case where redirect is the last item in the SPF record. - * In which case, it is equivalent to `include:`. + * If the address does not include a "/" then `REV` assumes /32 for IPv4 addresses + * and /128 for IPv6 addresses. * - * ## Advanced Technique: Interactive SPF Debugger + * Note that the lower bits (the ones outside the netmask) must be zeros. They are not + * zeroed out automatically. Thus, `REV('1.2.3.4/24')` is an error. This is done + * to catch typos. * - * DNSControl includes an experimental system for viewing - * SPF settings: + * ```javascript + * D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND), + * PTR("1", 'foo.example.com.'), + * PTR("2", 'bar.example.com.'), + * PTR("3", 'baz.example.com.'), + * // These take advantage of DNSControl's ability to generate the right name: + * PTR("1.2.3.10", 'ten.example.com.'), + * ); * - * [https://stackexchange.github.io/dnscontrol/flattener/index.html](https://stackexchange.github.io/dnscontrol/flattener/index.html) + * D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND), + * PTR("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0", 'foo.example.com.'), // 2001:db8:302::1 + * // These take advantage of DNSControl's ability to generate the right name: + * PTR("2001:db8:302::2", 'two.example.com.'), // 2.0.0... + * PTR("2001:db8:302::3", 'three.example.com.'), // 3.0.0... + * ); + * ``` * - * You can also run this locally (it is self-contained) by opening - * `dnscontrol/docs/flattener/index.html` in your browser. + * In the future we plan on adding a flag to [`A()`](/documentation/02_language_reference/domain_modifier_functions/A.md)which will insert + * the correct PTR() record in the appropriate `D(REV())` domain (i.e. `.arpa` domain) has been + * defined. * - * You can use this to determine the minimal number of domains you - * need to flatten to have fewer than 10 lookups. + * @see https://dnscontrol.org/js#REV + */ +declare function REV(address: string): string; + +/** + * `getConfiguredDomains` getConfiguredDomains is a helper function that returns the domain names + * configured at the time the function is called. Calling this function early or later in + * `dnsconfig.js` may return different results. Typical usage is to iterate over all + * domains at the end of your configuration file. * - * The output is as follows: + * Example for adding records to all configured domains: + * ```javascript + * var domains = getConfiguredDomains(); + * for(i = 0; i < domains.length; i++) { + * D_EXTEND(domains[i], + * TXT('_important', 'BLA') // I know, not really creative. + * ) + * } + * ``` * - * 1. The top part lists the domain as it current is configured, how - * many lookups it requires, and includes a checkbox for each item - * that could be flattened. + * This will end up in following modifications: (All output assumes the `--full` flag) * - * 2. Fully flattened: This section shows the SPF configuration if you - * fully flatten it. i.e. This is what it would look like if all the - * checkboxes were checked. Note that this result is likely to be - * longer than 255 bytes, the limit for a single TXT string. + * ```text + * ******************** Domain: domain1.tld + * ----- Getting nameservers from: registrar + * ----- DNS Provider: registrar...2 corrections + * #1: CREATE TXT _important.domain1.tld "BLA" ttl=43200 + * #2: REFRESH zone domain1.tld * - * 3. Fully flattened split: This takes the "fully flattened" result - * and splits it into multiple DNS records. To continue to the next - * record an include is added. + * ******************** Domain: domain2.tld + * ----- Getting nameservers from: registrar + * ----- DNS Provider: registrar...2 corrections + * #1: CREATE TXT _important.domain2.tld "BLA" ttl=43200 + * #2: REFRESH zone domain2.tld + * ``` * - * ## Advanced Technique: Define once, use many + * Example for adding DMARC report records: * - * In some situations we define an SPF setting once and want to re-use - * it on many domains. Here's how to do this: + * This example might be more useful, specially for configuring the DMARC report records. According to DMARC RFC you need to specify `domain2.tld._report.dmarc.domain1.tld` to allow `domain2.tld` to send aggregate/forensic email reports to `domain1.tld`. This can be used to do this in an easy way, without using the wildcard from the RFC. * * ```javascript - * var SPF_MYSETTINGS = SPF_BUILDER({ - * label: "@", - * overflow: "_spf%d", - * raw: "_rawspf", - * parts: [ - * "v=spf1", - * ... - * "~all" - * ], - * flatten: [ - * ... - * ] - * }); + * var domains = getConfiguredDomains(); + * for(i = 0; i < domains.length; i++) { + * D_EXTEND("domain1.tld", + * TXT(domains[i] + '._report._dmarc', 'v=DMARC1') + * ); + * } + * ``` * - * D("example.tld", REG, DSP, ... - * SPF_MYSETTINGS - * ); + * This will end up in following modifications: * - * D("example2.tld", REG, DSP, ... - * SPF_MYSETTINGS - * ); + * ```text + * ******************** Domain: domain2.tld + * ----- Getting nameservers from: registrar + * ----- DNS Provider: registrar...4 corrections + * #1: CREATE TXT domain1.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 + * #2: CREATE TXT domain3.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 + * #3: CREATE TXT domain4.tld._report._dmarc.domain2.tld "v=DMARC1" ttl=43200 + * #4: REFRESH zone domain2.tld * ``` * - * @see https://dnscontrol.org/js#SPF_BUILDER + * @see https://dnscontrol.org/js#getConfiguredDomains */ -declare function SPF_BUILDER(opts: { label?: string; overflow?: string; overhead1?: string; raw?: string; ttl?: Duration; txtMaxSize: string[]; parts?: number; flatten?: string[] }): RecordModifier; +declare function getConfiguredDomains(): string[]; /** - * TTL sets the TTL for a single record only. This will take precedence - * over the domain's [DefaultTTL](../domain/DefaultTTL.md) if supplied. + * `require_glob()` can recursively load `.js` files, optionally non-recursive as well. * - * The value can be: + * Possible parameters are: * - * * An integer (number of seconds). Example: `600` - * * A string: Integer with single-letter unit: Example: `5m` - * * The unit denotes: - * * s (seconds) - * * m (minutes) - * * h (hours) - * * d (days) - * * w (weeks) - * * n (nonths) (30 days in a nonth) - * * y (years) (If you set a TTL to a year, we assume you also do crossword puzzles in pen. Show off!) - * * If no unit is specified, the default is seconds. - * * We highly recommend using units instead of the number of seconds. Would your coworkers understand your intention better if you wrote `14400` or `'4h'`? + * - Path as string, where you would like to start including files. Mandatory. Pattern matching possible, see [GoLand path/filepath/#Match docs](https://golang.org/pkg/path/filepath/#Match). + * - If being recursive. This is a boolean if the search should be recursive or not. Define either `true` or `false`. Default is `true`. + * + * Example to load `.js` files recursively: * * ```javascript - * D('example.com', REGISTRAR, DnsProvider('R53'), - * DefaultTTL(2000), - * A('@','1.2.3.4'), // uses default - * A('foo', '2.3.4.5', TTL(500)), // overrides default - * A('demo1', '3.4.5.11', TTL('5d')), // 5 days - * A('demo2', '3.4.5.12', TTL('5w')), // 5 weeks - * ); + * require_glob("./domains/"); * ``` * - * @see https://dnscontrol.org/js#TTL + * Example to load `.js` files only in `domains/`: + * + * ```javascript + * require_glob("./domains/", false); + * ``` + * + * One more important thing to note: `require_glob()` is as smart as `require()` is. It loads files always relative to the JavaScript + * file where it's being executed in. Let's go with an example, as it describes it better: + * + * ```javascript + * require("domains/index.js"); + * ``` + * + * ```javascript + * require_glob("./user1/"); + * ``` + * + * This will now load files being present underneath `./domains/user1/` and **NOT** at below `./domains/`, as `require_glob()` + * is called in the subfolder `domains/`. + * + * @see https://dnscontrol.org/js#require_glob */ -declare function TTL(ttl: Duration): RecordModifier; +declare function require_glob(path: string, recursive: boolean): void; diff --git a/documentation/SUMMARY.md b/documentation/SUMMARY.md index ecc8c21aa1..69eac0ac13 100644 --- a/documentation/SUMMARY.md +++ b/documentation/SUMMARY.md @@ -4,171 +4,170 @@ -## Getting Started - -* [Overview](getting-started.md) -* [Examples](examples.md) -* [Migrating zones to DNSControl](migrating.md) -* [TypeScript autocomplete and type checking](typescript.md) - -## Language Reference - -* [JavaScript DSL](js.md) -* Top Level Functions - * [D](functions/global/D.md) - * [DEFAULTS](functions/global/DEFAULTS.md) - * [DOMAIN_ELSEWHERE](functions/global/DOMAIN_ELSEWHERE.md) - * [DOMAIN_ELSEWHERE_AUTO](functions/global/DOMAIN_ELSEWHERE_AUTO.md) - * [D_EXTEND](functions/global/D_EXTEND.md) - * [FETCH](functions/global/FETCH.md) - * [IP](functions/global/IP.md) - * [NewDnsProvider](functions/global/NewDnsProvider.md) - * [NewRegistrar](functions/global/NewRegistrar.md) - * [PANIC](functions/global/PANIC.md) - * [REV](functions/global/REV.md) - * [getConfiguredDomains](functions/global/getConfiguredDomains.md) - * [require](functions/global/require.md) - * [require_glob](functions/global/require_glob.md) -* Domain Modifiers - * [A](functions/domain/A.md) - * [AAAA](functions/domain/AAAA.md) - * [ALIAS](functions/domain/ALIAS.md) - * [AUTODNSSEC_OFF](functions/domain/AUTODNSSEC_OFF.md) - * [AUTODNSSEC_ON](functions/domain/AUTODNSSEC_ON.md) - * [CAA](functions/domain/CAA.md) - * [CNAME](functions/domain/CNAME.md) - * [DS](functions/domain/DS.md) - * [DefaultTTL](functions/domain/DefaultTTL.md) - * [DnsProvider](functions/domain/DnsProvider.md) - * [FRAME](functions/domain/FRAME.md) - * [IGNORE](functions/domain/IGNORE.md) - * [IGNORE_NAME](functions/domain/IGNORE_NAME.md) - * [IGNORE_TARGET](functions/domain/IGNORE_TARGET.md) - * [IMPORT_TRANSFORM](functions/domain/IMPORT_TRANSFORM.md) - * [INCLUDE](functions/domain/INCLUDE.md) - * [LOC](functions/domain/LOC.md) - * [MX](functions/domain/MX.md) - * [NAMESERVER](functions/domain/NAMESERVER.md) - * [NAMESERVER_TTL](functions/domain/NAMESERVER_TTL.md) - * [NAPTR](functions/domain/NAPTR.md) - * [NO_PURGE](functions/domain/NO_PURGE.md) - * [NS](functions/domain/NS.md) - * [PTR](functions/domain/PTR.md) - * [PURGE](functions/domain/PURGE.md) - * [SOA](functions/domain/SOA.md) - * [SRV](functions/domain/SRV.md) - * [SSHFP](functions/domain/SSHFP.md) - * [TLSA](functions/domain/TLSA.md) - * [TXT](functions/domain/TXT.md) - * [URL](functions/domain/URL.md) - * [URL301](functions/domain/URL301.md) - * Service Provider specific - * Akamai Edge Dns - * [AKAMAICDN](functions/domain/AKAMAICDN.md) - * Amazon Route 53 - * [R53_ALIAS](functions/domain/R53_ALIAS.md) - * Azure DNS - * [AZURE_ALIAS](functions/domain/AZURE_ALIAS.md) - * Cloudflare DNS - * [CF_REDIRECT](functions/domain/CF_REDIRECT.md) - * [CF_TEMP_REDIRECT](functions/domain/CF_TEMP_REDIRECT.md) - * [CF_WORKER_ROUTE](functions/domain/CF_WORKER_ROUTE.md) - * ClouDNS - * [CLOUDNS_WR](functions/domain/CLOUDNS_WR.md) - * NS1 - * [NS1_URLFWD](functions/domain/NS1_URLFWD.md) -* Record Modifiers - * [CAA_BUILDER](functions/record/CAA_BUILDER.md) - * [DMARC_BUILDER](functions/record/DMARC_BUILDER.md) - * [LOC_BUILDER_DD](functions/record/LOC_BUILDER_DD.md) - * [LOC_BUILDER_DMM_STR](functions/record/LOC_BUILDER_DMM_STR.md) - * [LOC_BUILDER_DMS_STR](functions/record/LOC_BUILDER_DMS_STR.md) - * [LOC_BUILDER_STR](functions/record/LOC_BUILDER_STR.md) - * [SPF_BUILDER](functions/record/SPF_BUILDER.md) - * [TTL](functions/record/TTL.md) - * Service Provider specific - * Amazon Route 53 - * [R53_ZONE](functions/record/R53_ZONE.md) -* [Why CNAME/MX/NS targets require a "dot"](why-the-dot.md) - -## Service Providers - -* [Providers](providers.md) - * [Akamai Edge DNS](providers/akamaiedgedns.md) - * [Amazon Route 53](providers/route53.md) - * [AutoDNS](providers/autodns.md) - * [AXFR+DDNS](providers/axfrddns.md) - * [Azure DNS](providers/azure_dns.md) - * [BIND](providers/bind.md) - * [Cloudflare](providers/cloudflareapi.md) - * [ClouDNS](providers/cloudns.md) - * [CSC Global](providers/cscglobal.md) - * [deSEC](providers/desec.md) - * [DigitalOcean](providers/digitalocean.md) - * [DNS Made Simple](providers/dnsmadeeasy.md) - * [DNSimple](providers/dnsimple.md) - * [DNS-over-HTTPS](providers/dnsoverhttps.md) - * [DOMAINNAMESHOP](providers/domainnameshop.md) - * [easyname](providers/easyname.md) - * [Gandi_v5](providers/gandi_v5.md) - * [Gcore](providers/gcore.md) - * [Google Cloud DNS](providers/gcloud.md) - * [Hetzner DNS Console](providers/hetzner.md) - * [HEXONET](providers/hexonet.md) - * [hosting.de](providers/hostingde.md) - * [Hurricane Electric DNS](providers/hedns.md) - * [Internet.bs](providers/internetbs.md) - * [INWX](providers/inwx.md) - * [Linode](providers/linode.md) - * [Loopia](providers/loopia.md) - * [LuaDNS](providers/luadns.md) - * [Microsoft DNS Server on Microsoft Windows Server](providers/msdns.md) - * [Namecheap](providers/namecheap.md) - * [Name.com](providers/namedotcom.md) - * [Netcup](providers/netcup.md) - * [Netlify](providers/netlify.md) - * [NS1](providers/ns1.md) - * [Oracle Cloud](providers/oracle.md) - * [OVH](providers/ovh.md) - * [Packetframe](providers/packetframe.md) - * [Porkbun](providers/porkbun.md) - * [PowerDNS](providers/powerdns.md) - * [RWTH DNS-Admin](providers/rwth.md) - * [SoftLayer DNS](providers/softlayer.md) - * [TransIP](providers/transip.md) - * [Vultr](providers/vultr.md) -## Commands - -* [creds.json](creds-json.md) -* [check-creds](check-creds.md) -* [get-certs](get-certs.md) -* [get-zones](get-zones.md) - -## Advanced features +## 01 Getting Started + * [Examples](01_getting_started/examples.md) + * [Getting Started](01_getting_started/getting_started.md) + * [Migrating Zones To Dnscontrol](01_getting_started/migrating_zones_to_dnscontrol.md) + * [TypeScript Autocomplete And Type Checking](01_getting_started/typeScript_autocomplete_and_type_checking.md) + + +## 02 Language Reference + * [JavaScript DSL](02_language_reference/JavaScript_DSL.md) + * [Why CNAME, MX, S Targets Require The Final "."](02_language_reference/Why_CNAME,_MX,_S_targets_require_the_final_".".md) + * Domain Modifier Functions + * [A](02_language_reference/domain_modifier_functions/A.md) + * [AAAA](02_language_reference/domain_modifier_functions/AAAA.md) + * [ALIAS](02_language_reference/domain_modifier_functions/ALIAS.md) + * [AUTODNSSEC_OFF](02_language_reference/domain_modifier_functions/AUTODNSSEC_OFF.md) + * [AUTODNSSEC_ON](02_language_reference/domain_modifier_functions/AUTODNSSEC_ON.md) + * [CAA](02_language_reference/domain_modifier_functions/CAA.md) + * [CNAME](02_language_reference/domain_modifier_functions/CNAME.md) + * [DefaultTTL](02_language_reference/domain_modifier_functions/DefaultTTL.md) + * [DnsProvider](02_language_reference/domain_modifier_functions/DnsProvider.md) + * [DS](02_language_reference/domain_modifier_functions/DS.md) + * [FRAME](02_language_reference/domain_modifier_functions/FRAME.md) + * [IGNORE](02_language_reference/domain_modifier_functions/IGNORE.md) + * [IGNORE_NAME](02_language_reference/domain_modifier_functions/IGNORE_NAME.md) + * [IGNORE_TARGET](02_language_reference/domain_modifier_functions/IGNORE_TARGET.md) + * [IMPORT_TRANSFORM](02_language_reference/domain_modifier_functions/IMPORT_TRANSFORM.md) + * [INCLUDE](02_language_reference/domain_modifier_functions/INCLUDE.md) + * [LOC](02_language_reference/domain_modifier_functions/LOC.md) + * [MX](02_language_reference/domain_modifier_functions/MX.md) + * [NAMESERVER](02_language_reference/domain_modifier_functions/NAMESERVER.md) + * [NAMESERVER_TTL](02_language_reference/domain_modifier_functions/NAMESERVER_TTL.md) + * [NAPTR](02_language_reference/domain_modifier_functions/NAPTR.md) + * [NO_PURGE](02_language_reference/domain_modifier_functions/NO_PURGE.md) + * [NS](02_language_reference/domain_modifier_functions/NS.md) + * [PTR](02_language_reference/domain_modifier_functions/PTR.md) + * [PURGE](02_language_reference/domain_modifier_functions/PURGE.md) + * [SOA](02_language_reference/domain_modifier_functions/SOA.md) + * [SRV](02_language_reference/domain_modifier_functions/SRV.md) + * [SSHFP](02_language_reference/domain_modifier_functions/SSHFP.md) + * [TLSA](02_language_reference/domain_modifier_functions/TLSA.md) + * [TXT](02_language_reference/domain_modifier_functions/TXT.md) + * [URL](02_language_reference/domain_modifier_functions/URL.md) + * [URL301](02_language_reference/domain_modifier_functions/URL301.md) + * Service Provider Specific + * Akamai Edge Dns + * [AKAMAICDN](02_language_reference/domain_modifier_functions/service_provider_specific/akamai_edge_dns/AKAMAICDN.md) + * Amazon Route 53 + * [R53_ALIAS](02_language_reference/domain_modifier_functions/service_provider_specific/amazon_route_53/R53_ALIAS.md) + * Azure Dns + * [AZURE_ALIAS](02_language_reference/domain_modifier_functions/service_provider_specific/azure_dns/AZURE_ALIAS.md) + * Cloudflare Dns + * [CF_REDIRECT](02_language_reference/domain_modifier_functions/service_provider_specific/cloudflare_dns/CF_REDIRECT.md) + * [CF_TEMP_REDIRECT](02_language_reference/domain_modifier_functions/service_provider_specific/cloudflare_dns/CF_TEMP_REDIRECT.md) + * [CF_WORKER_ROUTE](02_language_reference/domain_modifier_functions/service_provider_specific/cloudflare_dns/CF_WORKER_ROUTE.md) + * ClouDNS + * [CLOUDNS_WR](02_language_reference/domain_modifier_functions/service_provider_specific/ClouDNS/CLOUDNS_WR.md) + * NS1 + * [NS1_URLFWD](02_language_reference/domain_modifier_functions/service_provider_specific/NS1/NS1_URLFWD.md) + * Record Modifier Functions + * [CAA_BUILDER](02_language_reference/record_modifier_functions/CAA_BUILDER.md) + * [DMARC_BUILDER](02_language_reference/record_modifier_functions/DMARC_BUILDER.md) + * [LOC_BUILDER_DD](02_language_reference/record_modifier_functions/LOC_BUILDER_DD.md) + * [LOC_BUILDER_DMM_STR](02_language_reference/record_modifier_functions/LOC_BUILDER_DMM_STR.md) + * [LOC_BUILDER_DMS_STR](02_language_reference/record_modifier_functions/LOC_BUILDER_DMS_STR.md) + * [LOC_BUILDER_STR](02_language_reference/record_modifier_functions/LOC_BUILDER_STR.md) + * [SPF_BUILDER](02_language_reference/record_modifier_functions/SPF_BUILDER.md) + * [TTL](02_language_reference/record_modifier_functions/TTL.md) + * Service Provider Specific + * Amazon Route 53 + * [R53_ZONE](02_language_reference/record_modifier_functions/service_provider_specific/amazon_route_53/R53_ZONE.md) + * Top Level Functions + * [D](02_language_reference/top_level_functions/D.md) + * [D_EXTEND](02_language_reference/top_level_functions/D_EXTEND.md) + * [DEFAULTS](02_language_reference/top_level_functions/DEFAULTS.md) + * [DOMAIN_ELSEWHERE](02_language_reference/top_level_functions/DOMAIN_ELSEWHERE.md) + * [DOMAIN_ELSEWHERE_AUTO](02_language_reference/top_level_functions/DOMAIN_ELSEWHERE_AUTO.md) + * [FETCH](02_language_reference/top_level_functions/FETCH.md) + * [getConfiguredDomains](02_language_reference/top_level_functions/getConfiguredDomains.md) + * [IP](02_language_reference/top_level_functions/IP.md) + * [NewDnsProvider](02_language_reference/top_level_functions/NewDnsProvider.md) + * [NewRegistrar](02_language_reference/top_level_functions/NewRegistrar.md) + * [PANIC](02_language_reference/top_level_functions/PANIC.md) + * [require](02_language_reference/top_level_functions/require.md) + * [require_glob](02_language_reference/top_level_functions/require_glob.md) + * [REV](02_language_reference/top_level_functions/REV.md) + + +## Advanced Features + * [CI-CD Example For GitLab](advanced_features/CI-CD_example_for_GitLab.md) + * [CLI Variables](advanced_features/CLI_variables.md) + * [Code Tricks](advanced_features/code_tricks.md) + * [Nameservers](advanced_features/nameservers.md) + * [Notifications](advanced_features/notifications.md) -* [CI/CD example for GitLab](ci-cd-gitlab.md) -* [CLI variables](cli-variables.md) -* [Nameservers and Delegations](nameservers.md) -* [Notifications](notifications.md) -* [Useful code tricks](code-tricks.md) -## Developer info +## Commands + * [Check-Creds](commands/check-creds.md) + * [Creds-Json](commands/creds-json.md) + * [Get-Certs](commands/get-certs.md) + * [Get-Zones](commands/get-zones.md) + + +## Developer Info + * [ALIAS Records](developer_info/ALIAS_records.md) + * [Bring-Your-Own-Secrets](developer_info/bring-your-own-secrets.md) + * [Bug Triage Process](developer_info/bug_triage_process.md) + * [Creating New DNS Resource Types (Rtypes)](developer_info/creating_new_DNS_resource_types_(rtypes).md) + * [Debugging With Dlv](developer_info/debugging_with_dlv.md) + * [DNSControl Is An Opinionated System](developer_info/DNSControl_is_an_opinionated_system.md) + * [Integration Tests](developer_info/integration_tests.md) + * [TXT Record Testing](developer_info/TXT_record_testing.md) + * [Unit Testing Dns Data](developer_info/unit_testing_dns_data.md) + * [Writing New Providers](developer_info/writing_new_providers.md) + + +## Providers + * [Providers](providers/providers.md) + * [Autodns](providers/providers/autodns.md) + * [Axfrddns](providers/providers/axfrddns.md) + * [Azure Dns](providers/providers/azure_dns.md) + * [Bind](providers/providers/bind.md) + * [Cloudflareapi](providers/providers/cloudflareapi.md) + * [Cloudns](providers/providers/cloudns.md) + * [Cscglobal](providers/providers/cscglobal.md) + * [Desec](providers/providers/desec.md) + * [Digitalocean](providers/providers/digitalocean.md) + * [Dnsimple](providers/providers/dnsimple.md) + * [Dnsmadeeasy](providers/providers/dnsmadeeasy.md) + * [Dnsoverhttps](providers/providers/dnsoverhttps.md) + * [Domainnameshop](providers/providers/domainnameshop.md) + * [Easyname](providers/providers/easyname.md) + * [Gandi V5](providers/providers/gandi_v5.md) + * [Gcloud](providers/providers/gcloud.md) + * [Gcore](providers/providers/gcore.md) + * [Hedns](providers/providers/hedns.md) + * [Hetzner](providers/providers/hetzner.md) + * [Hexonet](providers/providers/hexonet.md) + * [Hostingde](providers/providers/hostingde.md) + * [Internetbs](providers/providers/internetbs.md) + * [Inwx](providers/providers/inwx.md) + * [Linode](providers/providers/linode.md) + * [Loopia](providers/providers/loopia.md) + * [Luadns](providers/providers/luadns.md) + * [Msdns](providers/providers/msdns.md) + * [Namecheap](providers/providers/namecheap.md) + * [Namedotcom](providers/providers/namedotcom.md) + * [Netcup](providers/providers/netcup.md) + * [Netlify](providers/providers/netlify.md) + * [Ns1](providers/providers/ns1.md) + * [Oracle](providers/providers/oracle.md) + * [Ovh](providers/providers/ovh.md) + * [Packetframe](providers/providers/packetframe.md) + * [Porkbun](providers/providers/porkbun.md) + * [Powerdns](providers/providers/powerdns.md) + * [Route53](providers/providers/route53.md) + * [Rwth](providers/providers/rwth.md) + * [Softlayer](providers/providers/softlayer.md) + * [Transip](providers/providers/transip.md) + * [Vultr](providers/providers/vultr.md) -* [ALIAS Records](alias.md) -* [Bug Triage Process](bug-triage.md) -* [Bring-Your-Own-Secrets for automated testing](byo-secrets.md) -* [Writing new DNS providers](writing-providers.md) -* [Creating new DNS Resource Types (rtypes)](adding-new-rtypes.md) -* [TXT record testing](testing-txt-records.md) -* [Unit Testing DNS Data](unittests.md) -* [Integration Tests](integration-tests.md) -* [Debugging with dlv](debugging-with-dlv.md) -* [DNSControl is an opinionated system](opinions.md) ## Release - -* [How to build and ship a release](release-engineering.md) -* [Changelog v3.16.0](v316.md) + * [Changelog To V316](release/changelog_to_v316.md) + * [How To Build And Ship A Release](release/how_to_build_and_ship_a_release.md) * [GitHub releases](https://github.com/StackExchange/dnscontrol/releases/latest) diff --git a/documentation/providers/providers.md b/documentation/providers/providers.md index 9f37b1ac78..86720cd368 100644 --- a/documentation/providers/providers.md +++ b/documentation/providers/providers.md @@ -12,8 +12,8 @@ a provider that supports it, we'd love your contribution to ensure it works corr If a feature is definitively not supported for whatever reason, we would also like a PR to clarify why it is not supported, and fill in this entire matrix. -| Provider name | Official Support | DNS Provider | Registrar | [`ALIAS`](functions/domain/ALIAS.md) | [`CAA`](functions/domain/CAA.md) | [`AUTODNSSEC`](functions/domain/AUTODNSSEC_ON.md) | [`LOC`](functions/domain/LOC.md) | [`NAPTR`](functions/domain/NAPTR.md) | [`PTR`](functions/domain/PTR.md) | [`SOA`](functions/domain/SOA.md) | [`SRV`](functions/domain/SRV.md) | [`SSHFP`](functions/domain/SSHFP.md) | [`TLSA`](functions/domain/TLSA.md) | [`DS`](functions/domain/DS.md) | dual host | create-domains | [`NO_PURGE`](functions/domain/NO_PURGE.md) | get-zones | -| ------------- | ---------------- | ------------ | --------- | ------------------------------------ | -------------------------------- | ------------------------------------------------- | -------------------------------- | ------------------------------------ | -------------------------------- | -------------------------------- | -------------------------------- | ------------------------------------ | ---------------------------------- | ------------------------------ | --------- | -------------- | ------------------------------------------ | --------- | +| Provider name | Official Support | DNS Provider | Registrar | [`ALIAS`](02_language_reference/domain_modifier_functions/ALIAS.md) | [`CAA`](02_language_reference/domain_modifier_functions/CAA.md) | [`AUTODNSSEC`](02_language_reference/domain_modifier_functions/AUTODNSSEC_ON.md) | [`LOC`](02_language_reference/domain_modifier_functions/LOC.md) | [`NAPTR`](02_language_reference/domain_modifier_functions/NAPTR.md) | [`PTR`](02_language_reference/domain_modifier_functions/PTR.md) | [`SOA`](02_language_reference/domain_modifier_functions/SOA.md) | [`SRV`](02_language_reference/domain_modifier_functions/SRV.md) | [`SSHFP`](02_language_reference/domain_modifier_functions/SSHFP.md) | [`TLSA`](02_language_reference/domain_modifier_functions/TLSA.md) | [`DS`](02_language_reference/domain_modifier_functions/DS.md) | dual host | create-domains | [`NO_PURGE`](02_language_reference/domain_modifier_functions/NO_PURGE.md) | get-zones | +| ------------- | ---------------- | ------------ | --------- | ------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------- | --------- | -------------- | ------------------------------------------------------------------------- | --------- | | [`AKAMAIEDGEDNS`](providers/akamaiedgedns.md) | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ❔ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | | [`AUTODNS`](providers/autodns.md) | ❌ | ✅ | ❌ | ✅ | ❌ | ❔ | ❔ | ❔ | ❌ | ❔ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | | [`AXFRDDNS`](providers/axfrddns.md) | ❌ | ✅ | ❌ | ❔ | ✅ | ✅ | ❔ | ✅ | ✅ | ❔ | ✅ | ✅ | ✅ | ❔ | ❌ | ❌ | ❌ | ❌ |