====== DNS ====== ---- ===== Bind9 sur Ubuntu Server 20.04 ===== ==== Installation ==== sudo apt-get install bind9 dnsutils ==== Configuration ==== === named.conf.default-zones === Modifier le fichier /etc/bind/named.conf.default-zones et ajouter la zone à gérer ainsi que a zone inverse : zone "acs.altran.com" { type master; file "/var/cache/bind/db.acs"; allow-transfer {10.1.2.11; 10.1.2.12; 10.0.2.31; 10.0.2.32; 10.0.2.19; 10.0.2.20; 10.0.2.9; 10.0.2.10; 10.0.2.11; }; }; zone "10.in-addr.arpa" { type master; notify no; file "/var/cache/bind/db.10.1.242"; allow-transfer {10.1.2.11; 10.1.2.12; 10.0.2.31; 10.0.2.32; 10.0.2.19; 10.0.2.20; 10.0.2.9; 10.0.2.10; 10.0.2.11; }; }; === named.conf.options === Modifier le fichier /etc/bind/named.conf.options options { directory "/var/cache/bind"; listen-on port 53 { 127.0.0.1; any; }; allow-transfer {"none";}; allow-query { any; }; recursion yes; auth-nxdomain no; # conform to RFC1035 forwarders { 10.1.2.11; 10.1.2.12; }; dnssec-validation auto; listen-on-v6 { any; }; }; ==== Mise à jour par clef ==== Le fichier db doit être dans /var/cache/bind et non pas dans /etc/bind qui n’est pas accessible à l’utilisateur bind (sécurité gérée par AppArmor). === Génération de la clef === ddns-confgen -z acs.altran.com === Fichier key === Ajouter la clef dans un fichier /etc/bind/acs.altran.com.key key "ddns-key.acs.altran.com" { algorithm hmac-sha256; secret "aVIWOfoDk1pH6c0jj7vKJ49PWXV6SHjq+1kob4Yo0mE="; }; === named.conf.local === Inclure le fichier key dans le fichier /etc/bind/named.conf.local include "/etc/bind/acs.altran.com.key"; === Autoriser la mise à jour par clef === Ajouter la ligne suivante dans la zone correspondante dans le fichier /etc/bind/named.conf.default-zones update-policy { grant ddns-key.acs.altran.com zonesub ANY; }; === Utilisation === nsupdate -k /etc/bind/acs.altran.com.key< La mise à jour se fait dans le cache puis au bout d’un certain temps dans le fichier /var/cache/bind/db.acs ---- [[https://doc.ubuntu-fr.org/bind9| Sources]] ---- [[all:bibles:linux:serveur:dns|Haut de page]]