Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2389 lines (1841 sloc) 87.6 KB

Domain Connect 2.1

Version 2.1

Revision 59

24-03-2019

DRAFT

Your use of this document and the contents therein is subject to the following license terms.

The MIT License (MIT)

Copyright (c) 2016 GoDaddy Operating Company, LLC.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contents

1. Introduction and background

Historically configuring DNS for services has been a difficult task for users. To make this easier, GoDaddy created an internal feature that simplified enabling DNS for different applications.

Based on learnings from this implementation, an improved and more general version of this protocol was created and open sourced. This document describes Domain Connect 2.0 and is shared with the intent of it becoming an open standard that can be utilized by multiple DNS Providers and Service Providers to simplify this interaction across the internet.

Terminology

Service Providers

refers to entities that provide products and services attached to domain names. Examples include web hosting providers (such as Wix or SquareSpace), email Service Providers (such as Microsoft or Google) and potentially even hardware manufacturers with DNS-enabled devices like home routers or automation controls (such as Linksys, Nest, and Philips).

DNS Providers

refers to entities that provide DNS services such as registrars (such as GoDaddy or 1and1) or standalone DNS services (like CloudFlare).

Registrar

refers to entities that register domain names with registries.

:: It is noted that the DNS Provider and Registrar can be different entities for a given domain name and DNS Zone.

Customer/User

refers to the end-user of these services.

Templates/Service Templates

refers to a file that describes a set of changes to DNS and domain functionality to enable a specific service.

Root Domain

refers to a registered domain (e.g. example.com or example.co.uk), or to a delegated zone in DNS.

Sub Domain

refers to a sub-domain of a root domain (e.g. sub.example.com or sub.example.co.uk).

1.1. Problem Statement

Configuring DNS for an application at a Service Provider has historically been a complex task that is difficult for users.

Typically a customer would try to configure their service by entering their domain name with the Service Provider. The Service Provider then used a number of techniques with mixed reliability to discover the DNS Provider. This might include DNS queries for nameservers, queries to whois, and mapping tables to figure out the registrar or company running DNS.

Once the Service Provider discovered the DNS Provider, they typically gave the customer instructions for proper configuration of DNS. This might include help text, screen shots, or even links to the appropriate tools.

Discovery of the DNS Provider in this manner is unreliable, and providing instructions to users would present a number of technologies (DNS record types, TTLs, Hostnames, etc.) and processes end users typically don’t understand. And the instructions authored by the Service Provider often quickly become out of date, further confusing the issue for users.

1.2. Goals

The goal of this specification is to create a system where Service Providers can easily enable their applications/services to work with the domain names of their customers. This includes both discovery of the DNS Provider and subsequent modification of DNS.

The system will be implemented using simple web based interactions and standard authentication protocols. The creation and modification of DNS settings will be done through the application of templates instead of direct manipulation of individual DNS records.

1.3. Templates

Templates are core to Domain Connect, as they fully describe a service owned by a Service Provider and contain all of the information necessary to enable and operate/maintain the service in the form of a set of records.

The individual records in a template may be identified by a groupId. This allows for the application of templates in different stages. For example, an email provider might first set a TXT record to verify the domain, and later set an MX record to configure email delivery. While done separately, both changes are fundamentally part of the same service.

Templates may also contain variable portions, as often values of data in DNS change based on the implementation and/or user of the service (e.g. the IP address of a service, a customer id, etc.).

The template is defined by the Service Provider and manually onboarded with the DNS Provider. Future versions of this specification may allow for an independent repository of templates. For now the templates are all published at https://github.com/Domain-Connect/templates

By basing the protocol on templates instead of DNS Records, several advantages are achieved. The DNS Provider has very explicit knowledge and control of the settings being changed to enable a service. And the system is more secure as templates are controlled and contained.

1.4. Onboarding Considerations

This specification is an open standard that describes the protocol, messages and formats used to enable Domain Connect between a Service Provider and a DNS Provider.

Any Service Provider is free to define and publish a template. However, the terms and conditions for a DNS Provider onboarding a Service Provider template is beyond the scope of this document. A DNS Provider can be selective in what templates they support, can require a contractual relationship, or even charge a fee for onboarding.

One way a Service Provider can be selective in which DNS Providers they accept is to implement a whitelist of providerIds. A Service Provider who chooses to whitelist must use providerId to distinguish between unique DNS Providers. The DNS providerId is typically a domain name.

1.5. Case Sensitivity

Unless otherwise stated, all values are case sensitive. Notable exceptions include certain data passed in the query string. This includes the serviceId and providerId (typically in the path), the domain and host values, and all variables names/keys. Variable names in the templates must also be case insensitive.

2. Protocol Overview and End User Flows

To attach a domain name to a service provided by a Service Provider, the customer would first enter their domain name.

Instead of relying on examination of the nameservers and mapping these to DNS Providers, DNS Provider discovery is handled through simple records in DNS and an API. The Service Provider queries for a specific record in the zone that returns a REST endpoint to initiate the protocol. When this endpoint is called, a Domain Connect compliant DNS Provider returns information about that domain and how to configure it using Domain Connect.

To apply the changes to DNS, there are two use cases. The first is a synchronous web flow, and the second is an asynchronous flow using oAuth and an API.

It is noted that a DNS Provider may choose to only implement one of the flows. As a matter of practice many Service Providers are based on the synchronous flow, with only a handful of them based on the asynchronous oAuth flow. So many DNS providers may opt to only implement the synchronous flow.

It is also be noted that individual services may work with the synchronous flow only, the asynchronous flow only, or with both.

2.1. The Synchronous Flow

This flow is tailored for the Service Provider that requires a one time synchronous change to DNS.

The user first enters their domain name at the Service Provider website.

image

After the Service Provider determines the DNS Provider using discovery, the Service Provider should display a link to the user indicating that they can "Connect their Domain" to the service.

image

After clicking the link, the user is directed to a browser window on the DNS Provider’s site. This may be done in another tab or in a new browser window, but may also be an in place navigation with a return url. This link passes the domain name being modified, the service provider/template being enabled, and any additional parameters (variables) needed to apply the template and configure the service.

Once at the DNS Provider site, the user is asked to authenticate if necessary.

image

After authenticating at the DNS Provider, the DNS Provider must verify the DNS zone of the domain name is controlled by the user. The DNS Provider must verify other parameters passed in are valid, and must prompt the user for consent to make the changes to DNS. The DNS Provider may also warn the user of services that would be disabled by applying this change to DNS.

image

Assuming the user grants this consent, the DNS changes are be applied.

If invoked in a pop-up window or tab, the browser window should be closed after the changes are applied. If invoked in place, the user must be navigated back to the Service Provider after the changes are applied.

2.2. The Asynchronous Flow

The asynchronous oAuth flow is tailored for the Service Provider that wishes to make changes to DNS asynchronously with respect to the user interaction, or wishes to make multiple or additional changes to DNS over time.

The asynchronous flow begins similarly to the synchronous flow. The Service Provider determines the DNS Provider and links to a consent dialog at the DNS Provider. Once at the DNS Provider the user signs in, control of the DNS zone for the domain is verified, and consent is granted.

Instead of applying the DNS changes on user consent, OAuth access is granted to the Service Provider. An OAuth access code is generated and handed back to the Service Provider. The Service Provider then requests an access (bearer) token.

The permission granted in the OAuth token is a right for the Service Provider to apply a requested template (or templates) to the specific domain (and specific subdomains) DNS under control of a specific user at the DNS Provider.

The Service Provider would later call the an API to apply a template using the access token.

Additional parameters must be passed as name/value pairs when applying the template.

3. DNS Provider Discovery

To facilitate discovery of the DNS Provider from a domain name DNS is utilized. This is done by returning a TXT record for _domainconnect in the zone..

An example of the contents of this record:

domainconnect.virtucondomains.com

As a practical matter of implementation, the DNS Provider may or may not contain a copy of this data in each and every zone. Instead, the DNS Provider must simply respond to the DNS query for the _domainconnect TXT record with the appropriate data.

How this is implemented is up to the DNS Provider.

For example, the DNS Provider may not store the data inside a TXT record for the domain, opting instead to put a CNAME in the zone and have the TXT record in the target of the CNAME. Another DNS Provider may simply respond with the appropriate records at the DNS layer without having the data in each zone.

