2017-11-10 20:02:34 +01:00
## Configuration
2022-05-08 14:41:33 -04:00
To use this provider, add an entry to `creds.json` with `TYPE` set to `OVH`
2023-11-28 00:18:24 +01:00
along with a OVH app-key, app-secret-key, consumer-key and optionally endpoint.
2022-05-08 14:41:33 -04:00
Example:
2017-11-10 20:02:34 +01:00
2023-03-02 22:17:27 +01:00
{% code title="creds.json" %}
2022-02-17 18:22:31 +01:00
```json
2017-11-10 20:02:34 +01:00
{
2022-05-08 14:41:33 -04:00
"ovh": {
"TYPE": "OVH",
2017-11-10 20:02:34 +01:00
"app-key": "your app key",
"app-secret-key": "your app secret key",
2023-11-28 00:18:24 +01:00
"consumer-key": "your consumer key",
"endpoint": "eu"
2017-11-10 20:02:34 +01:00
}
}
2022-02-17 18:22:31 +01:00
```
2023-03-02 22:17:27 +01:00
{% endcode %}
2017-11-10 20:02:34 +01:00
See [the Activation section ](#activation ) for details on obtaining these credentials.
2023-11-28 00:18:24 +01:00
`endpoint` can take the following values:
* `eu` (the default), for connecting to the OVH European endpoint
* `ca` for connecting to OVH Canada API endpoint
* `us` for connecting to the OVH USA API endpoint
* an url for connecting to a different endpoint than the ones above
2017-11-10 20:02:34 +01:00
## Metadata
This provider does not recognize any special metadata fields unique to OVH.
## Usage
2023-03-11 14:42:01 +01:00
An example configuration: (DNS hosted with OVH):
2022-02-17 18:22:31 +01:00
2023-03-11 14:42:01 +01:00
{% code title="dnsconfig.js" %}
2023-01-20 13:56:20 +01:00
```javascript
2022-05-08 14:41:33 -04:00
var REG_OVH = NewRegistrar("ovh");
var DSP_OVH = NewDnsProvider("ovh");
2017-11-10 20:02:34 +01:00
2023-06-17 14:58:17 +02:00
D("example.com", REG_OVH, DnsProvider(DSP_OVH),
2022-05-08 14:41:33 -04:00
A("test", "1.2.3.4")
2017-11-10 20:02:34 +01:00
);
2022-02-17 18:22:31 +01:00
```
2023-03-11 14:42:01 +01:00
{% endcode %}
2017-11-10 20:02:34 +01:00
2023-03-11 14:42:01 +01:00
An example configuration: (Registrar only. DNS hosted elsewhere)
2017-11-10 20:02:34 +01:00
2023-03-11 14:42:01 +01:00
{% code title="dnsconfig.js" %}
2023-01-20 13:56:20 +01:00
```javascript
2022-05-08 14:41:33 -04:00
var REG_OVH = NewRegistrar("ovh");
var DSP_R53 = NewDnsProvider("r53");
2017-11-10 20:02:34 +01:00
2023-06-17 14:58:17 +02:00
D("example.com", REG_OVH, DnsProvider(DSP_R53),
2022-05-08 14:41:33 -04:00
A("test", "1.2.3.4")
2017-11-10 20:02:34 +01:00
);
2022-02-17 18:22:31 +01:00
```
2023-03-11 14:42:01 +01:00
{% endcode %}
2017-11-10 20:02:34 +01:00
## Activation
To obtain the OVH keys, one need to register an app at OVH by following the
2018-12-19 21:06:41 +01:00
[OVH API Getting Started ](https://docs.ovh.com/gb/en/customer/first-steps-with-ovh-api/ )
2017-11-10 20:02:34 +01:00
It consist in declaring the app at https://eu.api.ovh.com/createApp/
2023-11-28 00:18:24 +01:00
which gives the `app-key` and `app-secret-key` . If your domains and zones are located in another region, see below for the correct url to use.
2017-11-10 20:02:34 +01:00
Once done, to obtain the `consumer-key` it is necessary to authorize the just created app
to access the data in a specific account:
2023-01-20 13:56:20 +01:00
```shell
2017-11-10 20:02:34 +01:00
curl -XPOST -H"X-Ovh-Application: < you-app-key > " -H "Content-type: application/json" https://eu.api.ovh.com/1.0/auth/credential -d'{
"accessRules": [
{
"method": "DELETE",
"path": "/domain/zone/*"
},
{
"method": "GET",
"path": "/domain/zone/*"
},
{
"method": "POST",
"path": "/domain/zone/*"
},
{
"method": "PUT",
"path": "/domain/zone/*"
},
{
"method": "GET",
"path": "/domain/*"
},
{
"method": "PUT",
"path": "/domain/*"
},
{
"method": "POST",
"path": "/domain/*/nameServers/update"
}
]
}'
2022-02-17 18:22:31 +01:00
```
2017-11-10 20:02:34 +01:00
It should return something akin to:
2022-02-17 18:22:31 +01:00
2023-03-02 22:17:27 +01:00
{% code title="creds.json" %}
2022-02-17 18:22:31 +01:00
```json
2017-11-10 20:02:34 +01:00
{
"validationUrl": "https://eu.api.ovh.com/auth/?credentialToken=< long-token > ",
"consumerKey": "< your-consumer-key > ",
"state": "pendingValidation"
}
2022-02-17 18:22:31 +01:00
```
2023-03-02 22:17:27 +01:00
{% endcode %}
2017-11-10 20:02:34 +01:00
2019-05-11 21:32:52 -04:00
Open the "validationUrl" in a browser and log in with your OVH account. This will link the app with your account,
2017-11-10 20:02:34 +01:00
authorizing it to access your zones and domains.
Do not forget to fill the `consumer-key` of your `creds.json` .
2023-11-28 00:18:24 +01:00
For accessing the other international endpoints such as US and CA, change the `https://eu.api.ovh.com` used above to one of the following:
* Canada endpoint: `https://ca.api.ovh.com`
* US endpoint: `https://api.us.ovhcloud.com`
Do not forget to fill the `endpoint` of your `creds.json` if you use an endpoint different than the EU one.
2017-11-10 20:02:34 +01:00
## New domains
If a domain does not exist in your OVH account, DNSControl
will *not* automatically add it. You'll need to do that via the
control panel manually.
## Dual providers scenario
2021-12-20 17:20:17 +01:00
OVH now allows to host DNS zone for a domain that is not registered in their registrar (see: https://www.ovh.com/manager/web/#/zone ). The following dual providers scenario are supported:
2017-11-10 20:02:34 +01:00
| registrar | zone | working? |
|:---------:|:-----------:|:--------:|
| OVH | other | √ |
| OVH | OVH + other | √ |
2021-12-20 17:20:17 +01:00
| other | OVH | √ |
2017-11-10 20:02:34 +01:00
2023-12-18 15:14:01 +01:00
## Caveats
2017-11-10 20:02:34 +01:00
2023-12-18 15:14:01 +01:00
* OVH doesn't allow resetting the zone to the OVH DNS through the API. If for any reasons OVH NS entries were
2017-11-10 20:02:34 +01:00
removed the only way to add them back is by using the OVH Control Panel (in the DNS Servers tab, click on the "Reset the
DNS servers" button.
2023-12-18 15:14:01 +01:00
* There may be a slight delay (1-10 minutes) before your modifications appear in the OVH Control Panel. However it seems that it's only cosmetic - the changes are indeed available at the DNS servers. You can confirm that the changes are taken into account by OVH by choosing "Change in text format", and see in the BIND compatible format that your changes are indeed there. And you can confirm by directly asking the DNS servers (e.g. with `dig` ).
* OVH enforces the [Restrictions on valid hostnames ](https://en.wikipedia.org/wiki/Hostname#Syntax ). A hostname with an underscore ("_") will cause the following error `FAILURE! OVHcloud API error (status code 400): Client::BadRequest: "Invalid domain name, underscore not allowed"`