Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:dns-bind [31/08/2014 15:22] Hypathie [Introduction au DNS] |
utilisateurs:hypathie:tutos:dns-bind [31/08/2014 16:31] Hypathie [Générer une clé d'authentification avec l'utilitaire rndc] |
||
---|---|---|---|
Ligne 51: | Ligne 51: | ||
(Version 10 depuis 2013 intègre le DHCP.) | (Version 10 depuis 2013 intègre le DHCP.) | ||
- | ===Le programme qui lance le server : /usr/sbin/named=== | + | ===/usr/sbin/named=== |
+ | Le programme qui lance le server. | ||
- | ===L'utilitaire de contrôle : /usr/sbin/rndc=== | + | === /usr/sbin/rndc=== |
+ | rndc est un utilitaire de contrôle. | ||
- | ===Le fichier de configuration centrale : /etc/bind/named.conf=== | + | <code> |
+ | rndc |b source-adress] [-c config-file] [k key-file] [-s serveur] | ||
+ | [-p port] [-V] [-y key-id] {commande} | ||
+ | </code> | ||
+ | -> commandes : | ||
+ | |||
+ | **''reload''** : pour recharger\\ | ||
+ | **''stop''** : arrêter le serveur\\ | ||
+ | **''flush''** : vider le cache\\ | ||
+ | **''status''** : afficher l'état du serveur\\ | ||
+ | **aucune** : liste des commandes utilisables | ||
+ | |||
+ | |||
+ | === /etc/bind/named.conf=== | ||
+ | C'est le fichier de configuration centrale de bind.\\ | ||
Il peut se trouver dans différents dossiers (sécurité, chroot) par exemple dans /etc/named.conf ou /etc/\\ | Il peut se trouver dans différents dossiers (sécurité, chroot) par exemple dans /etc/named.conf ou /etc/\\ | ||
- | *On peut externaliser certaines points de configuration de ce fichier central dans des fichiers;\\ **/etc/bind/named.conf.local**\\ **/etc/bind/named.conf.options** | + | On peut externaliser certaines points de configuration de ce fichier central dans des fichiers;\\ **/etc/bind/named.conf.local**\\ **/etc/bind/named.conf.options** |
+ | |||
+ | ===/etc/init.d/bind=== | ||
+ | Ils 'agit d'un init script qui permet de redémarrer bind : | ||
+ | |||
+ | <code root>/etc/init.d/bind9 restart</code> | ||
- | ===Il y a un init script : /etc/init.d/bind=== | ||
- | ===Un répertoire de travail : /var/named/ === | + | === /var/named/ === |
+ | Il s'agit d'un répertoire de travail. | ||
====Syntaxe des fichiers de configuration ==== | ====Syntaxe des fichiers de configuration ==== | ||
Ligne 475: | Ligne 496: | ||
Pour utiliser rmdc à distance mettre sur la machine qui génère rndc les info données en sortie par la commande rndc-confgen à mettre dans **rndc.conf** et sur le serveur distant les infos à mettre dans **named.conf**. | Pour utiliser rmdc à distance mettre sur la machine qui génère rndc les info données en sortie par la commande rndc-confgen à mettre dans **rndc.conf** et sur le serveur distant les infos à mettre dans **named.conf**. | ||
- | * La commande rndc : | ||
- | |||
- | <code> | ||
- | rndc |b source-adress] [-c config-file] [k key-file] [-s serveur] | ||
- | [-p port] [-V] [-y key-id] {commande} | ||
- | </code> | ||
- | -> commandes : | ||
- | |||
- | **''reload''** : pour recharger\\ | ||
- | **''stop''** : arrêter le serveur\\ | ||
- | **''flush''** : vider le cache\\ | ||
- | **''status''** : afficher l'état du serveur\\ | ||
- | **''start''** : /etc/init.d/bind9 start | ||
- | **aucune** : liste des commandes utilisables | ||
</note> | </note> | ||
Ligne 507: | Ligne 514: | ||
* Générer une clé : | * Générer une clé : | ||
- | <code root>rndc-confgen</code> | + | <code root>rndc-confgen >/etc/bind/rndc.key</code> |
- | <code> | + | |
- | # Start of rndc.conf | + | |
- | key "rndc-key" { | + | |
- | algorithm hmac-md5; | + | |
- | secret "xxxxxxxxxxxxxxxxxxxx"; | + | |
- | }; | + | |
- | options { | + | * Ajouter la nouvelle clé à la fin de /etc/bind/named.conf : |
- | default-key "rndc-key"; | + | <code root>tail /etc/bind/rndc.key >> named.conf</code> |
- | default-server 127.0.0.1; | + | |
- | default-port 953; | + | |
- | }; | + | |
- | # End of rndc.conf | + | |
- | # Use with the following in named.conf, adjusting the allow list as needed: | + | * Éditer /etc/bind/named.conf: |
- | # key "rndc-key" { | + | <code root>vim /etc/bind/named.conf</code> |
- | # algorithm hmac-md5; | + | <code>include "/etc/bind/named.conf.options"; |
- | # secret "xxxxxxxxxxxxxxxxxxxxxx"; | + | include "/etc/bind/named.conf.local"; |
- | # }; | + | //include "/etc/bind/named.conf.default-zones"; |
- | # | + | key "rndc-key" { |
- | # controls { | + | algorithm hmac-md5; |
- | # inet 127.0.0.1 port 953 | + | secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
- | # allow { 127.0.0.1; } keys { "rndc-key"; }; | + | }; |
- | # }; | + | |
+ | controls { | ||
+ | inet 127.0.0.1 port 953 | ||
+ | allow { 127.0.0.1; } keys { "rndc-key"; }; | ||
+ | }; | ||
# End of named.conf | # End of named.conf | ||
</code> | </code> | ||
- | -> Le retour de cette commande a deux parties ;\\ | ||
- | |||
- | -> Copier la première partie du retour\\ | ||
- | dans les fichiers **''/etc/rndc.conf''** et **''/etc/rndc.key''** (qu'il faut créer). | ||
- | |||
- | -> Copier dans **''/etc/named.conf''** la deuxième partie du retour.\\ | ||
- | |||
- | |||
- | * Création du fichier **/etc/rndc.conf** et copie de la première partie de la commande "rndc-confgen" : | ||
- | <code root>vim /etc/rndc.conf</code> | + | * Éditer /etc/bind/rndc.key : |
+ | <code root>vim /etc/bind/rndc.key</code> | ||
<code># Start of rndc.conf | <code># Start of rndc.conf | ||
key "rndc-key" { | key "rndc-key" { | ||
- | algorithm hmac-md5; | + | algorithm hmac-md5; |
- | secret "xxxxxxxxxxxxxxxxxxxxx"; | + | secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
}; | }; | ||
#options { | #options { | ||
- | # default-key "rndc-key"; | + | # default-key "rndc-key"; |
- | # default-server 127.0.0.1; | + | # default-server 127.0.0.1; |
- | # default-port 953; | + | # default-port 953; |
#}; | #}; | ||
- | # End of rndc.conf</code> | + | # End of rndc.conf |
- | *Création de **/etc/rndc.key** et copie de la première partie de la commande "rndc-confgen": | ||
- | <code root>vim /etc/rndc.key</code> | ||
- | |||
- | Création de /etc/named/conf et copie de la deuxième partie du retour : | ||
- | <code root>vim /etc/named.conf</code> | ||
- | <code> | ||
# Use with the following in named.conf, adjusting the allow list as needed: | # Use with the following in named.conf, adjusting the allow list as needed: | ||
- | key "rndc-key" { | + | # key "rndc-key" { |
- | algorithm hmac-md5; | + | # algorithm hmac-md5; |
- | secret "xxxxxxxxxxxxxxxxx"; | + | # secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
- | }; | + | # }; |
+ | # | ||
# controls { | # controls { | ||
- | # inet 127.0.0.1 port 953 | + | # inet 127.0.0.1 port 953 |
- | # allow { 127.0.0.1; } keys { "rndc-key"; }; | + | # allow { 127.0.0.1; } keys { "rndc-key"; }; |
# }; | # }; | ||
# End of named.conf | # End of named.conf | ||
</code> | </code> | ||
+ | ===Configurer les zones qui utilise la clé === | ||
- | ===Configuration de /etc/bind/named.conf === | + | * Éditer /etc/bind/named/conf.local : |
- | <code root>vim /etc/bind/named.conf</code> | + | <code root>vim /etc/bind/named.conf.local</code> |
- | <code> | + | <code>// |
- | include "/etc/bind/named.conf.options"; | + | // Do any local configuration here |
- | include "/etc/bind/named.conf.local"; | + | // |
- | //include "/etc/bind/named.conf.default-zones"; | + | |
- | include "/etc/rndc.key"; | + | |
- | controls { | + | // Consider adding the 1918 zones here, if they are not used in your |
- | inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; }; | + | // organization |
+ | //include "/etc/bind/zones.rfc1918"; | ||
+ | zone "mondomaine.hyp" { | ||
+ | type master; | ||
+ | file "/etc/bind/db.mondomaine.hyp"; | ||
+ | allow-update {key rndc-key;}; | ||
+ | }; | ||
+ | zone "0.168.192.in-addr.arpa" { | ||
+ | type master; | ||
+ | file "/etc/bind/db.192"; | ||
+ | allow-update {key rndc-key;}; | ||
}; | }; | ||
</code> | </code> | ||
+ | ===Relancer bind9=== | ||
- | ===Créer /etc/bind/rndc.conf et /etc/bind/rndc.key=== | + | <code root>/etc/init.d/bind9 restart</code> |
- | + | <code>[....] Stopping domain name service...: bind9rndc: connection to remote host closed | |
- | <code root>cp /etc/rndc.conf /etc/bind/rndc.conf | + | This may indicate that |
- | </code> | + | * the remote server is using an older version of the command protocol, |
- | + | * this host is not authorized to connect, | |
- | <code root>cp /etc/rndc.key /etc/bind/rndc.key</code> | + | * the clocks are not synchronized, or |
- | + | * the key is invalid. | |
- | ===Relancer bind === | + | waiting for pid 4979 to die |
- | + | ||
- | <code root>service bind9 restart</code> | + | |
- | <code>[....] Stopping domain name service...: bind9WARNING: key file (/etc/bind/rndc.key) exists, but using default configuration file (/etc/bind/rndc.conf) | + | |
- | rndc: no server specified and no default | + | |
. ok | . ok | ||
- | [ ok ] Starting domain name service...: bind9. | + | [ ok ] Starting domain name service...: bind9.</code> |
- | </code> | + | |
- | <note> | ||
- | *Vérifier la configuration : | ||
- | |||
- | <code root>named-checkconf /etc/named.conf</code> | ||
- | >Tout est bon, s'il y a retour du prompt. | ||
- | |||
- | </note> | ||
- | |||
- | * Redémarrer le service nommé. | ||
- | <code root>rndc reload</code> | ||
- | <note tip> | ||
- | Pour un server distant\\ | ||
- | |||
- | Utiliser la première partie de la commande **''rndc-confgen''** qui est à copier dans **''rndc.conf''** sur la machine qui lance rndc;\\ | ||
- | et la deuxième partie cette commande est à copier dans **''named.conf''** sur le serveur distant. | ||
- | </note> | ||