The URL prefix returned is subsequently used by the Service Provider to determine the additional settings for using Domain Connect on this domain at the DNS Provider. This is done by calling a REST API.

GET

https://{_domainconnect}/v2/{domain}/settings

This must return a JSON structure containing the settings to use for Domain Connect on the domain name (passed in on the path) at the DNS Provider. This JSON structure must contain the following fields unless otherwise specified.

Field Key Type Description

Provider Id

providerId

String

Unique identifier for the DNS Provider. Typically a domain name (e.g. virtucom.com) of the DNS Provider.

Provider Name

providerName

String

The name of the DNS Provider.

Provider Display Name

providerDisplayName

String

(optional) The name of the DNS Provider that should be displayed by the Service Provider. This may change per domain for some DNS Providers that power multiple brands.

UX URL Prefix for Synchronous Flows

urlSyncUX

String

(optional) The URL Prefix for linking to the UX of Domain Connect for the synchronous flow at the DNS Provider. If not returned, the DNS Provider is not supporting the synchronous flow on this domain.

UX URL Prefix for Asynchronous Flows

urlAsyncUX

String

(optional) The URL Prefix for linking to the UX elements of Domain Connect for the asynchronous flow at the DNS Provider. If not returned, the DNS Provider is not supporting the asynchronous flow on this domain.

API URL Prefix

urlAPI

String

The URL Prefix for the REST API

Width of Window

width

Number

(optional) This is the desired width of the window for granting consent when navigated in a popup. Default value if not returned should be 750px.

Height of Window

height

Number

(optional) This is the desired height of the window for granting consent when navigated in a popup. Default value if not returned should be 750px.

UX URL Control Panel

urlControlPanel

String

(optional) This is a URL to the control panel for editing DNS at the DNS Provider. This field allows a Service Provider whose template isn’t supported at the DNS Provider to provide a direct link to perform manual edits.

To allow deep links to the specific domain, this string may contain %domain% which must be replaced with the domain name.

Name Servers

nameServers

String List

(optional) This is the list of nameservers desired by the DNS Provider for the zone to be authoritative. This does not indicate the authoritative nameservers; for this the registry would be queried.

As an example, the JSON returned by this call might contain.

{
    "providerId": "vicrucondomains.com",
    "providerName": "Virtucon Domains",
    "providerDisplayName": "Virtucon Domains",
    "urlSyncUX": "https://domainconnect.virtucondomains.com",
    "urlAsyncUX": "https://domainconnect.virtucondomains.com",
    "urlAPI": "https://api.domainconnect.virtucondomains.com",
    "width": 750,
    "height": 750,
    "urlControlPanel": "https://domaincontrolpanel.virtucondomains.com/?domain=%domain%",
    "nameServers": ["ns01.virtucondomainsdns.com", "ns02.virtucondomainsdns.com"]
}

Discovery must work on the root domain (zone) only. Bear in mind that zones can be delegated to other users, making this information valuable to Service Providers since DNS changes may be different for an apex zone vs. a sub-domain for an individual service.

The Service Provider must handle the condition when a query for the _domainconnect TXT record suceeds, but a call to query for the JSON fails. This can happen if the zone is hosted with another DNS Provider, but contains an incorrect _domainconnect TXT record.

The DNS Provider must return a 404 if they do not contain the zone.

Status Response Description

Success

2xx

A response of an http status code of 2xx indicates that the call was successful. The response is the JSON described above.

Not Found

404

A response of a 404 indicates that the DNS Provider does not have the zone.

4. Applying Domain Connect

4.1. Endpoints

The Domain Connect endpoints returned in the JSON during discovery are in the form of URLs.

The first set of endpoints are for the UX that the Service Provider links to. These are for the synchronous flow where the user can click to grant consent and have changes applied, and for the asynchronous oAuth flow where the user can grant consent for OAuth access.

The second set of endpoints are for the REST API.

All endpoints begin with a root URL for the DNS Provider such as:

https://connect.dnsprovider.com

They may also include any prefix at the discretion of the DNS Provider. For example:

https://connect.dnsprovider.com/api

The root URLs for the UX endpoints and the API endpoints are returned in the JSON payload during DNS Provider discovery.

4.2. Synchronous Flow

4.2.1. Query Supported Template

GET

{urlAPI}/v2/domainTemplates/providers/{providerId}/services/{serviceId}

This URL is be used by the Service Provider to determine if the DNS Provider supports a specific template through the synchronous flow.

Returning a status of 200 without a body indicates the template is supported. The DNS provider may decide to disclose the version of the template in a JSON object with field version (see: version field) or the full JSON object of deployed template.

Returning a status of 404 indicates the template is not supported.

Status Response Description

Success

2xx

A response of an http status code of 2xx indicates that the call was successful. The response optionally contains the version or template.

Not Found

404

A response of a 404 indicates that the template is not supported

4.2.2. Apply Template

GET

{urlSyncUX}/v2/domainTemplates/providers/{providerId}/services/{serviceId}/apply?[properties]

This is the URL where the user is sent to apply a template to a domain they own. It is called from the Service Provider to start the synchronous Domain Connect Protocol.

This URL can be called in one of two ways.

New Browser Window

The first is through a new browser tab or in a popup browser window. The DNS Provider signs the user in if necessary, verifies domain ownership, and asks for confirmation before application of the template. After application of the template, the DNS Provider should automatically close the browser tab or window.

Same Browser Window

The second is in the current browser tab/window. As above the DNS Provider signs the user in if necessary, verifies the user control of the DNS Zone for the domain, and asks for confirmation before application of the template. After application of the template (or cancellation by the user), the DNS Provider must redirect the browser to a return URL (redirect_uri).

Several parameters must be appended to the end of this redirect_uri.

  • State

    If a state parameter is passed in on the query string, this must be passed back as state= on the redirect_uri.

  • Error

    If authorization could not be obtained or an error has occurred, the parameter error= must be appended. For consistency with the asynchronous OAuth flows the valid values for the error parameter will be as specified in OAuth 2.0 RFC 6749 (4.1.2.1. Error Response - "error" parameter). Valid values are: invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, and temporarilly_unavailable.

  • Error Description

    When an error occurs, an optional error description containing a developer focused error description may be returned.

    Under normal operation the access_denied error can be returned for a number of reasons. For example, the user may not have access to the account that owns the domain. Even if they do and successfully sign-in, the account or the domain may be suspended.

    It is unlikely that the DNS Provider would want to leak this information to the Service Provider, and as such the description may be vague.

    There is one piece of information that may be interesting to communicate to the Service Provider. This is when the end user decided to cancel the operation. If the DNS Provider wishes to communicate this to the Service Provider, when the error=access_denied the error_description may contain the prefix "user_cancel". Again, this is left to the discretion of the DNS Provider.

To prevent an open redirect, unless the request is digitally signed the redirect_uri must be within the domains specified in the template in syncRedirectDomain.

Parameters/properties
Property Request Parameter Description

Domain

domain

The domain name being configured. This is the root domain (the registered domain or delegated zone).

Host

host

(optional) This is the host name of the sub domain. If left blank, the template is being applied to the root domain. Otherwise the template is applied to the sub domain of the domain.

Redirect URI

redirect_uri

(optional) The location to direct the client browser to upon successful authorization, or upon error. If omitted the DNS Provider will close the browser window upon completion. It must be scoped to the syncRedirectDomain from the template, or the request must be signed.

State

state

(optional) A random and unique string passed along to prevent CSRF, or to pass back state. It must be returned as a parameter when redirecting to the redirect_uri described above.

Name/Value Pairs

*

Any key that will be used as a replacement for the “% surrounded” variables in the template. The name portion of this API call corresponds to the variable(s) specified in the template and the value corresponds to the value that will be used when applying the template.

Provider Name

providerName

(optional) This parameter specifies the provider name for display in the UX. It allows for application of a template for a service that is sold through different companies. Not all templates allow for this capability. This name must be used only when the "shared" attribute is set in the template.

Group Id

groupId

(optional) This parameter specifies the groups from the template to apply. If no group is specified, all groups are applied. Multiple groups may be specified in a comma delimited format.

Signature

sig

(optional) A signature of the query string. See Security Considerations section below.

An example query string:

GET

