Add local knot binding
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2023-02-09 09:26:31 +01:00
parent fc9b507054
commit e88b17a5dc
3 changed files with 215 additions and 0 deletions

108
content/deploy/knot.en.md Normal file
View File

@ -0,0 +1,108 @@
---
data: 2023-02-09T09:12:25+01:00
title: Connect to a local knot
weight: 21
---
[Knot](https://knot-dns.cz) is an authoritative DNS server developed by the [cz.nic](https://nic.cz) association.
It is possible to use it with happyDomain through [Dynamic DNS (RFC 2136)](https://www.rfc-editor.org/rfc/rfc2136).
## Configure Knot to enable Dynamic DNS
First, you have to edit the main knot configuration file (usually `/etc/knot/knot.conf`) to add a secret that will be shared between happyDomain and knot to authenticate the changes. Then you have to indicate which domains will be managed by happyDomain.
### Adding a shared secret {#shared-secret}
Under the main [`key`](https://knot.readthedocs.io/en/latest/reference.html#key-section) section of your configuration, add the following key:
```yaml
key:
[...]
- id: happydomain
algorithm: hmac-sha512
secret: "<SOME_SECRET>"
```
Obviously replace `<SOME_SECRET>` with a string as obtained with `openssl rand -base64 48`.
### Creating an authorization rule for happyDomain
In addition to the key, you must specify in the configuration how the key can be used.
To do this, under the main [`acl`](https://knot.readthedocs.io/en/latest/reference.html#acl-section) section, we add:
```yaml
acl:
[...]
- id: acl_happydomain
key: happydomain
action: transfer
action: update
```
This associates the `key` defined just before with the actions `transfer` and `update`, respectively to allow retrieving the zone and to update records.
### Associate the authorization to each zone
Now that you have created a rule allowing the `happydomain` key to make changes, you need to indicate to which zones this rule applies.
For each [zone](https://knot.readthedocs.io/en/latest/reference.html#zone-section), you must add an [`acl`](https://knot.readthedocs.io/en/latest/reference.html#acl) element referencing the `acl_happydomain` rule:
For example, for an existing `happydomain.org` zone, we will add the `acl` line as follows:
```yaml
zone:
[...]
- domain: happydomain.org
acl:
- acl_happydomain
[...]
```
The `acl` element is a list, so you may already have other acl elements in this list. In this case you just need to add the `acl_happydomain` element to the already existing list.
You have to add this `acl` element for each zone, unless you use the following trick.
### Associate the authorization to all zones
If you manage many zones, it may be more convenient to set the default authorization for all zones. In this case, instead of the previous section, we will modify the `default` template:
```yaml
template:
- id: default
acl:
- acl_happydomain
[...]
```
The `default` template is applied to all zones by default. By doing so, all zones will inherit the `acl_happydomain` rule.
### Apply the configuration
Now that the configuration file has been modified, tell `knotd` to reload its configuration:
```sh
knotc reload
```
## Link happyDomain and knot
Once `knot` well configured, you can link it to happyDomain using [the *Dynamic DNS* connector]({{< ref "/pages/source-new-choice.md" >}}) :
![The Dynamic DNS connector on the host selection page](/img/choose-dynamic-dns.png)
Then fill in the form with the address where your `knot` server is accessible, then fill in the different *Key* fields with [the information from the `knot`'s `key` section](#shared-secret):
- **Key Name** : corresponds to `id` in knot's configuration ;
- **Key Algorithm** : corresponds to `algorithm` ;
- **Secret Key** : corresponds to `secret`.
Once the provider is added, it does not allow you to list existing domains, but you can still manually add all your domains.

107
content/deploy/knot.fr.md Normal file
View File

@ -0,0 +1,107 @@
---
data: 2023-02-09T08:03:25+01:00
title: Connexion à un knot local
weight: 21
---
[Knot](https://knot-dns.cz) est un serveur DNS faisant autorité développé par l'association [cz.nic](https://nic.cz).
Il est possible de l'utiliser avec happyDomain en passant par le [Dynamic DNS (RFC 2136)](https://www.rfc-editor.org/rfc/rfc2136).
## Configurer Knot pour permettre le Dynamic DNS
Tout d'abord, il faut éditer le fichier de configuration principal de knot (généralement `/etc/knot/knot.conf`) afin d'ajouter un secret qui sera partagé entre happyDomain et knot pour authentifier les modifications. Puis il faudra indiquer quels domaines vont être gérés par happyDomain.
### Ajout d'un secret partagé {#shared-secret}
Sous la section principale [`key`](https://knot.readthedocs.io/en/latest/reference.html#key-section) de votre configuration, ajoutez la clef suivante :
```yaml
key:
[...]
- id: happydomain
algorithm: hmac-sha512
secret: "<SOME_SECRET>"
```
Remplacez évidemment `<SOME_SECRET>` par une chaîne de caractères telle qu'obtenue avec `openssl rand -base64 48`.
### Création d'une autorisation pour happyDomain
En plus de la clef, vous devez préciser dans la configuration comment la clef peut être utilisée.
Pour cela, sous la section principale [`acl`](https://knot.readthedocs.io/en/latest/reference.html#acl-section), on ajoute :
```yaml
acl:
[...]
- id: acl_happydomain
key: happydomain
action: transfer
action: update
```
Cela associe la `key` définie juste avant aux actions `transfer` et `update`, respectivement pour permettre de récupérer la zone et pour mettre à jour des enregistrements.
### Associer l'autorisation à chaque zone
Maintenant que vous avez créé une règle autorisant la clef `happydomain` à apporter des modifications, il faut indiquer à quelles zones cette règle s'applique.
Pour chaque [zone](https://knot.readthedocs.io/en/latest/reference.html#zone-section), il faut ajouter un élément [`acl`](https://knot.readthedocs.io/en/latest/reference.html#acl) référençant la règle `acl_happydomain` :
Par exemple, pour une zone `happydomain.org` déjà existante, on ajoutera la ligne `acl` comme suit :
```yaml
zone:
[...]
- domain: happydomain.org
acl:
- acl_happydomain
[...]
```
L'élément `acl` est une liste, vous pouvez donc avoir déjà d'autres éléments `acl` dans cette liste. Il convient alors d'ajouter simplement l'élément `acl_happydomain` à la liste déjà existante.
Il faut ajouter cet élément `acl` pour chaque zone, sauf à utiliser l'astuce suivante.
### Associer l'autorisation à toutes les zones
Si vous gérez de nombreuses zones, il peut être plus pratique de définir l'autorisation par défaut pour toutes les zones. Dans ce cas, à la place de la section précédente, on modifiera le modèle `default` :
```yaml
template:
- id: default
acl:
- acl_happydomain
[...]
```
Le modèle `default` est appliqué par défaut à toutes les zones. En faisant ainsi, toutes les zones hériteront de la règle `acl_happydomain`.
### Appliquer la configuration
Maintenant que le fichier de configuration a été modifié, indiquez à `knotd` qu'il doit recharger sa configuration :
```sh
knotc reload
```
## Liaison entre happyDomain et knot
Une fois `knot` bien configuré, vous pouvez le relier à happyDomain en utilisant [le connecteur *Dynamic DNS*]({{< ref "/pages/source-new-choice.md" >}}) :
![Le connecteur Dynamic DNS sur la page de choix de l'hébergeur](/img/choose-dynamic-dns.png)
Remplissez ensuite le formulaire avec l'adresse à laquelle votre serveur `knot` est accessible, puis ensuite les différents champs *Key* avec [les informations de la section `key` de `knot`](#shared-secret) :
- **Key Name** : correspond au champ `id` ;
- **Key Algorithm** : correspond au champ `algorithm` ;
- **Secret Key** : correspond au champ `secret`.
Une fois le fournisseur ajouté, il ne permet pas de lister les domaines existants, mais vous pouvez tout de même ajouter manuellement tous vos domaines.

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB