Otu esi etinye ma hazie PowerDNS (ya na MariaDB) na PowerAdmin na RHEL/CentOS 7


PowerDNS bụ ihe nkesa DNS na-agba ọsọ na ọtụtụ usoro Linux/Unix. Enwere ike ịhazi ya na azụ azụ dị iche iche gụnyere faịlụ mpaghara ụdị BIND, ọdụ data mmekọrịta ma ọ bụ nhazi ibu/algọridim ọdịda. Ọ nwekwara ike ịtọ ntọala dị ka DNS recursor na-agba ọsọ dị ka usoro dị iche na nkesa.

Ụdị ihe nkesa ikike PowerDNS kachasị ọhụrụ bụ 3.4.4, mana nke dị na ebe nchekwa EPEL ugbu a bụ 3.4.3. M ga-akwado ịwụnye nke ahụ maka ebe nchekwa EPEL n'ihi na a nwalere ụdị a na CentOS na Fedora. N'ụzọ ahụ, ị ga-enwekwa ike imelite PowerDNS ngwa ngwa n'ọdịnihu.

Edemede a bu n'obi igosi gị otu esi etinye ma hazie ihe nkesa PowerDNS nwere nkwado ndabere MariaDB yana PowerAdmin – ngwa ọrụ njikwa web interface enyi maka PowerDNS.

Maka ebumnuche nke akụkọ a, m ga-eji ihe nkesa nwere:

Hostname: centos7.localhost 
IP Address 192.168.0.102

Kwụpụ 1: Wụnye PowerDNS na MariaDB Backend

1. Mbụ ị ga-eme ka ebe nchekwa EPEL maka ihe nkesa gị jiri naanị:

# yum install epel-release.noarch 

2. Nzọụkwụ ọzọ bụ ịwụnye ihe nkesa MariaDB. Enwere ike ime nke a ngwa ngwa site n'ịgba iwu a:

# yum -y install mariadb-server mariadb

3. Ọzọ anyị ga-ahazi MySQL iji mee ma malite n'elu usoro buut:

# systemctl enable mariadb.service
# systemctl start mariadb.service

4. Ugbu a na ọrụ MySQL na-agba ọsọ, anyị ga-echekwa ma hazie paswọọdụ maka MariaDB site na ịgba ọsọ:

# mysql_secure_installation
/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):  Press ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y     
New password:  ← Set New Password
Re-enter new password:  ← Repeat Above Password
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y ← Choose “y” to disable that user
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n ← Choose “n” for no
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y ← Choose “y” for yes
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y ← Choose “y” for yes
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

5. Ozugbo MariaDB nhazi mere nke ọma, anyị nwere ike ịga n'ihu na ntinye nke PowerDNS. A na-emecha nke a n'ụzọ dị mfe site na ịgba ọsọ:

# yum -y install pdns pdns-backend-mysql

6. Faịlụ nhazi maka PowerDNS dị na /etc/pdns/pdns, mana tupu ị dezie ya, anyị ga-edozi nchekwa data MySQL maka ọrụ PowerDNS. Nke mbụ, anyị ga-ejikọ na sava MySQL wee mepụta nchekwa data nwere aha powerdns:

# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE powerdns;

7. Ọzọ, anyị ga-emepụta onye ọrụ nchekwa data akpọrọ powerdns:

MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'centos7.localdomain' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> FLUSH PRIVILEGES;

Mara: Dochie \tecmint123 na paswọọdụ ịchọrọ iji maka nhazi gị.

8. Anyị na-aga n'ihu site na ịmepụta tebụl nchekwa data nke PowerDNS na-eji. Mezue ngọngọ ndị ahụ site na ngọngọ:

MariaDB [(none)]> USE powerdns;
MariaDB [(none)]> CREATE TABLE domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
primary key (id)
);
MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name);
MariaDB [(none)]> CREATE TABLE records (
id INT auto_increment,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(6) DEFAULT NULL,
content VARCHAR(255) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
primary key(id)
);
MariaDB [(none)]> CREATE INDEX rec_name_index ON records(name);
MariaDB [(none)]> CREATE INDEX nametype_index ON records(name,type);
MariaDB [(none)]> CREATE INDEX domain_id ON records(domain_id);
MariaDB [(none)]> CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);

Ị nwere ike ịpụ apụ na MySQL console site na ịpị:

MariaDB [(none)]> quit;

9. N'ikpeazụ anyị nwere ike ịga n'ihu na configuring anyị PowerDNS n'ụzọ na, ọ ga-eji MySQL dị ka backend. Maka ebumnuche ahụ, mepee faịlụ nhazi PowerDNS dị na:

# vim /etc/pdns/pdns.conf 

Na faịlụ ahụ, chọọ ahịrị ndị dị ka nke a:

#################################
# launch        Which backends to launch and order to query them in
#
# launch=

Mgbe nke ahụ gasịrị, tinye koodu ndị a:

launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=user-pass
gmysql-dbname=powerdns

Gbanwee \user-pass na paswọọdụ ị debere na mbụ. Nke a bụ ka nhazi m si yi:

Chekwaa mgbanwe gị wee pụọ na.

10. Ugbu a, anyị ga-amalite na tinye PowerDNS na ndepụta nke ọrụ na-amalite na usoro buut:

# systemctl enable pdns.service 
# systemctl start pdns.service 

N'oge a, ihe nkesa PowerDNS gị na-arụ ọrụ. Maka ozi ndị ọzọ gbasara PowerDNS ị nwere ike zoo aka na ntuziaka dị na http://downloads.powerdns.com/documentation/html/index.html