https://web-connect.dnsprovider.com/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template1/apply?domain=example.com&IP=192.168.42.42&RANDOMTEXT=shm%3A1542108821%3AHello

This call indicates that the Service Provider wishes to connect the domain example.com to the service using the template identified by the composite key of the provider (exampleservice.domainconnect.org) and the service template owned by them (template1). In this example, there are two variables in this template, "IP" and "RANDOMTEXT". These variables are passed as name/value pairs.

4.2.3. Security Considerations

By applying a template with parameters there is a security consideration that must be taken into account.

Consider the template above where the IP address of the A record is passed in through a variable. A bad actor could generate a URL with a malicious IP and phish users by sending out emails asking them to "re-configure" their service. If an end user is convinced to click on this link, they would land on the DNS Provider site to confirm the change. To the user, this would appear to be a valid request to configure the domain. Yet the IP would be hijacking the service.

Not all templates have this problem. But when they do, there are several options.

Disable Synchronous

One option is to disable the synchronous flow and use asynchronous OAuth. This can be controlled with the syncBlock value from the template. However, as will be seen below OAuth has a higher implementation burden and requires onboarding between each Service and DNS Provider.

Digitally Sign Requests

Another option is to digitally sign the query string. A signature is appended as an additional query string parameter, properly URL encoded and of the form:

sig=NLOQQm6ikGC2FlFvFZqIFNCZqlaC4B%2FQDwS6iCwIElMWhXMgRnRE17zhLtdLFieWkyqKa4I%2FOoFaAgd%2FAl%2ByzDd3sM2X1JVF5ELjTlj84jZ4KOEIdnbgkEeO%2FTkYRrPkwcmcHMwc4RuX%2Fqio8vKYxJaKLKeVGpUNSKo7zkq3XIRgyxoLSRKxmlSTHFAz4LvYXPWo6SHDoVcRvElWj18Um13sSXuX4KhtOLym2yImHpboEi4m2Ziigc%2BNHZE0VvHUR7wZgDaB01z8hFm5ATF%2B8swjandMRf2Lr4Syv4qTxMNT61r62EWFkt5t9nhxMgss6z4pfDVFZ3vYwSJDGuRpEQ%3D%3D

The Service Provider generates this signature using a private key. As indicated, this signature is generated from the query string properly URL encoded.

The Service provider must publish their public key and place it in a DNS TXT record in a domain specified in the template in syncPubKeyDomain. To allow for key rotation, the host name of the TXT record must be appended as another variable on the query string of the form:

key=_dcpubkeyv1

This example indicates that the public key can be found by doing a DNS query for a TXT record called _dcpubkeyv1 in the domain specified in the syncPubKeyDomain from the template.

To account for DNS Servers with limits to the size of a TXT record, multiple records may exist for the DNS TXT query. For example, a public key of:

MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1dCqv7JEzUOfbhWKB9mTRsv3O9Vzy1Tz3UQlIDGpnVrTPBJDQTXUhxUMREEOBKo+rOjHZqfYnSmlkgu1dnBEO8bsELQL8GjS4zsjdA53gRk2SDxuzcB4fK+NCDfnRHut5nG0S3U4cq4DuGrMDFVBwxH1duTsqDNgIOOfNTsFcWSVXoSSTqCCMGbj8Vt51umDhWQAj06lf50qP2/jMNs2G+KTlk3dBHx3wtqYLvdcop1Tk5xBD64BPJ9uwm8KlDNHe+8O+cC9j04Ji8B2K0/PzAj90xnb8XJy/EM124hpT9lMgpHKBUvdeurJYweC6oP41gsTf5LrpjnyIy9j5FHPCQIDAQAB

may contain several TXT records. The records would be of the form:

p=1,a=RS256,t=x509,d=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1dCqv7JEzUOfbhWKB9mTRsv3O9Vzy1Tz3UQlIDGpnVrTPBJDQTXUhxUMREEOBKo+rOjHZqfYnSmlkgu1dn

p=2,a=RS256,t=x509,d=BEO8bsELQL8GjS4zsjdA53gRk2SDxuzcB4fK+NCDfnRHut5nG0S3U4cq4DuGrMDFVBwxH1duTsqDNgIOOfNTsFcWSVXoSSTqCCMGbj8Vt51umDhWQAj06lf5

p=3,a=RS256,t=x509,d=NCDfnRHut5nG0S3U4cq4DuGrMDFVBwxH1duTsqDNgIOOfNTsFcWSVXoSSTqCCMGbj8Vt51umDhWQAj06lf50qP2/jMNs2G+KTlk3dBHx3wtqYLvdcop1Tk5xBD64BPJ9

p=4,a=RS256,t=x509,d=uwm8KlDNHe+8O+cC9j04Ji8B2K0/PzAj90xnb8XJy/EM124hpT9lMgpHKBUvdeurJYweC6oP41gsTf5LrpjnyIy9j5FHPCQIDAQAB

Here the public key is broken into four records in DNS, and the data also indicates that the signing algorithm is an RSA Signature with SHA-256 using an x509 certificate. The value for "a" if omitted will be assumed to be RS256, and for "t" will be assumed to be x509.

Note: The only algorithm currently supported is SHA-256 with x509 certificates. The values are placed here for future compatibility.

The above data was generated for a query string:

a=1&b=2&ip=10.10.10.10&domain=foobar.com

Signing the query string by the Service Provider is optional. Not all Services Provider templates require or are able to provide this level of security. Presence of the syncPubKeyDomain in the template indicates that the template requires signature verification.

Notes:

The digital signature will be generated on the full query string only, excluding the sig and key parameters. This is everything after the ?, except the sig and key values.

The values of each query string value key/value pair must be properly URL Encoded before the signature is generated.

Warnings

Some applications aren’t able to use OAuth and/or sign requests.

If the template require variables, and OAuth and signing isn’t available, the flag warnPhishing must be set to true in the template.

When set this indicates to the DNS Provider that they should display extra warnings to the user to have them verify the link was/is from a reputable source before applying the template.

4.2.4. Shared Templates

Most services are sold and provided by the same company. However, some Service Providers have a reseller channel. This allows the service to be provided by the Service Provider, but sold through third parties. It is often this third party reseller that configures DNS.

While each reseller could enable Domain Connect, this is inefficient for the DNS Providers. Enabling a single template that is shared by multiple resellers would be more optimal.

To facilitate this, the ability to pass in the name of the reseller in the synchronous flow is available. When the shared flag is set in the template and the providerName is passed in the querystring, the DNS Provider should display the name of the reseller in the confirmation user experience.

As an example, the message can now read “(Reseller) XYZ would like to make your domain example.com work with ACME Websites.”

In this example, ACME Websites is a service provided by ACME but resold through XYZ.

This must only work for templates that have set the shared attribute set to true.

Note: When a Service Provider has a large reseller channel, it is highly recommended that the Service Provider creates an API for their resellers to ease the implementation of Domain Connect. There are elements of convenience in doing this around Domain Discovery and URL Formatting. But this would be required if the template required signatures.

4.2.5. Verification of Changes

There are circumstances where the Service Provider may wish to verify that the template was successfully applied. Without Domain Donnect, this typically involved the Service Provider querying DNS to see if the changes to DNS had been made.

This same technique works with Domain Connect, and if necessary can be triggered either manually on the Service Provider site or automatically upon page/window activation in the browser when the browser window for the DNS Provider is closed.

When the redirect_uri is used and an error is not present in the URI, the Service Provider can not assume the changes were applied to DNS. While true in most circumstances, users can tamper with or alter the return url in the browser. As such it is recommend that enablement of a service be based on verification of changes to DNS.

4.3. Asynchronous Flow: OAuth

Using the OAuth flow is a more advanced use case needed by Service Providers that have more complex configurations that may require multiple steps and/or are asynchronous from the user’s interaction.

Details of an OAuth implementation are beyond the scope of this specification. Instead, an overview of how OAuth is used by Domain Connect is given here.

Not all DNS Providers will support the asyncronous flow. As such it is recommended that Service Providers relying on an OAuth implementation also implement a synchronous implementation.

4.3.1. SAuth Flow: Setup

Service providers wishing to use the OAuth flow must register as an OAuth client with each DNS provider. This is a manual process.

