informatique:linux:powerdns
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| informatique:linux:powerdns [2024/04/12 07:52] – [Base de données] benoit | informatique:linux:powerdns [2024/04/12 11:00] (Version actuelle) – [Installation] benoit | ||
|---|---|---|---|
| Ligne 11: | Ligne 11: | ||
| Installation : | Installation : | ||
| - | apt-get install pdns-server pdns-tools pdns-backend-mysql | + | apt-get install pdns-server |
| + | Description des composants installés : | ||
| + | * **pdns-server** : Serveur DNS privé | ||
| + | * **pdns-recursor** : Serveur DNS pour les requêtes recursives vers internet | ||
| + | * **dnsdist** : Loadbalancer DNS pouvant utiliser des ACL | ||
| + | * **pdns-tools** : Utilitaire pour PowerDNS | ||
| + | * **pdns-backend-mysql** : Module pour utiliser MariaDB en backend | ||
| + | * **mariadb-client, | ||
| + | * **lua-sql-mysql** | ||
| + | |||
| + | |||
| ===== Configuration ===== | ===== Configuration ===== | ||
| ==== Base de données ==== | ==== Base de données ==== | ||
| + | |||
| + | Créer la base de données : | ||
| mysql | mysql | ||
| create database powerdns; | create database powerdns; | ||
| GRANT ALL PRIVILEGES on powerdns.* to ' | GRANT ALL PRIVILEGES on powerdns.* to ' | ||
| FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
| + | QUIT; | ||
| + | |||
| + | Créer le fichier de structure de base de données : | ||
| + | vim schema_powerdns.sql | ||
| + | |||
| + | Insérer le contenu suivant : | ||
| + | CREATE TABLE domains ( | ||
| + | id INT AUTO_INCREMENT, | ||
| + | name VARCHAR(255) NOT NULL, | ||
| + | master | ||
| + | last_check | ||
| + | type VARCHAR(8) NOT NULL, | ||
| + | notified_serial | ||
| + | account | ||
| + | options | ||
| + | catalog | ||
| + | PRIMARY KEY (id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE UNIQUE INDEX name_index ON domains(name); | ||
| + | CREATE INDEX catalog_idx ON domains(catalog); | ||
| + | | ||
| + | | ||
| + | CREATE TABLE records ( | ||
| + | id BIGINT AUTO_INCREMENT, | ||
| + | domain_id | ||
| + | name VARCHAR(255) DEFAULT NULL, | ||
| + | type VARCHAR(10) DEFAULT NULL, | ||
| + | content | ||
| + | ttl INT DEFAULT NULL, | ||
| + | prio INT DEFAULT NULL, | ||
| + | disabled | ||
| + | ordername | ||
| + | auth TINYINT(1) DEFAULT 1, | ||
| + | PRIMARY KEY (id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE INDEX nametype_index ON records(name, | ||
| + | CREATE INDEX domain_id ON records(domain_id); | ||
| + | CREATE INDEX ordername ON records (ordername); | ||
| + | | ||
| + | | ||
| + | CREATE TABLE supermasters ( | ||
| + | ip VARCHAR(64) NOT NULL, | ||
| + | nameserver | ||
| + | account | ||
| + | PRIMARY KEY (ip, nameserver) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | | ||
| + | CREATE TABLE comments ( | ||
| + | id INT AUTO_INCREMENT, | ||
| + | domain_id | ||
| + | name VARCHAR(255) NOT NULL, | ||
| + | type VARCHAR(10) NOT NULL, | ||
| + | modified_at | ||
| + | account | ||
| + | comment | ||
| + | PRIMARY KEY (id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE INDEX comments_name_type_idx ON comments (name, type); | ||
| + | CREATE INDEX comments_order_idx ON comments (domain_id, modified_at); | ||
| + | | ||
| + | | ||
| + | CREATE TABLE domainmetadata ( | ||
| + | id INT AUTO_INCREMENT, | ||
| + | domain_id | ||
| + | kind VARCHAR(32), | ||
| + | content | ||
| + | PRIMARY KEY (id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind); | ||
| + | | ||
| + | | ||
| + | CREATE TABLE cryptokeys ( | ||
| + | id INT AUTO_INCREMENT, | ||
| + | domain_id | ||
| + | flags INT NOT NULL, | ||
| + | active | ||
| + | published | ||
| + | content | ||
| + | PRIMARY KEY(id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE INDEX domainidindex ON cryptokeys(domain_id); | ||
| + | | ||
| + | | ||
| + | CREATE TABLE tsigkeys ( | ||
| + | id INT AUTO_INCREMENT, | ||
| + | name VARCHAR(255), | ||
| + | algorithm | ||
| + | secret | ||
| + | PRIMARY KEY (id) | ||
| + | ) Engine=InnoDB CHARACTER SET ' | ||
| + | | ||
| + | CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, | ||
| + | |||
| + | ==== PowerDNS ==== | ||
| + | |||
| + | Sauvegarde le fichier de conf par défaut, créer un nouveau et l' | ||
| + | mv / | ||
| + | touch / | ||
| + | chown root:pdns / | ||
| + | vim / | ||
| + | |||
| + | Insérer le contenu suivant : | ||
| + | # Backend MySQL | ||
| + | launch=gmysql | ||
| + | # Listening IP | ||
| + | local-address=127.0.0.1 | ||
| + | # Listening IP (pdns-recursor will forward DNS queries du this port) | ||
| + | local-port=54 | ||
| + | # MariaDB Backend Config | ||
| + | gmysql-host=127.0.0.1 | ||
| + | gmysql-port=3306 | ||
| + | gmysql-dbname=powerdns | ||
| + | gmysql-user=pdns | ||
| + | gmysql-group=client | ||
| + | gmysql-password=eiur546fTEd6gEaFr | ||
| + | gmysql-dnssec=no | ||
| + | gmysql-innodb-read-committed=yes | ||
| + | gmysql-timeout=10 | ||
| + | |||
| + | ===== pdnsutil ===== | ||
| + | |||
| + | ==== Zone/ | ||
| + | |||
| + | Créer une zone : | ||
| + | pdnsutil create-zone domain.local | ||
| + | |||
| + | Ajouter un enregistrement Type A : | ||
| + | pdnsutil add-record domain.local www A 60 127.0.0.1 | ||
informatique/linux/powerdns.1712908333.txt.gz · Dernière modification : de benoit
