Benutzer-Werkzeuge

Webseiten-Werkzeuge


linux:power_dns

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
linux:power_dns [2016/10/02 15:05] gpipperrlinux:power_dns [2016/10/02 15:30] (aktuell) – [PowerDNS 4.x - Ein Alternative für BIND - Mit einer Oracle Datenbank im Backend einsetzen] gpipperr
Zeile 1: Zeile 1:
 +=====PowerDNS 4.x - Die Alternative für BIND - Mit einer Oracle Datenbank im Backend einsetzen=====
 +
 +Auf der Suche nach einer Benutzeroberfläche für einen Name Server bin ich schon vor längeren auf DNS Server [[http://www.powerdns.com/content/home-powerdns.html| Power DNS]] gestoßen. Hier auch ein Beispiel mit PostgreSQL auf dem  [[raspberry:pidora_power_dns|Raspberry PI als DNS Applicance für PowerDNS]].
 +
 +
 +Die Besonderheit diese DNS Servers ist das Speichern der DNS Konfiguration in einem relationalen Datendaten Modell. 
 +
 +Für die Datenhaltung kommen verschieden relationale Datenbank in Frage, wie Oracle, PostgreSQL und MySQL.
 +
 +Aufgrund der Datenhaltung in einer Datenbank ist das Erstellen einer Konfigurationsoberfläche dann relativ einfach. 
 +
 +Es gibt im Netz mehrere Varianten wie [[https://www.poweradmin.org/trac/|Poweradmin]] oder das [[https://github.com/kennethkalmer/powerdns-on-rails|powerdns-on-rails]] Projekt.
 +
 +Ziel ist es hier Oracle APEX später für die Verwaltung der DNS Einträge zu verwenden.
 +
 +Die Anleitung für PowerDNS unter: http://doc.powerdns.com/
 +
 +Features:
 +
 +  * Trennung von Authoritative Server und Recursor Server (für recursive Abfragen)
 +  * Webserver Interface für Monitoring (http://doc.powerdns.com/monitoring.html) 
 +  * Datenhaltung in einer relationalen Datenbank
 +
 +
 +Benötigt wird das Ganze für eine Oracle Cluster Installation  => [[dba:install_rac_linux_12c|Anmerkungen zu Installation des Oracle Real Application Cluster 12c R1 auf einem Oracle Linux 7]]
 +
 +----
 +
 +
 +==== Installation des Primärer PowerDNS Nameserver mit einer Oracle Datenbank====
 +
 +====Grundsystem aufsetzen====
 +
 +Als Linux kommt Oracle Linux in der Version 7.2 zum Einsatz.
 +
 +  * Oracle Linux als minimales System installieren, siehe => [[linux:linux_7_system_grundeinstellungen_oracle_datenbank_rac|Ein Oracle Linux 7 Basis System als Grundlagen für eine Oracle Clusterware und Datenbank Installation vorbereiten]]
 +  * DNS Tools installieren (DIG und nslookup) mit:<code bash>yum install net-tools bind-utils</code>
 +  * FW einrichten (HTTP/HTTPS und DNS + SSH freischalten) bzw FW deaktivieren
 +  * yum repostiory für PowerDNS Packete einrichten <code bash>
 +vi /etc/yum.repos.d/pdns-server.el7.repo
 +
 +[pdns-MIND]
 +name=PowerDNS server packages for RHEL7 and friends.
 +baseurl=https://www.monshouwer.eu/download/3rd_party/pdns/el7/$basearch/
 +gpgcheck=0
 +enabled=1
 +
 +#zusätzlich für protobuf lib
 +rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
 +rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
 +rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
 +
 +</code>
 +
 +
 +----
 +
 +===PowerDNS aus Repository installieren===
 +
 +
 +Nur zur Info - wir übersetzen das später selber!
 +
 +<code bash>
 +yum install protobuf-lite pdns pdns-tools 
 +</code>
 +
 +
 +Leider gibt es das Oracle Backend zum installieren als RPM nicht, hier muss nun PowerDNS direkt dem Source Code aufgesetzt werden.
 +
 +
 +----
 +
 +====Oracle Datenbank Software 12c installieren und eine Datenbank anlegen====
 +
 +Eine normale Standard Edition wird als kleine Datenbank auf dem System unter dem User Oracle angelegt.
 +
 +Backup anlegen etc.
 +
 +Alles Default, Installation wie immer, keine besonderen Funktionen/Einstellungen notwendig
 +
 +Die Installation muss vor dem Übersetzen des Sourcecodes erfolgen, damit beim Übersetzen die notwendigen OCI Libraries gefunden werden können!
 +
 +
 +
 +===User pdns auf der DB anlegen===
 +
 +User pdns auf der Datenbank anlegen:
 +<code sql>
 +Create USER "PDNS" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK ;
 +
 +-- QUOTAS
 +ALTER USER "PDNS" QUOTA UNLIMITED ON USERS;
 +
 +-- ROLES
 +ALTER USER "PDNS" DEFAULT ROLE "CONNECT","RESOURCE";
 +
 +-- Rights
 +grant execute on DBMS_CRYPTO to pdns;
 +
 +</code>
 +
 +
 +
 +----
 +
 +
 +
 +==== PowerDNS aus dem Source übersetzen====
 +
 +https://doc.powerdns.com/md/appendix/compiling-powerdns/
 +
 +
 +=== Git installieren ===
 +<code bash>
 +yum install git
 +</code>
 +
 +=== Boost + Abhängigkeiten für den Compile installieren ===
 +
 +<code bash>
 +yum install boost
 +yum install boost-devel
 +yum install autoconf
 +yum install automake
 +yum install libtool
 +yum install bison
 +yum install flex
 +yum install openssl-devel
 +yum install ragel
 +</code>
 +
 +=== Auschecken ===
 +
 +Sourcecode von Git laden:
 +<code bash>
 +cd /srv
 +
 +git clone git://github.com/PowerDNS/pdns
 +</code>
 +
 +Abhängigkeiten konfigurieren
 +<code>
 +cd pdns
 +
 +./bootstrap
 +
 +</code>
 +
 +Configure:
 +
 +<code bash>
 +
 +export ORACLE_HOME=/opt/oracle/products/12.1.0.2/dbhome_1/
 +
 +#Nur Oracle Modul
 +./configure --with-modules='oracle'  --without-lua
 +
 +</code>
 +
 +Übersetzen und installieren
 +<code bash>
 +make 
 +make install
 +</code>
 +
 +
 +=== Erster Test Aufruf ===
 +Testweise aufrufen ob die Libs auch gefunden werden:
 +<code bash>
 +
 +#Umgebung setzen!
 +
 +export ORACLE_HOME=/opt/oracle/products/12.1.0.2/dbhome_1/
 +export LD_LIBRARY_PATH=$ORACLE_HOME/lib
 +
 +pdns_server
 +
 +Sep 28 19:17:33 Unable to open /usr/local/etc/pdns.conf
 +
 +# an der Stelle ok, das müssen wir ja noch konfigurieren!
 +
 +</code>
 +
 +Tritt der Fehler <fc #800000>pdns_server: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory</fc> auf, ist der LD_LIBRARY_PATH nicht gesetzt!
 +
 +
 +
 +----
 +
 +
 +
 +==== Oracle Schema für PowerDNS anlegen ====
 +
 +Ein Script "schema.oracle.sql" um das Datenmodell anzulegen liegt unter "/modules/oraclebackend".
 +
 +
 +
 +<code bash>
 +cd /srv/pdns/modules/oraclebackend
 +
 +
 +$ORACLE_HOME/bin/sqlplus pdns/pdns@gpi
 +
 +@schema.oracle.sql
 +
 +</code>
 +
 +
 +Siehe auch https://doc.powerdns.com/md/authoritative/backend-oracle/ 
 +
 +=== Daten hinterlegen===
 +
 +
 +Für das Datumsformat die Epoch Linux Zeit mit "date +'%s'" auslesen!
 +
 +
 +Ist das Modell komplett vorhanden, kann nun per SQL die ersten Domain angelegt werden:
 +<code sql>
 +
 +
 +Insert into zones (ID,NAME,TYPE,LAST_CHECK,REFRESH,SERIAL,NOTIFIED_SERIAL) values (zones_id_seq.nextval,'pipperr.local','MASTER',null,'28800','2000081401','1');
 +
 +#Metadaten
 +Insert into ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) values ('1','NSEC3PARAM','1',null);
 +Insert into ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) values ('1','ALLOW-AXFR-FROM','1','AUTO-NS');
 +
 +# Allow Dig to grep the complete record from the local host for debug!
 +Insert into ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) values ('1','ALLOW-AXFR-FROM','2','10.10.10.0/24');
 +
 +commit;
 +
 +# als erstes ist ein SOA Record notwendig!
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','pipperr.local',' ',' ','1440','SOA','ns1.pipperr.local. racdb01.pipperr.local. 2000081401 28800 7200 604800 86400','1475330688','1');
 +
 +#DNS
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','ns1.pipperr.local',' ',' ','1440','A','10.10.10.100','1475330688','1');
 +
 +#Rac Knoten 1
 +
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb01.pipperr.local','',' ','1440','A','10.10.10.190','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb01-vip.pipperr.local',' ',' ','1440','A','10.10.10.192','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb01-priv.pipperr.local',' ',' ','1440','A','10.1.1.190','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb01-haip.pipperr.local',' ',' ','1440','A','10.1.1.191','1475330688','1');
 +
 +#Rac Knoten 2
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb02.pipperr.local',' ',' ','1440','A','10.10.10.196','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb02-vip.pipperr.local',' ',' ','1440','A','10.10.10.192','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb02-priv.pipperr.local',' ',' ','1440','A','10.1.1.194','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','racdb02-haip.pipperr.local',' ',' ','1440','A','10.1.1.195','1475330688','1');
 +
 +#Scan Listener 
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','rac01cluster.pipperr.local',' ',' ','1440','A','10.10.10.200','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','rac01cluster.pipperr.local',' ',' ','1440','A','10.10.10.210','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'1','rac01cluster.pipperr.local',' ',' ','1440','A','10.10.10.220','1475330688','1');
 +
 +#ISCSI Storage
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'1','storage01.pipperr.local',' ',' ','1440','A','10.10.10.180','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'1','storage02.pipperr.local',' ',' ','1440','A','10.10.10.182','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'1','nfsstorage01.pipperr.local',' ',' ','1440','A','10.10.10.110','1475330688','1');
 +
 +
 +commit;          
 +
 +
 +</code>
 +
 +siehe auch => https://doc.powerdns.com/md/authoritative/backend-oracle/ für die Erklärung des Modells.
 +
 +
 +Reverse Lookup hinterlegen:
 +<code sql>
 +INSERT INTO zones (ID,NAME,TYPE,LAST_CHECK,REFRESH,SERIAL,NOTIFIED_SERIAL) 
 +VALUES (zones_id_seq.nextval,'10.10.10.in-addr.arpa','MASTER',NULL,'28800','2000081401','1');
 + 
 +--Metadaten
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('2','NSEC3PARAM','1',NULL);
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('2','ALLOW-AXFR-FROM','1','AUTO-NS');
 +--Allow Dig TO grep the complete record FROM the LOCAL host FOR debug!
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('2','ALLOW-AXFR-FROM','2','10.10.10.0/24');
 +
 +commit;
 +
 +#SOA und NS
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) 
 +VALUES (records_id_seq.nextval,'2','10.10.10.in-addr.arpa',' ',' ','1440','SOA','ns1.pipperr.local. pipperr.local. 2000081401 28800 7200 604800 86400','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) 
 +VALUES (records_id_seq.nextval,'2','10.10.10.in-addr.arpa',' ',' ','1440','NS','ns1.pipperr.local','1475330688','1');
 +commit;
 +
 +
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','100.10.10.10.in-addr.arpa',' ',' ','1440','PTR','ns1.pipperr.local','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','190.10.10.10.in-addr.arpa',' ',' ','1440','PTR','racdb02.pipperr.local','1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','192.10.10.10.in-addr.arpa',' ',' ','1440','PTR','racdb01-vip.pipperr.local'  ,'1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','196.10.10.10.in-addr.arpa',' ',' ','1440','PTR','racdb02.pipperr.local'      ,'1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','192.10.10.10.in-addr.arpa',' ',' ','1440','PTR','racdb02-vip.pipperr.local'  ,'1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','200.10.10.10.in-addr.arpa',' ',' ','1440','PTR','rac01cluster.pipperr.local' ,'1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','210.10.10.10.in-addr.arpa',' ',' ','1440','PTR','rac01cluster.pipperr.local' ,'1475330688','1');
 +Insert into records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) values (records_id_seq.nextval,'2','220.10.10.10.in-addr.arpa',' ',' ','1440','PTR','rac01cluster.pipperr.local' ,'1475330688','1');
 +
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','180.10.10.10.in-addr.arpa',' ',' ','1440','PTR','storage01.pipperr.local','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','182.10.10.10.in-addr.arpa',' ',' ','1440','PTR','storage02.pipperr.local','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','110.10.10.10.in-addr.arpa',' ',' ','1440','PTR','nfsstorage01.pipperr.local','1475330688','1');
 +
 +
 +commit;
 +
 +
 +INSERT INTO zones (ID,NAME,TYPE,LAST_CHECK,REFRESH,SERIAL,NOTIFIED_SERIAL) 
 +VALUES (zones_id_seq.nextval,'1.1.10.in-addr.arpa','MASTER',NULL,'28800','2000081401','1');
 + 
 +--Metadaten
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('3','NSEC3PARAM','1',NULL);
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('3','ALLOW-AXFR-FROM','1','AUTO-NS');
 +--Allow Dig TO grep the complete record FROM the LOCAL host FOR debug!
 +INSERT INTO ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) VALUES ('3','ALLOW-AXFR-FROM','2','10.10.10.0/24');
 +
 +--SOA und NS
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) 
 +VALUES (records_id_seq.nextval,'3','1.1.10.in-addr.arpa',' ',' ','1440','SOA','ns1.pipperr.local. pipperr.local. 2000081401 28800 7200 604800 86400','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) 
 +VALUES (records_id_seq.nextval,'3','1.1.10.in-addr.arpa',' ',' ','1440','NS','ns1.pipperr.local','1475330688','1');
 +commit;
 +
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','194.1.1.10.in-addr.arpa',' ',' ','1440','PTR','racdb02-priv.pipperr.local','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','190.1.1.10.in-addr.arpa',' ',' ','1440','PTR','racdb01-priv.pipperr.local','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','195.1.1.10.in-addr.arpa',' ',' ','1440','PTR','racdb02-haip.pipperr.local','1475330688','1');
 +INSERT INTO records (ID,ZONE_ID,FQDN,REVFQDN,FQDNHASH,TTL,TYPE,CONTENT,LAST_CHANGE,AUTH) VALUES (records_id_seq.nextval,'2','191.1.1.10.in-addr.arpa',' ',' ','1440','PTR','racdb01-haip.pipperr.local','1475330688','1');
 +
 +commit;
 +
 +
 +</code>
 +----
 +
 +==== PowerDNS konfigurieren ====
 +
 +===pdns.conf ===
 +
 +
 +Datei /etc/pdns/pdns.conf bearbeiten
 +<code bash >
 +
 +ln -s /etc/pdns/pdns.conf /usr/local/etc/pdns.conf
 +
 +vi /etc/pdns/pdns.conf
 +
 +..
 +
 +launch=oracle
 +
 +oracle-home=/opt/oracle/products/12.1.0.2/dbhome_1
 +oracle-sid=GPIDB
 +
 +oracle-master-database=GPI
 +oracle-master-username=pdns
 +oracle-master-password=pdns
 +
 +oracle-pool-database=GPI
 +oracle-pool-username=pdns
 +oracle-pool-password=pdns
 +
 +oracle-session-min=2
 +oracle-session-max=10
 +oracle-session-inc=1
 +
 +oracle-nameserver-name=pdns_pipperr_local
 +
 +
 +..
 +</code>
 +
 +<fc #800000>Problem:</fc> <code>
 +Sep 28 20:46:08 OracleFactory: OCIEnvCreate
 +Sep 28 20:46:08 Caught an exception instantiating a backend: OCIEnvCreate
 +Sep 28 20:46:08 Cleaning up
 +</code>
 +
 +Bin verwirrt!
 +
 +Erst nach dem Eintrag der Parameter oracle-home und oracle-sid bin ich nun weiter gekommen!
 +Das hieße aber das die DB nicht über TNS erreichbar ist und die DB Local auf dem gleichen Server liegen muss!
 +
 +
 +
 +=== DNS Forwarding einrichten ===
 +
 +Datei /etc/pdns/pdns.conf
 +<code bash>
 +recursor=212.114.152.1
 +</code>
 +
 +=== Monitoring einrichten ===
 +siehe http://doc.powerdns.com/monitoring.html
 +Datei /etc/pdns/pdns.conf
 +<code bash>
 +webserver=yes
 +webserver-address=10.10.10.100
 +webserver-password=powerdns1234
 +webserver-port=8081
 +
 +# Nur in Testumgebungen
 +webserver-print-arguments=yes
 +
 +</code>
 +
 +webserver-print-arguments nur in Test Umgebungen verwenden! Alle Parameter inkl. Passwort werden angezeigt!
 +
 +
 +----
 +
 +
 +==== DNS testen ====
 +
 +Abfragen mit mit "host -l" oder dig:
 +
 +<code bash>
 +host -l pipperr.local  | sort
 +ns1.pipperr.local has address 10.10.10.100
 +rac01cluster.pipperr.local has address 10.10.10.200
 +.....
 +racdb02-priv.pipperr.local has address 10.1.1.194
 +racdb02-vip.pipperr.local has address 10.10.10.192
 +
 +dig @10.10.10.100 -tAXFR pipperr.local
 +
 +; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> @10.10.10.100 -tAXFR pipperr.local
 +; (1 server found)
 +;; global options: +cmd
 +pipperr.local.          1440    IN      SOA     ns1.pipperr.local. pipperr.local. 2000081401 28800 7200 604800 86400
 +ns1.pipperr.local.      1440    IN      A       10.10.10.100
 +rac01cluster.pipperr.local. 1440 IN           10.10.10.200
 +...
 +racdb02-priv.pipperr.local. 1440 IN           10.1.1.194
 +racdb02-vip.pipperr.local. 1440 IN      A       10.10.10.192
 +racdb02.pipperr.local.  1440    IN      A       10.10.10.196
 +pipperr.local.          1440    IN      SOA     ns1.pipperr.local. pipperr.local. 2000081401 28800 7200 604800 86400
 +;; Query time: 25 msec
 +;; SERVER: 10.10.10.100#53(10.10.10.100)
 +;; WHEN: Sat Oct 01 18:05:40 CEST 2016
 +;; XFR size: 14 records (messages 3, bytes 507)
 +
 +</code>
 +
 +Falls <fc #800000>"; Transfer failed."</fc> muss folgender Eintrag in der Tabelle ZONEMETADATA  existieren, damit das auch erlaubt ist!" 
 +<code sql>
 +#Nur ein Host
 +Insert into ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) values ('1','ALLOW-AXFR-FROM','2','10.10.10.100');
 +
 +#Ein Ganzes Netz
 +Insert into ZONEMETADATA (ZONE_ID,META_TYPE,META_IND,META_CONTENT) values ('1','ALLOW-AXFR-FROM','2','10.10.10.0/24');
 +
 +</code>
 +
 +
 +Reverse Einträge testen:
 +<code bash>
 +
 +dig -x 10.10.10.190
 +
 +
 +dig @10.10.10.100 -tAXFR 10.10.10.in-addr.arpa
 +
 +</code>
 +
 +----
 +
 +====PDNS Service überwachen ====
 +
 +Ist der Webserver aktiviert kann über die URL: http://nameserver_ip:8081/ die Monitoring Oberfläche aufgerufen werden.
 +
 +===API verwenden===
 +
 +
 +siehe https://doc.powerdns.com/md/httpapi/README/
 +
 +JQuery tool installieren:
 +<code bash>
 +yum install jq
 +</code>
 +
 +Conf anpassen in /etc/pdns/pdns.conf:
 +<code bash>
 +## API
 +api=yes
 +api-key=pipperrdns
 +
 +</code>
 +
 +Abfragen:
 +
 +<code bash>
 +curl -H 'X-API-Key: pipperrdns' http://10.10.10.100:8081/api/v1/servers/localhost/zones/pipperr.local | jq
 +
 +</code>
 +Leider unterstützt das Oracle Backend nur Abfragen, anlegen ist nicht möglich .-( .
 +
 +
 +
 +----
 +
 +====Apex Admin Oberfläche einrichten====
 +
 +
 +Apex mit Tomcat aufsetzen ähnlich wie [[prog:oracle_apex_install_windows_12c|Oracle Apex 5.0.4 mit der Oracle Datenbank 12c - Installation]]
 +
 +Und nun kann die Entwicklung einer APEX Admin Oberfläche beginnen .
 +
 +Wird wohl aber noch etwas dauern .-) .
 +
 +
 +----
 +
 +
 +==== Autostart aller Komponenten einrichten ====
 +
 +In folgender Reihenfolge müssen nun die beteiligten Services starten:
 +
 +  * Oracle Listener
 +  * Oracle Datenbank
 +  * PowerDNS Server
 +
 +
 +D.h. es muss ein Autostart mit Abhängigkeiten angelegt werden.
 +
 +=== DB Auto Start===
 +
 +Für die Datenbank siehe als erstes [[dba:start_db_linux|Datenbank unter Linux 6 und Linux 7 automatisch starten]]
 +
 +Nach dem die DB erfolgreich nach einem Reboot wieder automatisch starten nun das Startscript für PDNS anlegen.
 +
 +
 +=== PDNS Autostart ===
 +
 +
 +Und es müssen die Oracle Parameter ORACLE_HOME und LD_LIBRARY_PATCH bei Start von PDNS gesetzt werden!
 +
 +Datei /etc/default/pdns anlegen als root:
 +
 +<code bash>
 +vi /etc/default/pdns
 +
 +ORACLE_HOME="/opt/oracle/product/12.1.0.2/dbhome_1"
 +export ORACLE_HOME
 +LD_LIBRARY_PATH=$ORACLE_HOME/lib
 +export LD_LIBRARY_PATH
 +</code>
 +
 +==Start Script anlegen==
 +**User root**
 +
 +<code bash>
 +vi /srv/startStopPDNS.sh
 +
 +#!/bin/sh
 +
 +# edit the oracle home and user to your needs
 +. /etc/default/pdns
 +
 +
 +##############################
 +# PowerDNS starten oder Stoppen
 +
 +case "$1" in
 +    start)
 +        # wait for the DB to be ready
 +        sleep 100
 +        /usr/local/sbin/pdns_server &
 +        echo "OK"
 +        ;;
 +    stop)
 +        /usr/local/bin/pdns_control quit
 +        echo "OK"
 +        ;;
 +    reload|restart)
 +        $0 stop
 +        $0 start
 +        ;;
 +    *)
 +        echo "Usage: $0 start|stop|restart|reload"
 +        exit 1
 +esac
 +exit 0
 +
 +</code>
 +
 +== Service anlegen ==
 +**User root**
 +
 +Datei  "/lib/systemd/system/pdns.service" anlegen:
 +<code bash>
 +
 +vi /lib/systemd/system/pdns.service
 +
 +[Unit]
 +Description=PowerDNS Service
 +After=syslog.target network.target dbora.service
 +
 +[Service]
 +Type=simple
 +RemainAfterExit=yes
 +ExecStart=/srv/startStopPDNS.sh start 
 +ExecStop=/srv/startStopPDNS.sh stop
 +
 +[Install]
 +WantedBy=multi-user.target
 +</code>
 +
 +
 +Link anlegen:
 +
 +<code bash>
 + ln -s /lib/systemd/system/pdns.service /etc/systemd/system/pdns.service
 +</code>
 +
 +Reload systemd
 +<code bash>
 +systemctl daemon-reload
 +</code>
 +
 +
 +Starten und einschalten des Service:
 +<code bash>
 +#Starten
 +systemctl start pdns.service
 +
 +#Auto Start aktivieren
 +systemctl enable pdns.service
 +
 +#Status prüfen
 +
 +systemctl status pdns.service -l
 +
 +
 +#Stoppen
 +
 +systemctl stop pdns.service
 +
 +
 +</code>
 +
 +prüfen ob die Reichenfolge auch passt:
 +<code bash>
 +systemd-analyze critical-chain pdns.service
 +
 +pdns.service @6min 53.596s
 +└─dbora.service @6.873s
 +  └─network.target @6.872s
 +    └─network.service @6.568s +303ms
 +      └─NetworkManager.service @642ms +130ms
 +
 +...
 +</code>
 +
 +Nun mit einem Reboot testen ob alles klappt!
 +
 +
 +Nun gleich eine Sicherung von der Maschine anlegen .-)!
 +
 +
 +----
 +
 +
 +==== Quellen ====
 +
 +
 +PowerDNS
 +
 +  * https://doc.powerdns.com/md/authoritative/backend-oracle/
 +  * https://doc.powerdns.com/md/authoritative/domainmetadata/#allow-axfr-from
  
linux/power_dns.txt · Zuletzt geändert: 2016/10/02 15:30 von gpipperr