To register, the Service Provider would provide (in addition to their template) any configuration necessary for the DNS Providers OAuth implementation. This includes valid URLs and Domains for redirects upon success or errors.

Note: The validity of redirects are very important in any OAuth implementation. Most OAuth vulnerabilities are a combination of an open redirect and/or a compromised secret.

In return, the DNS provider will give the Service Provider a client id and a secret which will be used when requesting tokens. For simplicity the client id should be the same as the providerId.

4.3.2. OAuth Flow: Getting an Authorization Code

GET

{urlAsyncUX}/v2/domainTemplates/providers/{providerId}

To initiate the OAuth flow the Service Provider first links to the DNS Provider to gain consent.

This endpoint is similar to the synchronous flow described above. The DNS Provider must authenticate the user, verify the user has control of the DNS Zone for the domain, and ask the user for permission. Instead of permission to make a change to DNS, the permission is now to allow the Service Provider to make the changes on their behalf. Similarly the DNS Provider may warn the user that (the eventual) application of a template might change existing records and/or disrupt existing services attached to the domain.

While the variables for the applied template would be provided later, the values of some variables may be necessary to determine conflicts. As such, any variables impacting conflicting records should be provided in the consent flow. Today this includes variables in hosts, and variables in the data portion for certain TXT records. As conflict resolution evolves, this list may grow.

The protocol allows for the Service Provider to gain consent to apply multiple templates. These templates are specified in the scope parameter. It also allows for the Service Provider to gain consent to apply these templates to the domain or to the domain with multiple sub-domains. These are specified in the host parameter. If conflict detection is implemented by the DNS Provider, they should account for all permutations.

The scope parameter is a space separated list (as per the OAuth protocol) of the template serviceIds. The host parameter is an optional comma separated list of hosts. A blank entry for the host implies the template can be applied to the root domain. For example:

Query String Description

scope=t1+t2&domain=example.com

Templates "t1" and "t2" can be applied to example.com

scope=t1+t2&domain=example.com&host=sub1,sub2

Templates "t1" and "t2" can be applied to sub1.example.com or sub2.example.com

scope=t1+t2&domain=example.com&host=sub1,

Templates "t1" and "t2" can be applied to example.com or sub1.example.com

Upon successful authorization/verification/consent from the user, the DNS Provider will direct the end user’s browser to the redirect URI. The authorization code will be appended to this URI as a query parameter of "code=" as per the OAuth specification.

Similar to the synchronous flow, upon error the DNS provider may append an error code as query parameter "error". These errors are also from the oAuth 2.0 RFC 6749 (4.1.2.1. Error Response - "error" parameter). Valid values include: invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, and temporarilly_unavailable. An optional error_description suitable for developers may also be returned at the discretion of the DNS Provider. The same considerations as in the synchronous flow apply here.

The state value passed into the call must be passed back on the query string as "state=".

The following table describes the values in the query string parameters for the request for the OAuth consent flow that must be included unless otherwise indicated

Property Key Description

Domain

domain

The domain name being configured. This is the root domain (the registered domain or delegated zone).

Host

host

(optional) An optional list of comma separated host names upon which the template may be applied. An empty string implies the root.

Client Id

client_id

The client id that was provided by the DNS provider to the service provider during registration. It is recommended that this should be the same as the providerId in the template.

Redirect URI

redirect_uri

The location to direct the client’s browser upon successful authorization or upon error. Validation of the redirect_uri will be done by the DNS Provider to match the values provided during onboarding.

Response type

response_type

(optional) If included it must be the string ‘code’ to indicate an authorization code is being requested.

Scope

scope

The OAuth scope corresponds to the requested templates. This is list of space separated serviceIds.

State

state

(optional) This is a random, unique string passed along to prevent CSRF or to pass state value back to the caller. It will be returned as a parameter appended to the redirect_url described above.

4.3.3. oAuth Flow: Requesting an Access Token

POST

{urlAPI}/v2/oauth/access_token

Once authorization has been granted, the Service Provider must use the Authorization Code provided to request an Access Token. The oAuth specification recommends that the Authorization Code be a short lived token, and a reasonable recommended setting is ten minutes. As such this exchange needs to be completed before that time has expired or the process will need to be repeated.

This token exchange is typically done via a server to server API call from the Service Provider to the DNS Provider using a POST. When called in this manner a secret is provided along with the Authorization Code.

OAuth does allow for retrieving the access token without a secret. This is typically done when the OAuth client is a client application. When onboarding with the DNS Provider this would need to be enabled.

When the secret is provided (which is the normal case), care must be taken. A malicious user could create a domain that returns a false _domainconnect TXT record, and subsequently a JSON call to their own server for the API end point. By doing so, they could then run Domain Connect on their domain and retrieve the secret.

As such the urlAPI used for oAuth by the Service Provider should be maintained per DNS Provider and not the value retrieved during discovery.

The following table describes the POST parameters that must be included in the request for the access token unless otherwise indicated. The parameters should be accepted via the query string or the body of the post. This is again particularly important for the client_secret, as passing secrets via a query string is generally frowned upon given that various systems often log URLs.

The body of the post is application/json encoded.

Property Key Description

Authorization Code/Refresh Code

code/refresh_token

The authorization code that was provided in the previous step when the customer accepted the authorization request, or the refresh_token for a subsequent access token.

Redirect URI

redirect_uri

(optional) This is required if a redirect_uri was passed to request the authorization code. When included, it needs to be the same redirect_uri provided in this step.

Grant type

grant_type

The type of code in the request. Usually the string ‘authorization_code’ or ‘refresh_token’

Client ID

client_id

This is the client id that was provided by the DNS provider to the Service Provider during registration

Client Secret

client_secret

The secret provided to the Service Provider during registration. Typically required unless the rare circumstance with secret-less oAuth.

Upon successful token exchange, the DNS Provider will return a response with 4 properties in the body of the response.

Property Description

access_token

The access token to be used when making API requests

token_type

Always the string "bearer"

expires_in

The number of seconds until the access_token expires

refresh_token

The token that can be used to request new access tokens when this one has expired.

Status Response Description

Success

2xx

A response of an http status code of 2xx indicates that the call was successful. The response is the JSON described above.

Errors

4**

All other responses indicate an error.

4.3.4. OAuth Flow: Making Requests with Access Tokens

Once the Service Provider has the access token, they can call the DNS Provider’s API to make changes to DNS on the domain by applying and (optionally) removing authorized templates. These templates can be applied to the root domain or to any sub-domain of the root domain that has been authorized.

All calls to this API pass the access token in the Authorization Header of the request to the call to the API. More details can be found in the OAuth specifications, but as an example:

GET /resource/1 HTTP/1.1

Host: example.com

Authorization: Bearer mF_9.B5f-4.1JqM

While the calls below do not have the same security consideration of passing the secret, it is recommend that the urlAPI be from a stored value vs. the value returned during discovery here as well.

4.3.5. OAuth Flow: Apply Template to Domain.

POST

{urlAPI}/v2/domainTemplates/providers/{providerId}/services/{serviceId}/apply?[properties]

The primary function of the API is to apply a template to a customer domain.

While the providerId is implied in the authorization, this is on the path for consistency with the synchronous flows and other APIs. If not matching what was authorized, an error must be returned.

When applying a template to a domain, it is possible that a conflict may exist with previous settings. While it is recommended that conflicts be detected when the user grants consent, because OAuth is asynchronous it is possible that a new conflict was introduced by the user.

While it is up to the DNS Provider to determine what constitutes a conflict (see section on Conflicts below), when one is detected calling this API must return an error. This error should enumerate the conflicting records in a format described below.

Because the user oten isn’t present at the time of this error, it is up the Service Provider to determine how to handle this condition. Some providers may decide to notify the user. Others may decide to apply their template anyway using the "force" parameter. This parameter will bypass error checks for conflicts, and after the call the service will be in its desired state.

Calls to apply a template via OAuth require the following parameters posted to the above URL unless otherwise indicated. The DNS Provider must accept parameters in query string or body of this post.

The body is application/json encoded.

Property Key Description

Domain

domain

The root domain name being configured. It must match the domain that was authorized in the token.

Host

host

(optional) The host name of the sub domain of the root domain that was authorized in the token. If omitted or left blank, the template is being applied to the root domain.

Name/Value Pairs

*

Any variable fields consumed by this template. The name portion of this API call corresponds to the variable(s) specified in the record and the value corresponds to the value that must be used when applying the template as per the implementation notes.

Group ID

groupId

(optional) Specifies the group of changes in the template to apply. If omitted, all changes are applied. This can also be a comma separated list of groupIds.

Force

force

(optional) Specifies that the template must be applied independently of any conflicts that may exist on the domain. This can be a value of 0 or 1.

InstanceId

instanceId

(optional) Only applicable to templates supporting multiple instances (see multiInstance template property). Allows for later removal of one template instance by DNS Providers storing this information.

An example call is below. In this example, it is contemplated that there are two variables in this template, "IP" and "RANDOMTEXT" which both require values. These variables are passed as name/value pairs.

POST

https://connect.dnsprovider.com/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template1/apply?IP=192.168.42.42&RANDOMTEXT=shm%3A1542108821%3AHello&force=1

The API must validate the access token, and that the domain belongs to the customer and is represented by the token being presented. Any errors with variables, conflicting templates, or problems with the state of the domain are returned; otherwise the template is applied.

Results of this call can include information indicating success or an error. Errors will be 400 status codes, with the following codes defined.

Status Response Description

Success

2xx

A response of an http status code of 204 indicates that call was successful and the template applied. Note that any 200 level code must be considered a success.

Bad Request

400

A response of a 400 indicates that the server cannot process the request because it was malformed or had errors. This response code is intended for programming errors.

Unauthorized

401

A response of a 401 indicates that caller is not authorized to make this call. This can be because the token was revoked, or other access issues.

Conflict

409

This indicates that the call was good, and the caller authorized, but the change could not be applied due to a conflicting template. Errors due to conflicts will only be returned when force is not equal to 1.

Error

4xx

Other 4xx error codes may be returned when something is wrong with the request that makes applying the template problematic; most often something that is wrong with the account and requires attention.

When a 409 is returned, the body of the response should contain details of the conflicting records. This should be JSON containing the error code, a message suitable for developers, and an array of tuples containing the conflicting records type, host, and data element.

As an example:

{
    "code": "409",
    "message": "Conflicting records",
    "records": [
        {
            "type": "CNAME",
            "host": "www",
            "data": "@"
        },
        {
            "type": "A",
            "host": "@",
            "data": "random ip"
        }
    ]
}

In this example, the Service Provider tried to apply a new hosting template. The domain had an existing service applied for hosting.

4.3.6. OAuth Flow: Revert Template

This call reverts the application of a specific template from a domain.

Implementation of this call is optional. If not supported a 501 would be returned.

POST

{urlAPI}/v2/domainTemplates/providers/{providerId}/services/{serviceId}/revert?domain={domain}&host={host}

This API allows the removal of a template from a customer domain/host using an OAuth request.

The provider and service name in the URL must match the values provided during authorization.

This call must validate that the template exists and has been applied to the domain by the Service Provider, or a warning must be returned that the call would have no effect.

An example query string might look like:

POST

https://connect.dnsprovider.com/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template1/revert?domain=example.com

Allowed parameters:

Property Key Description

Domain

domain

The root domain name being configured. It must match the domain that was authorized in the token.

Host

host

The host name of the sub domain of the root domain that was authorized in the token. If omitted or left blank, the template is being applied to the root domain.

InstanceId

instanceId

(optional) Only applicable to templates supporting multiple instances (see multiInstance template property). For DNS Provider storing information about applied templates allows removal of single instance of template. If missing all instances of template should be removed.

The DNS Provider should be able to accept these on the query string or in the body of the POST with application/json encoding.

Response codes Success, Authorization, and Errors are identical to above with the addition of the 501 code.

4.3.7. OAuth Flow: Revoking access

Like all oAuth flows, the user may revoke the access at any time using UX at the DNS Provider site. As such the Service Provider needs to be aware that their access to the API may be denied.

5. Domain Connect Objects and Templates

5.1. Template Versioning

If a breaking change is made to a template it is recommended that a new template be created. While on the surface versioning looks appealing, in reality this is rarely needed.

Any changes to the template need to account for existing customers with settings in DNS, some applied through Domain Connect and some manual. So when changes are made, they are often backward compatible.

Note that when a template changes, it does need to be on-boarded with the DNS Providers.

The version field of the template definition serves the purpose of transparency between the DNS Provider and the Service Provider in case of such changes.

5.2. Template Definition

A template is defined as a standard JSON data structure containing the following data. Fields are required unless otherwise indicated.

Data Element Type Key Description

Service Provider Id

String

providerId

The unique identifier of the Service Provider that created this template. This is used in the URLs to identify the Service Provider. To ensure non-coordinated uniqueness, this should be the domain name of the Service Provider (e.g. exampleservice.domainconnect.org).

Service Provider Name

String

providerName

The name of the Service Provider suitable for display. This may be displayed to the user on the DNS Provider consent UX.

Service Id

String

serviceId

The name or identifier of the template. This is used in URLs to identify the template. It is also used in the scope parameter for oAuth. It must not contain space characters, and must be URL friendly.

Service Name

String

serviceName

The name of the service suitable for display to the user. This may be displayed to the user on the DNS Provider consent UX.

Version

Integer

version

(optional) If present this represents a version of the template and should be increased with each update of the template content. This value is mainly informational to improve communication and transparency between providers.

Logo

String

logoUrl

(optional) A graphical logo representing the Service Provider and/or Service for use in any web-based flow. If present this may be displayed to the user on the DNS Provider consent UX.

Description

Text

description

(optional) A textual description of what this template attempts to do. This is meant to assist developers and must not be displayed to the user.

Variable Description

Text

variableDescription

(optional) A textual description of what the variables are. This is meant to assist developers and must not be displayed to the user.

Synchronous Block

Boolean

syncBlock

(optional) Indicates that the synchronous protocol must be disabled for this template. The default for this is false.

Shared

Boolean

shared

(optional) Indicates that the template is shared and the provider name can be passed in on the query string. If false, passing in the name on the query string must have no impact. The default for this is false.

Synchronous Public Key Domain

String

syncPubKeyDomain

(optional) When present, indicates that calls to apply a template synchronously must be digitally signed. The value indicates the domain name for querying the TXT record from DNS that contains the public key used for signing.

Synchronous Redirect Domains

String

syncRedirectDomain

(optional) When present, this is a comma separated list of domain names for which redirects must be sent to after applying a template for the synchronous flow.

Multiple Instance

Boolean

multiInstance

(optional) Defaults to False. When set to True, it indicates that the template may be applied multiple times. This only impacts DNS Providers that maintain template state in DNS.

Warn Phishing

Boolean

warnPhishing

(optional) When present, this tells the DNS Provider that the template may contain variables susceptible to phishing attacks and the provider is unable to digitally sign the requests. When set the DNS Provider should display warnings to the user. The default value for this is false.

Host Required

Boolean

hostRequired

(optional) Defaults to false. When present this indicates that the template has been authored to work only when both domain and host are provided. An example where this would be true would be a template where CNAME is set on the fully qualified domain name. This is largely informational, as most DNS Providers already enforce such rules.

Template Records

Array of Template Records

records

A list of records for the template.

5.3. Template Record

Each template record is an entry that contains a type and several other values depending on the type.

Many of these values can contain variables. There are three built in variables.

  • %host%: This is the host passed from the query string

  • %domain%: This is the domain passed from the query string

  • %fqdn%: This is the fully qualified domain name e.g. [host.]domain

The @ symbol also has special meaning and is described below.

It is noted that as a best practice the variable portions should be constrained to as small as possible a portion of the resulting DNS record.

For example, say a Service Provider requires a CNAME of one of three values for their users: s01.example.com, s02.example.com, and s03.example.com.

The value in the template could simply contain %servercluster%, and the fully qualified string passed in. Alternatively, the value in the template could contain %var%.example.com and a value of 01, 02, or 03 passed in. By placing more fixed data into the template, the template is more secure.

Each record will contain the following elements.

Data Element Type Key Description

Type

enum

type

Describes the type of record in DNS, or the operation impacting DNS.

Valid values include: A, AAAA, CNAME, MX, TXT, SRV, or SPFM

For each type, additional fields would be required.

A: host, pointsTo, TTL

AAAA: host, pointsTo, TTL

CNAME: host, pointsTo, TTL (host must not be null or @)

NS: host, pointsTo, TTL (host must not be null or @)

TXT: host, data, TTL, txtConflictMatchingMode, txtConflictMatchingPrefix

MX: host, pointsTo, TTL, priority

SRV: name, target, TTL, priority, protocol, service, weight, port

SPFM: host, spfRules

Group Id

String

groupId

(optional) This parameter identifies the group the record belongs to when applying changes. This must not contain variables.

Essential

enum

essential

(optional) This parameter indicates how the record is treated during conflict detection with existing templates.

If the DNS Provider is not implementing applied template state in DNS this is ignored.

Always (default) - record MUST be applied and kept with the template

OnApply - record MUST be applied but can be later removed without dropping the whole template

Host

String

host

The host for A, AAAA, CNAME, NS, TXT, and MX values.

This value is relative to the applied host and domain. A value of empty or @ indicates the root of the applied host and domain.

This value should not contain variables unless absolutely necessary. This is discussed below.

Name

String

name

The name for the SRV record.

This value is relative to the applied host and domain. A value of empty or @ indicates the root of the applied host and domain.

This value should not contain variables unless absolutely necessary. This is discussed below.

Points To

String

pointsTo

The pointsTo location for A, AAAA, CNAME, NS and MX records.

TTL

Int

ttl

The time-to-live for the record in DNS. Valid for A, AAAA, CNAME, NS, TXT, MX, and SRV records. This must not contain variables.

Data

String

data

The data for a TXT record in DNS

TXT Conflict Matching Mode

String

txtConflictMatchingMode

Describes how conflicts on the TXT record are detected. Possible values are None, All, or Prefix. The default value is None. See below.

TXT Conflict Matching Prefix

String

txtConflictMatchingPrefix

The prefix to detect conflicts when txtConflictMatchingMode is "Prefix". This must not contain variables. See below.

Priority

Int

priority

The priority for an MX or SRV record. This must not contain variables.

Weight

Int

weight

The weight for the SRV record. This must not contain variables.

Port

Int

port

The port for the SRV record. This must not contain variables.

Protocol

String

protocol

The protocol for the SRV record.

Service

String

service

The symbolic name for the SRV record.

Target

String

target

The target for the SRV record.

SPF Rules

String

spfRules

These are desired rules for the SPF TXT record. These rules will be merged with other SPFM records into final SPF TXT record. See [spf-record].

6. Template Considerations

6.1. Template State in DNS

DNS Providers may chose to maintain state inside records in DNS indicating the templates writing the records. Other providers may chose to not maitain this state.

A DNS Provider that maintains this state may be able to provide an improved experience for customers, telling them the services enabled. They also may be able to have more advanced handling of conflicts.

To make the implementation burden reasonable for DNS Providers, Domain Connect does not dictate the approach.

6.2. Disclosure of Changes and Conflicts

It is left to the discretion of the DNS Provider to determine what is disclosed to the user when granting permission and/or applying changes to DNS. This includes disclosing the records being applied and the records that may be overwritten.

For changes being made, one DNS Provider may decide to simply tell the user the name of the service being enabled. Another may decide to display the records being set. And another may progressively display both.

For conflict detection, one DNS Provider may simply overwrite changed records without warning. Another may detect conflicts and warn the user of the records that will change. And another may implement logic to further detect, warn, and remove any of the existing templates that overlap with the new template once applied (this assumes they are a DNS Provider that maintains template state in DNS).

As an example, consider applying a template that sets two records (recordA and recordB) into a zone. Next consider applying a second template that overlaps with the first template (recordB and recordC). If the DNS maintains template state and removes conflicting templates, applying the second template would remove the first template. Application of the second template would conflict with recordB and the entire first template would be removed.

Manual changes made by the user at the DNS Provider may also have appropriate warnings in place to prevent unwanted changes; with overrides being possible and removal of conflicting templates.

For the synchronous flow, this happens while the user is present.

For the asynchronous flow, the consent UX is similar. However, the changes are made later using the API and OAuth. The DNS Provider may decide to detect conflicts and return these from the API without applying the change using the proper response code. If the force parameter is set, the changes must be applied regardless of conflicts.

It is ultimately left to the DNS Provider to determine the amount of disclosure and/or conflict detection. The only requirement is that after a template is applied the new records must be applied in totality.

A reasonable set of recommendations for the UX might consist of:

  • The consent UX should inform the customer of the service that will be enabled. If the customer want to know the specifics, the DNS Provider could provide a "show details" link to the user. This could display to them the specific records that are being set in DNS.

  • If there are conflicts, either at the template or record level, the consent UX should warn the user about these conflicts. For templates, this would be services that would be disabled. For records, this would be records that would be deleted or overwritten. This could be progressively disclosed.

6.3. Record Types and Conflicts

Conflict detection done by the DNS provider prior to template application has to take into consideration specifics of each DNS record type. The rules outlined below ensure predictable conflict resolution between DNS providers. Each rule applies to the records on the very same host, unless specifed otherwise.

  • CNAME record conflicts with TXT, MX, AAAA, A and existing CNAME records, and any other records of these types conflict with an existing CNAME record. Note: CNAME records cannot be at the root of the zone.

  • NS records conflict with all other records. This includes of the same host, and for any record ending with the NS host. For example, an NS record of foo will conflict with any foo, www.foo, bar.foo, etc. Similarly all other record type conflict with NS records in the same manner.

  • MX, SRV records always conflict with records of the same type

  • A and AAAA records conflict with any other A and/or AAAA record, to avoid IPv4 and IPv6 pointing to different services.

  • TXT records conflict detection is handled looking at txtConflictMatchingMode parameter

    • None: This indicates that the TXT records do not conflict with any other TXT record. This is the default setting, if not specified.

    • All: This indicates that the TXT records conflict with any other TXT record

    • Prefix: This indicates that TXT record conflict with any other TXT containing value starting with txtConfictMatchingPrefix

6.4. Apply, Re-apply, and Multi-Instance

There is an additional consideration for DNS Providers that maintain the state of an applied template when re-applying a template.

To avoid unnecessary conflict warnings to the user, under normal use when re-applying a template such a DNS Provider should remove the previously applied template on the same host.

This may not be desireable for all templates, as a limited set of templates are designed to be applied multiple times. To faciliate this the template can have the flag multiInstance set. This tells the DNS Provider that the template is expected to be written multiple times and that a re-apply must not remove previous instances.

This setting only impacts DNS Providers that maintain applied template state. DNS Providers that do not maintain applied template state must rely on the normal conflict resolution rules, and this flag has no impact.

6.5. Non-essential records

Typically a template specifies a list of DNS records which are required for the service. There may be cases where some records are only required for a very short period of time, and removing or altering the record later (either by the end user or through application of another template) should not trigger conflict detection.

This can be controlled by the essential property of a record in the template.

Again, this setting only impacts DNS Providers that maintain applied template state.

6.6. Template Scope

For DNS Providers that maintain template state, an individual template is scoped to the set of records applied to a fully qualified domain. This includes the root domain and the host (aka sub-domain) at apply time.

As an example, if a template is applied on domain=example.com&host=sub1 a later application of the template on domain=example.com&host=sub2 must be treated as a distinct template. If a conflict is detected later with the records set into "sub2.example.com", only the records set with this template would be removed.

6.7. Host/Name in Template

Template records contain the host name of the record to set into the zone (called name for SRV records). This value must be considered relative to the domain/host when the template is applied.

Consider a template record of type A with a host value of "xyz". When the template is applied to a domain=foo.com and an empty host value, the resulting zone after the template is applied will contain an A record of "xyz" (or "xyz.foo.com." in bind format).

If the same template is applied to a domain=foo.com and host=bar, the zone will contain an A record of "xyz.bar" (or "xyz.bar.foo.com." in bind format).

A value of @ for host in the template is a placeholder for an empty value.

6.8. PointsTo in Template

Template records of certain types contain the pointsTo value to set in the zone. For record types such as CNAME where this can be a fully qualified domain name.

A value of @ in pointsTo field in the template is a shortcut for the fully qualified domain name of the domain/host being applied.

Consider a template record of type CNAME with a pointsTo value of "@". After a template of domain=foo.com and an empty host is applied, the pointsTo value (or corresponding field) in the resulting zone would be "foo.com." in bind format. After a template of domain=foo.com with host=bar is applied, the points to value would be "bar.foo.com." in bind format.

Any domain in a pointsTo field in a template must be considered fully qualified and not relative.

6.9. Variables

6.9.1. Variables and Host/Name in Template

While templates do allow for variables in a host or name field values, these should be used very sparingly.

As an example, consider setting up hosting for a site. But instead of applying the template to a domain/host, the name of the host is placed as a variable in the template.

Such a template might contain an A record of the form:

{
    "type": "A",
    "host": "%var%",
    "pointsTo": "2.2.2.2",
    "ttl": 1800
}

This template could be applied on a domain like example.com with the var set to "sub", "sub1", "sub2", etc.

Application of this template would be at the domain level for "example.com". This causes problems for application/re-application of the template, conflict detection, and template removal.

Since this template would be applied to the domain only, DNS providers that maintain template state would remove previous instances of the template before re-application. This means applying this template with var=sub would result in the A record for sub.example.com to be set to the value 2.2.2.2. Later, applying the template on "example.com" with the var=sub2 should remove the old template before setting the new one. sub.example.com would be removed, and sub2.example.com would be set to the value 2.2.2.2.

Furthermore, determining conflicts would be impossible when the user is granting consent for asynchronous operations (OAuth). This is because the host would be indeterminate.

To solve this problem, templates are scoped to a domain and a host value. For synchronous operations, the host value is specified in the url. For asynchronous operations, permissions are granted for specific host values, whose value is later specified when applying the template.

Note: There are some templates that utilize CNAME or TXT records with host values containing some form of user identification for validation of domain ownership, and these are often passed in variables.

To support this use case, variables are allowed for the host name. But only in this limited circumstance.

6.9.2. Variable Values

To allow for the use of the host name or domain name in templates, the values of %host% and %domain% are available. A third value of %fqdn% is also available. This value is the result of combining the host and domain name with the necessary ".".

For example, with the query string "domain=example.com&host=", %fqdn% in a template would be "example.com", and with "domain=example.com&host=sub1", %fqdn% in a template would be "sub1.example.com".

6.9.3. Variables and Security

As discussed, with variables consideration is necessary to prevent certain styles of phishing attacks.

The more static the value in the template record, the more secure the template. When static values are not possible, a carefully crafted link could hijack DNS settings.

Mitigations to this are discussed above.

6.9.4. Variable Examples

Example template:

[{
    "type": "CNAME",
    "host": "www",
    "pointsTo": "@",
    "ttl": 1800
},
{
    "type": "A",
    "host": "@",
    "pointsTo": "1.1.1.1",
    "ttl": 1800
}]

Template applied with domain=foo.com and host parameter missing or empty:

www 1800 IN CNAME foo.com.
@   1800 IN A 1.1.1.1

alternatively

www.foo.com.    1800 IN CNAME foo.com.
foo.com.        1800 IN A 1.1.1.1

Template applied with domain=foo.com and host=bar:

www.bar 1800 IN CNAME bar.foo.com.
bar     1800 IN A 1.1.1.1

alternatively

www.bar.foo.com.    1800 IN CNAME foo.com.
bar.foo.com.        1800 IN A 1.1.1.1

6.10. SPF TXT Record

6.10.1. What is SPF?

SPF stands for Sender Policy Framework specified in RFC7208. It is a record that specifies a list of authorized host names and/or IP addresses from which mail can originate from for a given domain name.

It manifests itself as a TXT record. The format of which starts with v=spf1 followed by a list of “rules” of what to include/exclude. If a rule passes, the mail is allowed. If it fails, it moves to the next rule. Typical record might appear as:

v=spf1 include:policy.exampleprovider.com -all

This is an SPF record with two rules. The first rule indicates that the rules for SPF record policy.exampleprovider.com be included in this record. The second rule is a catch all (_all). The default modifier for a rule is pass (+). Other modifiers are hard failure(-), soft failure (~) and neutral (?).

Note: A failure in SPF doesn’t mean delivery won’t happen, however depending on the policies of the receiving system, messages classified with hard failure or soft failure may not be delivered or marked as spam.

The use of “all” at the end is pretty common, although some providers mark it as ~ (soft fail) or ? (neutral). The reality is that a good SPF record is tuned based on what services are attached to a domain. Not just one individual service.

6.10.2. Multiple Services

If only one email sending service were active, the SPF record recommended by the provider is sufficient. But mail from a domain can often come from several different services.

A very typical use case might be end user mail and an email newsletter service. Let’s look at the SPF records recommended for individual services.

Mailer1: v=spf1 include:spf.mailer1.com –all Newsletter1: v=spf1 include:_spf.newsletter.net ~all

All of these examples use the include syntax. This is fairly common. The use of all at the end is common, although is often inconsistent with the modifier.

If a customer installed Mailer1 and Newsletter1, their combined SPF record ought to be something like:

v=spf1 include:spf.mailer1.com include:_spf.newsletter.net ~all

We combined the two rules, and in this case picked the least restrictive all modifier. Of course if no other service was sending mail, -all might be more appropriate.

6.10.3. SPF Record Merging

The challenge with SPF records and Domain Connect is that an individual service might recommend an SPF record. If only one service were active, this would be accurate. But with several services together only the DNS Provider is able to determine the valid shape of a SPF TXT record.

One solution to this problem is to merge all related records. At the highest level, this means taking everything between the “v=spf1” and the “-all” from each of the records and merging them together, terminating with hard-coded modifier on all at the end. For an SPF record to fulfill it’s purpose of protection against malicious email delivery, Domain Connect defines a fixed modifier "-" advising rejection of the messages from other sources not specified in SPF. The end user can always modify it after merge operation is completed.

@ TXT v=spf1 include:spf.mailer1.com include:_spf.newsletter.net -all

The other would be to write intermediate records, and reference these locally.

r1.example.com. TXT v=spf1 include:spf.mailer1.com –all
r2.example.com. TXT v=spf1 include:_spf.newsletter.net -all
@ TXT v=spf1 include:r1.example.com include:r2.example.com -all

There are advantages and disadvantages to both approaches. SPF records have a limit of 10 DNS lookups and record length is limited to 255 characters. So depending on the embedded records both approaches might have advantages.

The implementation would be left to the DNS Provider, but to facilitate this SPF records must NOT be included in templates. Instead, we introduce a new pseudo-record type in the template called SPFM. This has the following attribute:

spfRules

Determines the desired rules, basically everything but leading "v=spf1" and trailing all rule - see: SPF Rules

When a template is added or removed with an SPFM record in the template, some code would need to take the aggregate value of all SPFM records in all templates applied and recalculate the resulting SPF TXT record.

Due to merging step in between, the resulting SPF TXT records are considered non-essential (see: Non-essential records). That means the user may decide to override the final calculated value or remove the whole SPF record. This action must not lead to removal of any related templates in conflict detection and template integrity routines if implemented by the DNS provider.

If the existing TXT record makes the merging operation not possible, the DNS provider must handle this situation the same way as a conflict and either let the end-user resolve it in the UX (both in Synchronous and Asynchronous flow) or return the conflict as an error in the Asynchronous flow unless the force=true parameter is used, effectively removing the existing record.

Service providers should avoid exact match checking content of TXT SPF record, as it might be strongly influenced by the DNS Provider merging strategy and user actions.

6.10.4. Alternatives

Some DNS Providers may decide not to support the SPFM record. The following alternative solution should allow general interoperability of the templates for those providers: onboard the templates with SPFM record in variable-compatible form using a regular TXT record with content “v=spf1 %spfRules% -all”, using property essential=OnApply set to avoid removal of the whole template by a conflict.

6.11. Repository and Integrity

The template format is intended largely for documentation and communication between the DNS Providers and Service Providers, and there are no codified endpoints for creation or modification of these objects. Instead, Domain Connect references a template by ID.

As such, DNS Providers may or may not use templates in this format in their internal implementations.

However, by defining a standard template format, it is believed it will make it easier for Service Providers to share their configuration across DNS Providers. Further revisions of this specification may include a repository for publishing and consuming these templates. For now, templates are maintained at http://domainconnect.org.

Implementers are responsible for data integrity and should use the record type field to validate that variable input meets the criteria for each different data type.

Hard-coded host names are the responsibility of the DNS Provider to protect. That is, DNS Providers are responsible for ensuring that host names do not interfere with known values (such as m. or www. or mail.) or internal names that provide critical functionality that is outside the scope of this specification.

7. Extensions/Exclusions

Additional record types and/or extensions to records in the template can be implemented on a per DNS Provider basis. However, care should be taken when defining extensions so as to not conflict with other protocols and standards. Certain record names are reserved for use in DNS for protocols like DNSSEC (DNSKEY, RRSIG) at the registry level.

Defining these optional extensions in an open manner as part of this specification is done to provide consistency.The following are the initial optional extensions a DNS Provider/Service Provider may support.

7.1. APEXCNAME

Some Service Providers desire the behavior of a CNAME record, but in the apex record. This would allow for an A Record at the root of the domain but dynamically determined at runtime.

The recommended record type for DNS Providers that wish to support this is an APEXCNAME record. Additional fields included with this record would include pointsTo and TTL.

Defining a standard for such functionality in DNS is beyond the scope of this specification. But for DNS Providers that support this functionality, using the same record type name across DNS Providers allows template reuse.

7.2. Redirection

Some Service Providers desire a redirection service associated with the A Record. A typical example is a service that requires a redirect of the domain (e.g. example.com) to the www variant (www.example.com). The www would often contain a CNAME.

Since implementation of a redirection service is typically simple, it is recommended that service providers implement redirection on their own. But for DNS Providers that have a redirection service, supporting simple templates with this functionality may be desired.

While technically not a "record" in DNS, when supporting this optional functionality it is recommended that this should be implemented using two new record types.

REDIR301 and REDIR302 would implement 301 and 302 redirects respectively. Associated with this record would be a single field called the "target", containing the target url of the redirect.

7.3. Nameservers

Several service providers have asked for functionality supporting an update to the nameserver records at the registry associated with the domain.

When implementing this, two records should be provided. NS1 and NS2, each containing a pointsTo argument.

It will be noted that a nameserver update would require that the DNS Provider is the registrar. This is not always the case.

This functionality is again deemed as optional and up to the DNS Provider to determine if they will support this.

7.4. DS (DNSSEC)

Requests have been made to allow for updates to the DS record for DNSSEC. This record is required at the registry to enable DNSSEC, but can only be written by the registrar.

For DNS Providers that support this record, the record type should be DS. Values will be keyTag, algorithm, digestType, and digest.

Again it should be noted that a DS update would require that the DNS Provider is the registrar, and is again deemed as optional and up to the DNS Provider to determine if they will support.

8. Example Templates

Example Template
{
    "providerId": "example.com",
    "providerName": "Example Web Hosting",
    "serviceId": "hosting",
    "serviceName": "Wordpress by example.com",
    "version": 1,
    "logoUrl": "https://www.example.com/images/billthecat.jpg",
    "description": "This connects your domain to our super cool web hosting",
    "launchURL" : "https://www.example.com/connectlaunch",
    "records": [
        {
            "groupId" : "service",
            "type": "A",
            "host": "www",
            "pointsTo": "%var1%",
            "ttl": "%var2%"
        },
        {
            "groupId" : "service",
            "type": "A",
            "host": "m",
            "pointsTo": "%var3%",
            "ttl": "%var2%"
        },
        {
            "groupId" : "service",
            "type": "CNAME",
            "host": "webmail",
            "pointsTo": "%var4%",
            "ttl": "%var2%"
        },
        {
            "groupId" : "verification",
            "type": "TXT",
            "host": "example",
            "data": "%var5%",
            "ttl": "%var2%"
        }
    ]
}
Example Records: Single static host record

Consider a template for setting a single host record. The records section of the template would have a single record of type "A" and could have a value of:

[{
    "type": "A",
    "host": "www",
    "pointsTo": "192.168.1.1",
    "ttl": 600
}]

This would have no variable substitution and the application of this template to a domain would simply set the host name "www" to the IP address "192.168.1.1"

Example Records: Single variable host record for A

In the case of a template for setting a single host record from a variable, the template would have a single record of type "A" and could have a value of:

[{
    "type": "A",
    "host": "@",
    "pointsTo": "192.168.1.%srv%",
    "ttl": 600
}]

A query string with a key/value pair of

srv=2

would cause the application of this template to a domain to set the host name for the apex A record to the IP address "192.168.1.2" with a TTL of 600

Example: DNS Zone merging

Consider a DNS Zone before a template application:

$ORIGIN test-domain.com.

@ 3600 IN SOA ns11.acme.net. support.acme.net. 2017050817 7200 1800
1209600 3600
@ 3600 IN NS ns11.acme.net.
@ 3600 IN NS ns12.acme.net.
@ 3600 IN A 1.1.1.1
@ 3600 IN A 1.1.1.2
@ 3600 IN AAAA 2001:db8:1234:0000:0000:0000:0000:0000
@ 3600 IN AAAA 2001:db8:1234:0000:0000:0000:0000:0001
@ 3600 IN MX 10 mx1.acme.net.
@ 3600 IN MX 10 mx2.acme.net.
@ 3600 IN TXT "v=spf1 a include: spf.acme.com ~all"
www 3600 IN CNAME other.host.com.

Now application of the following template:

[
    {
        "type":"A",
        "host":"@",
        "pointsTo":"2.2.2.2",
        "ttl":"1800"
    },
    {
        "type":"A",
        "host":"www",
        "pointsTo":"2.2.2.2",
        "ttl":"1800"
    },
    {
        "type":"SPFM",
        "host":"@",
        "spfRules":"a include: spf.hoster.com"
    }
]

The following DNS Zone should be generated after the template is applied:

$ORIGIN test-domain.com.

@ 3600 IN SOA ns11.acme.net. support.acme.net. 2017050920 7200 1800
1209600 3600
@ 3600 IN NS ns11.acme.net.
@ 3600 IN NS ns12.acme.net.
@ 1800 IN A 2.2.2.2
@ 3600 IN MX 10 mx1.acme.net.
@ 3600 IN MX 10 mx2.acme.net.
@ 1800 IN TXT "v=spf1 a include: spf.acme.com include:spf.hoster.com ~all"
www 1800 IN A 2.2.2.2
Example: SPF Record Merging

Consider a DNS Zone before a template application:

$ORIGIN test-domain.com.

@ 3600 IN SOA ns11.acme.net. support.acme.net. 2017050817 7200 1800
1209600 3600
@ 3600 IN NS ns11.acme.net.
@ 3600 IN NS ns12.acme.net.

Now application of the following template of Mail service:

[
    {
        "type":"MX",
        "host":"@",
        "priority": "10",
        "pointsTo":"mx1.acme.net",
        "ttl":"1800"
    },
    {
        "type":"MX",
        "host":"www",
        "priority": "10",
        "pointsTo":"mx2.acme.net",
        "ttl":"1800"
    },
    {
        "type":"SPFM",
        "host":"@",
        "spfRules":"a include:spf.acme.net"
    }
]

Expected result in the DNS Zone

$ORIGIN test-domain.com.

@ 3600 IN SOA ns11.acme.net. support.acme.net. 2017050817 7200 1800
1209600 3600
@ 3600 IN NS ns11.acme.net.
@ 3600 IN NS ns12.acme.net.
@ 3600 IN MX 10 mx1.acme.net.
@ 3600 IN MX 10 mx2.acme.net.
@ 3600 IN TXT "v=spf1 a include:spf.acme.net -all"

In the next step application of the following template of Newsletter service:

[
    {
        "type":"SPFM",
        "host":"@",
        "spfRules":"include:_spf.newsletter.com"
    }
]

Expected result in the DNS Zone

$ORIGIN test-domain.com.

@ 3600 IN SOA ns11.acme.net. support.acme.net. 2017050817 7200 1800
1209600 3600
@ 3600 IN NS ns11.acme.net.
@ 3600 IN NS ns12.acme.net.
@ 3600 IN MX 10 mx1.acme.net.
@ 3600 IN MX 10 mx2.acme.net.
@ 3600 IN TXT "v=spf1 a include:spf.acme.net include:_spf.newsletter.com -all"
You can’t perform that action at this time.