CentOS 8 - 네임서버(PowerDNS) 구축(With MariaDB, PowerAdmin)

PowerDNS [공식 홈페이지]

이 솔루션은 BIND와 같은 도메인 네임 시스템(Domain Name System, DNS) 역할을 하고 있으며 호스트의 도메인 이름을 네트워크[IP] 주소로 변경하거나 또는 그 반대로 인식하게 해주는 소프트웨어를 말합니다. 예를 들어 제 블로그에 연결된 도메인 [ https://foxydog.tistory.com ] 입력하면 그 서버(PC)의 IP를 찾아갈 수 있게 해 준다는 뜻입니다.

PowerDNS는 [ PowerDNS.COM BV ] 팀에서 개발을 하고 배포를 해왔지만 현재는 [ Open-Xchange Inc ]에 합병되어 공식적으로 솔루션 판매도 이루어지고 있습니다. 하지만 걱정할 필요 없이 100% 오픈 소스 기반으로 배포되고 있으므로 개인 및 기업에서 네임서버 구축 후 운영을 해도 전혀 문제가 되지 않습니다.

 PowerAdmin [공식 홈페이지]

PowerDNS서버를 위한 웹 인터페이스 관리 도구입니다.

명령어가 아닌 웹 관리자에서 직접 추가 및 변경을 쉽게 할 수 있습니다.

■ [설치환경 및 준비물]

릴리즈 설치 테스트 : 2020-07-22

서버준비 CentOS 8 리눅스 설치 서버 [포스팅 참고]
OS Version CentOS Linux release 8.2.2004 (Core)
커널(Kernel) 5.7.2-1.el8.elrepo.x86_64 (기본커널로 진행해도 무방)
DB MariaDB 10.5
WEB Apache 2.4.X / PHP 7.4.X
PowerDNS PowerDNS Authoritative Server 4.3.X
웹관리자  PowerAdmin 2.1.7

 

※ 포스팅 제목에 테스트[TEST]라고 붙은 이유는 아직 공식 커뮤니티 사이트에서(Github 커뮤니티 사이트에서도 명확한 답변이 나오지 않는 점을 알 수 있습니다. [링크])도 제대로 된 버그 픽스나 설치되었다는 자료가 확인되지 않습니다. 미리 말씀드리자면 리눅스 CentOS 8에서 MariaDB10.X 설치된 시스템에 PowerDNS에 필요한 소프트웨어 최신 버전인 pdns-backend-mysql-4.3 정식 배포판 YUM(RPM) 패키지 설치하게 되면 DB가 강제로 오라클 [Mysql(mysql-common-8.X]로 설치가 되어 MariaDB와 충돌되는 문제가 발생을 합니다.

 

※ 제가 최초일지는 모르겠지만 수십 번 테스트 결과 설치할 수 있는 꼼수(?)를 발견하여 공유합니다. 일단 정상 작동까지는 확인되었으나 설치 버전을 최신으로 하다 보니 발생한 문제가 많아 어떻게 진행을 했는지 모든 설치 과정을 트러블슈팅(troubleshooting)화하여 빠짐없이 적도록 하겠습니다. 스압 주의해주시기 바랍니다.

 

※ VM가상 내부에서만 테스트를 해보았기 때문에 실서버에 적용을 해도 되는지에 대해서는 명확하지 않으므로 참고만 하시기 바랍니다. 추후 시간이 될 경우 실서버 테스트도 진행하려고 합니다.

 

※ [2020-08-04] 실서버 테스트시 검증 확인 완료

■ 진행순서


※ 진행하기전 참고!

◇ 일반적으로 MariaDB를 먼저 설치하고 PowerDNS를 설치하지만 이럴 경우 다음과 같이 충돌발생

▶ 패키지 설치시 충돌 메세지
file /usr/share/mysql/charsets/swe7.xml

from install of mysql-common-8.0.17-3.module_el8.0.0+181+899d6349.x86_64 conflicts

with file from package MariaDB-common-10.5.4-1.el8.x86_64

 

한글메세지

mysql-common-8.0.17-3.module_el8.0.0+181+899d6349.x86_64에서 설치되는

/usr/share/mysql/charsets/swe7.xml 파일은 MariaDB-common-10.5.4-1.el8.x86_64 패키지의 파일과 충돌합니다

 

그래서 순서를 PowerDNS를 먼저 설치하고 MariaDB를 설치 합니다.

STEP01 → PowerDNS Authoritative Server 4.3.X 설치하기[ 저장소 링크 ]

1-1 최신 버전을 설치하기 위해 PowerDNS저장소 등록하기(전체 한줄 명령어)

[root@localhost ~]# yum install epel-release && dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled PowerTools && curl -o /etc/yum.repos.d/powerdns-auth-43.repo https://repo.powerdns.com/repo-files/centos-auth-43.repo

1-2 PowerDNS Authoritative Server 4.3.X 설치 [ 공식 홈페이지 문서 참고 ]

[root@localhost ~]# yum install pdns pdns-backend-mysql

1-3 디폴트로 설치된 오라클 [MysqlDB] 라이브러리 삭제

※ 반대로 설치한다고 해도 MariaDB와 충돌이 발생 하므로 먼저 두개의 패키지를 강제로 삭제 합니다.

◇ RPM 설치 확인
[root@localhost ~]# rpm -qa | grep mysql
pdns-backend-mysql-4.3.0-1pdns.el8.x86_64
mysql-libs-8.0.17-3.module_el8.0.0+181+899d6349.x86_64 [삭제할 패키지 확인]
mysql-common-8.0.17-3.module_el8.0.0+181+899d6349.x86_64 [삭제할 패키지 확인]

 

◇ 삭제 전 특정 공유 라이브러리 백업 [ libmysqlclient.so.21 나중에 필요함 ]

[root@localhost ~]# mv /usr/lib64/mysql /usr/lib64/mysql_old

[root@localhost ~]# ls -al /usr/lib64/mysql_old/

lrwxrwxrwx   1 root root      25 10월  8  2019 libmysqlclient.so.21 [파일 확인] -> libmysqlclient.so.21.1.17

-rwxr-xr-x   1 root root 7556688 10월  8  2019 libmysqlclient.so.21.1.17 [파일 확인]

 

 

RPM 강제 옵션 [ --nodeps ] 이용하여 삭제

[root@localhost ~]# rpm -e --nodeps mysql-common-8.0.17-3.module_el8.0.0+181+899d6349.x86_64
[root@localhost ~]# rpm -e --nodeps mysql-libs-8.0.17-3.module_el8.0.0+181+899d6349.x86_64

 

STEP02 → MariaDB10.5 설치하기[ 저장소 링크 ]

 

2-1 설치하기 위한 저장소 추가 (생성 후 저장)

[root@localhost ~]# vi /etc/yum.repos.d/MariaDB.repo

# MariaDB 10.5 CentOS repository list - created 2020-07-22 04:12 UTC

# http://downloads.mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos8-amd64

module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

2-2 MariaDB10.5 패키지 설치

[root@localhost ~]# yum install MariaDB-server

2-3 활성화 및 구동

[root@localhost ~]# systemctl enable mariadb 부팅 자동 시작
[root@localhost ~]# systemctl start mariadb MariaDB 서비스 시작
[root@localhost ~]# ps -ef |grep mysql
/usr/sbin/mariadbd
구동 확인

2-4 MariaDB 기본설정 ( DB가 구동된 상태에서 진행가능 )

[root@localhost ~]# mysql_secure_installation

Enter current password for root (enter for none): 패스워드가 없기때문에 엔터
Switch to unix_socket authentication [Y/n] Y 소켓 인증 전환 설정 Y
Change the root password? [Y/n] Y 패스워드 변경 설정 Y
New password: 패스워드 입력
Re-enter new password: 패스워드 재입력
Remove anonymous users? [Y/n] Y 익명  사용자를 삭제 하시겠습니까? 보안을 위해 Y
Disallow root login remotely? [Y/n] Y DB원격 접속을 허용하지 않을 것인가? 보안을 위해 Y
Remove test database and access to it? [Y/n] Y TEST 데이터베이스를 제거하고 엑세스 할 것인가?
보안을 위해 Y
Reload privilege tables now? [Y/n] 현재 설정한 값을 적용할 것인가? Y
Thanks for using MariaDB! MariaDB를 사용해 주셔서 감사합니다!

 

STEP03 →PowerDNS가 사용할 Database, 유저 및 테이블 생성[ 공식 문서 : MYSQL 구성 예제 ]

[DB 접속]

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.5.4-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

◇ [데이터베이스 생성]

MariaDB [(none)]> create database pdns; 
Query OK, 1 row affected (0.001 sec)


[pdns 유저 권한 추가]

MariaDB [(none)]> GRANT ALL ON pdns.* TO 'pdns'@'localhost' IDENTIFIED BY 'test123';
Query OK, 0 rows affected (0.002 sec)

[예시 : GRANT ALL ON 데이터베이스 이름.* TO '유저 ID'@'localhost' IDENTIFIED BY '패스워드'; ]

 

[pdns 유저 SOA권한 추가]
MariaDB [(none)]> GRANT ALL ON pdns.* TO 'pdns'@'testdns' IDENTIFIED BY 'test123';
Query OK, 0 rows affected (0.002 sec)

 

[적용]
MariaDB [(none)]> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.001 sec)

 

◇ [여기서 부터는 PowerDNS 사용할 테이블 생성]

MariaDB [(none)]> use pdns;
Database changed

 

MariaDB [pdns]> 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)
) Engine=InnoDB;

Query OK, 0 rows affected (0.006 sec)

 

MariaDB [pdns]> CREATE UNIQUE INDEX name_index ON domains(name);
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MariaDB [pdns]> CREATE TABLE records (
  id                    BIGINT AUTO_INCREMENT,
  domain_id             INT DEFAULT NULL,
  name                  VARCHAR(255) DEFAULT NULL,
  type                  VARCHAR(10) DEFAULT NULL,
  content               VARCHAR(64000) DEFAULT NULL,
  ttl                   INT DEFAULT NULL,
  prio                  INT DEFAULT NULL,
  change_date           INT DEFAULT NULL,
  disabled              TINYINT(1) DEFAULT 0,
  ordername             VARCHAR(255) BINARY DEFAULT NULL,
  auth                  TINYINT(1) DEFAULT 1,
  PRIMARY KEY (id)
) Engine=InnoDB;

Query OK, 0 rows affected (0.006 sec)

 

MariaDB [pdns]> CREATE INDEX nametype_index ON records(name,type);
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [pdns]> CREATE INDEX domain_id ON records(domain_id);
Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [pdns]> CREATE INDEX recordorder ON records (domain_id, ordername);
Query OK, 0 rows affected (0.006 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MariaDB [pdns]> CREATE TABLE supermasters (
  ip                    VARCHAR(64) NOT NULL,
  nameserver            VARCHAR(255) NOT NULL,
  account               VARCHAR(40) NOT NULL,
  PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;

Query OK, 0 rows affected (0.006 sec)

 

MariaDB [pdns]> CREATE TABLE comments (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  name                  VARCHAR(255) NOT NULL,
  type                  VARCHAR(10) NOT NULL,
  modified_at           INT NOT NULL,
  account               VARCHAR(40) NOT NULL,
  comment               VARCHAR(64000) NOT NULL,
  PRIMARY KEY (id)
) Engine=InnoDB;

Query OK, 0 rows affected (0.005 sec)

 

MariaDB [pdns]> CREATE INDEX comments_domain_id_idx ON comments (domain_id);
Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [pdns]> CREATE INDEX comments_name_type_idx ON comments (name, type);
Query OK, 0 rows affected (0.006 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [pdns]> CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
Query OK, 0 rows affected (0.006 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MariaDB [pdns]> CREATE TABLE domainmetadata (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  kind                  VARCHAR(32),
  content               TEXT,
  PRIMARY KEY (id)
) Engine=InnoDB;

Query OK, 0 rows affected (0.007 sec)

 

MariaDB [pdns]> CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);

Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MariaDB [pdns]> CREATE TABLE cryptokeys (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  flags                 INT NOT NULL,
  active                BOOL,
  content               TEXT,
  PRIMARY KEY(id)
) Engine=InnoDB;

Query OK, 0 rows affected (0.005 sec)

 

MariaDB [pdns]> CREATE INDEX domainidindex ON cryptokeys(domain_id);
Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MariaDB [pdns]> CREATE TABLE tsigkeys (
  id                    INT AUTO_INCREMENT,
  name                  VARCHAR(255),
  algorithm             VARCHAR(50),
  secret                VARCHAR(255),
  PRIMARY KEY (id)
) Engine=InnoDB;

Query OK, 0 rows affected (0.006 sec)

 

MariaDB [pdns]> CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

◇ [테이블 정상 생성 확인]

MariaDB [pdns]> show tables;
+----------------+
| Tables_in_pdns |
+----------------+
| comments       |
| cryptokeys     |
| domainmetadata |
| domains        |
| records        |
| supermasters   |
| tsigkeys       |
+----------------+
7 rows in set (0.001 sec)

 

[종료]

MariaDB [pdns]> quit
Bye

 

STEP04 → PowerDNS(pdns.conf) 파일 설정 [추가 후 저장]

[root@localhost ~]# vi /etc/pdns/pdns.conf

    268 #################################
    269 # launch        Which backends to launch and order to query them in
    270 #
    271 # launch=\nlaunch=
    272 [아래와 같이 추가]

    273 launch=gmysql
    274
    275 gmysql-host=localhost
    276 gmysql-user=pdns
    277 gmysql-password=test123
    278 gmysql-dbname=pdns

 

STEP05 (중요) → PowerDNS 활성화 및 서비스 시작

 

5-1 부팅 자동 시작 활성화

[root@localhost ~]# systemctl enable pdns

5-2 PowerDNS 서비스 시작 (※트러블슈팅 과정, 꼭 순서대로 확인 진행)

◇ [1차 시도] 서비스 시작 시 에러발생

[root@localhost ~]# systemctl start pdns
Job for pdns.service failed because the control process exited with error code.
See "systemctl status pdns.service" and "journalctl -xe" for details.

 

◇ 에러로그 확인

[root@localhost ~]# journalctl -xe

localhost.localdomain pdns_server[3414]: Jul 22 01:26:40 Unable to open /etc/pdns/pdns.conf

localhost.localdomain pdns_server[3414]: Unable to launch, no backends configured for querying

[conf 파일을 불러오지 못해 에러가 발생하는 문제는 대부분 실행 권한 문제로 발생]

 

◇ 권한 확인

[root@localhost ~]# ls -al  /etc/pdns/pdns.conf

-rw------- 1 root root 17956  7월 22 01:18 /etc/pdns/pdns.conf

 

◇ 권한 수정 [최소 보안 유지를 위해 그룹 권한까지만 부여]

[root@localhost ~]# chmod 660 /etc/pdns/pdns.conf

[root@localhost ~]# chown pdns:root /etc/pdns/pdns.conf

[root@localhost ~]# ls -al  /etc/pdns/pdns.conf

-rw-rw---- 1 pdns root 17956  7월 22 01:18 /etc/pdns/pdns.conf

 

◇ [2차 시도] 서비스 시작 시 에러발생

[root@localhost ~]# systemctl start pdns
Job for pdns.service failed because the control process exited with error code.
See "systemctl status pdns.service" and "journalctl -xe" for details.

 

◇ 에러로그 확인

[root@localhost ~]# journalctl -xe
localhost.localdomain pdns_server[5843]: Loading '/usr/lib64/pdns/libgmysqlbackend.so

localhost.localdomain pdns_server[5843]:

Unable to load module '/usr/lib64/pdns/libgmysqlbackend.so':

libmysqlclient.so.21: cannot open shared object file: No such file or directory

[libgmysqlbackend.so 모듈을 불러오지 못하는 에러]

localhost.localdomain pdns_server[5843]: DNSBackend unable to load module in gmysql

 

◇ 파일 확인

[root@localhost ~]# ls -al  /usr/lib64/pdns/

-rwxr-xr-x   1 root root 349832  4월  6 10:09 libbindbackend.so

-rwxr-xr-x   1 root root 160152  4월  6 10:09 libgmysqlbackend.so [파일은 존재함]

-rwxr-xr-x   1 root root  69536  4월  6 10:09 librandombackend.so

 

◇ 라이브러리 의존성 문제일 확률이 높음 [ldd 의존성 확인 명령어]

[root@localhost ~]# ldd /usr/lib64/pdns/*

/usr/lib64/pdns/libgmysqlbackend.so:

        linux-vdso.so.1 (0x00007fffa3de2000)

        libmysqlclient.so.21 => not found  [원인 확인]

 

◇ 의존성 문제 확인 되어 libmysqlclient.so.21 (Mysql 라이브러리) 라이브러리를 연결해주기

※ 처음에 백업했던 위치 확인, 기억이 안난다면 절대 경로 확인

[root@localhost mysql]# find / -name libmysqlclient.so.21

/usr/lib64/mysql_old/libmysqlclient.so.21

 

◇ libmysqlclient.so.21 의존성 찾을 수 있게 [ ldso.conf ] 절대경로 추가 수정

[root@localhost ~]# vi /etc/ld.so.conf

include ld.so.conf.d/*.conf

/usr/lib64/mysql_old/  [라인 추가]

 

◇ 바로 적용을 위해 명령어 수행

[root@localhost ~]# ldconfig

 

◇ 의존성 재 확인 [정상 확인 완료]

[root@localhost ~]# ldd /usr/lib64/pdns/* | grep libmysqlclient.so.21

        libmysqlclient.so.21 => /usr/lib64/mysql_old/libmysqlclient.so.21 (0x00007f6020fba000)

 

◇ [3차 시도] 서비스 시작 시 에러발생

[root@localhost ~]# systemctl start pdns
Job for pdns.service failed because the control process exited with error code.
See "systemctl status pdns.service" and "journalctl -xe" for details.

 

◇ 에러로그 확인

[root@localhost ~]# journalctl -xe

localhost.localdomain pdns_server[16810]: Unable to bind UDP socket to '0.0.0.0:53'
Address already in use [이미 UDP 53 포트가 사용중으로 실행 에러 발생]
localhost.localdomain pdns_server[16810]: Fatal error: Unable to bind to UDP socket

 

◇ UDP 53 사용중인 포트 확인 [ netstat ] (스크린샷 대처)

 

◇ 해당 프로세스 비활성화 및 중지

[root@localhost ~]# systemctl disable systemd-resolved.service

[root@localhost ~]# systemctl stop systemd-resolved.service

 

◇ 서비스 시작 및 구동 확인! [최종 구동 확인]

[root@localhost ~]# systemctl start pdns

[root@localhost ~]# ps -ef | grep pdns
/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no

 

STEP06 → Apache(httpd), PHP7.4 설치 및 구동

6-1 PHP7.4 버전을 설치하기 위한 사전 준비 [ APM 포스팅 설치중 PHP부분 참고 ]

◇ PHP [REMI] 저장소 설치

[root@localhost ~]# yum install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

 

◇ PHP [7.4] 모듈을 사용하기 위한 활성화 및 디폴트 설정

[root@localhost ~]# yum module enable php:remi-7.4

 

6-2 Apache(httpd), PHP7.4 및 관련 패키지 한번에 설치하기

[root@localhost ~]# yum install httpd php php-devel php-gd php-imap php-ldap php-mysqlnd php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mhash php-pecl-dbase php-pecl-mcrypt gettext

6-3 Apache(httpd) 활성화 및 서비스 구동 확인

[root@localhost ~]# systemctl enable httpd 부팅 자동 시작
[root@localhost ~]# systemctl start httpd Apache 서비스 시작
[root@localhost ~]# ps -ef |grep httpd
/usr/sbin/httpd -DFOREGROUND
/usr/sbin/httpd -DFOREGROUND
구동 확인

 

STEP07 → 웹 경로에 [PowerAdmin] 다운 후 압축 해[ 공식 홈페이지 ]

◇ 웹 설치 경로[디폴트] 이동

[root@localhost ~]# cd /var/www/html

 

◇ [wget]을 이용해 2.1.7 릴리즈 버전 직접 다운

[root@localhost html]# wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz

 

◇ 압축 해제

[root@localhost html]# tar xvf poweradmin-2.1.7.tgz

 

STEP08 → 웹 접속을 위한 방화벽(iptables) 80번 포트 허용하기

※ 라인 순서 중요 보이는 그대로 넣을 것

 

8-1 iptables 파일 추가 후 저장

[root@localhost html]# vi /etc/sysconfig/iptables

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT  [80포트 라인추가]
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

8-2 iptables 재시작

[root@localhost html]# systemctl restart iptables

8-3 80포트 추가 확인

[root@localhost html]# iptables -nL | grep 80
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:80

 

STEP09 → 웹 인터페이스 관리 도구인 [ PowerAdmin ] 설치 진행

 

9-1 본인 PC에서 [ URL : http://192.168.232.139/poweradmin-2.1.7/install/ ] 접속을 합니다.

9-2 설치전 주의사항으로 다음

9-3 데이터베이스 정보 업데이트 하기

9-4 접속할 계정 권한 생성 및 마스터 네임서버 호스트 설정

9-5 DB에 유저 접근 권한 계정 권한 부여 [이미 했기 때문에 할 필요 없음]

9-6 /inc/config.inc.php 파일에 적용 후 다음 진행

◇ 경로 이동
[root@localhost html]# cd /var/www/html/poweradmin-2.1.7/inc

 

◇ 샘플 파일 이름 변경
[root@localhost inc]# mv config-me.inc.php config.inc.php

◇ 위 스크린샷 값대로 수정 후 저장 [표시된 값만 설정 할 것]

[root@localhost inc]# vi config.inc.php

 

[아래 표시된 부분만 세팅과 동일하게 설정할 것]

// NOTE: Do not edit this file, otherwise it's very likely your changes
// will be overwritten with an upgrade.
// Instead, create the file "inc/config.inc.php" and set the variables you

// want to set there. Your changes will override the defaults provided by us.
// Better description of available configuration settings you can find here:
// <https://github.com/poweradmin/poweradmin/wiki/Configuration-File>

// Database settings
$db_host = 'localhost';
$db_port = '3306';
$db_user = 'pdns';
$db_pass = 'test123';
$db_name = 'pdns';
$db_type = 'mysql';
//$db_file              = '';           # used only for SQLite, provide full path to database file
//$db_debug             = false;        # show all SQL queries
$db_layer               = 'PDO';        # or MDB2
//$db_ssl_ca            = '';
// Security settings
// This should be changed upon install
$session_key = 'd1qN7c[_)_zYM=cwTpbrbIuPNISjF1[E%)kmLBL90EtI![';
$password_encryption = 'md5'; // or md5salt


// Interface settings
$iface_lang = 'en_EN';
$iface_style = 'example';
$iface_rowamount = 50;
$iface_expire = 1800;
$iface_zonelist_serial = false;
$iface_title = 'Poweradmin';
$iface_add_reverse_record = true;

 

// Predefined DNS settings
$dns_hostmaster = 'master.testdns.com';

$dns_ns1 = 'ns1.testdns.com';

$dns_ns2 = 'ns2.testdns.com';

$dns_ttl = 86400;
$dns_fancy = false;
$dns_strict_tld_check = false;
$dns_top_level_tld_check = false;     // Don't allow to create top level TLDs
$dns_third_level_check = false;

 

9-7 마지막 설정 안내 순차적으로 진행

◇ 경로 이동

[root@localhost html]# cd /var/www/html/poweradmin-2.1.7

 

◇ 동적 DNS공급 사용 적용

[root@localhost poweradmin-2.1.7]# cp install/htaccess.dist .htaccess

 

◇ 인스톨 파일 삭제
[root@localhost poweradmin-2.1.7]# rm -rf /var/www/html/poweradmin-2.1.7/install

 

STEP10 → PowerAdmin 웹 관리자 접속 확인 [ URL : http://192.168.232.139/poweradmin-2.1.7/ ]

※ 기본ID [ admin ] / 패스워드는 본인이 설정한 값

※ 정상적으로 로그인된 화면

 

STEP11 → 도메인 생성 테스트

11-1 [ Add master zone ] 에서 도메인 테스트로 [ test.com ] 이라는 도메인을 생성하려고 하였으나 에러 발생

Error 메시지 : You have invalid characters in your hostname

Error 메시지 : test.com failed - Invalid hostname.

 

11-2 서버 에러로그 확인

[root@localhost ~]# tail -f /var/log/php-fpm/www-error.log

[23-Jul-2020 00:19:47 UTC] PHP Warning:  preg_match(): Compilation failed: invalid range in character class at offset 4 in /var/www/html/poweradmin-2.1.7/inc/dns.inc.php on line 321

 

이 오류를 검색해보니 PHP7.3 이상부터는 문자열 처리하는 방식이 변경된 것으로 보입니다.

해당 라인 [321]을 열어보면 특수문자같은게 확인이 되는데요. 시스템상에서는 역슬래시[ \ ] 입니다.

 

[root@localhost php-fpm]# vi /var/www/html/poweradmin-2.1.7/inc/dns.inc.php

( - ) 하이픈 앞뒤에 ( \ ) 역슬래시가 포함되어있을 경우 문자열 인식에 문제가 발생하는 것으로 확인됩니다.

개발자가 아니다보니 혹시나 해서 위치를 계속 수정해서 테스트 해보았더니 [ \ ] 역슬래시 뒤에 있다고 발생하는게 아닌 문자열 처리하는 순서배열에 문제가 있는 것으로 보이네요. 다음가 같이 [ - ] 하이픈을 [ [ ] 대괄호 뒤에 이동합니다.

디폴트 문자열 321  if (!preg_match('/^[\w-\/]+$/', $hostname_label)) {
수정 321  if (!preg_match('/^[-\w\/]+$/', $hostname_label)) {

 

11-3 다시 [ Add master zone ] 에서 도메인 생성 시 정상 확인

 

11-4 일반 [ A/MX/CNAME ] 레코드도 등록 테스트 해보았으나 동일하게 발생

Error 메세지 : You have invalid characters in your hostname

11-5 서버 에러로그 확인

[root@localhost ~]# tail -f /var/log/php-fpm/www-error.log

[23-Jul-2020 01:03:15 UTC] PHP Warning:  preg_match(): Compilation failed: invalid range in character class at offset 8 in /var/www/html/poweradmin-2.1.7/inc/dns.inc.php on line 315

 

이번에는 라인 [315]줄에서 문제가 발생했네요.

[root@localhost php-fpm]# vi /var/www/html/poweradmin-2.1.7/inc/dns.inc.php

동일하게 중간에 있는 [ - ] 하이픈을 [ [ ]대괄호 뒤에 이동 합니다.

디폴트 문자열 315   if (!preg_match('/^(\*|[\w-\/]+)$/', $hostname_label)) {
수정 315   if (!preg_match('/^(\*|[-\w\/]+)$/', $hostname_label)) {

 

11-6 레코드도 정상적으로 생성 되는 것을 확인

 

STEP12 → 네임서버 질의 테스트

[root@localhost ~]# dig @localhost test.test-2.com

 

STEP13 [마지막] → 도메인 삭제 테스트

존파일은 정상적으로 삭제가 되나 두가지의 에러가 발생을 합니다.

Error : Failed to call pdnssec utility

Error : Failed to deactivate DNSSEC keys.

 

[ PowerDNS ] 최근 버전에서는 [ PowerAdmin ] 에서 처리하는 커맨드 명령어가 없거나 변경되어 나는 에러가 제법 있습니다. 단순하게 오류 안나게만 하면 되는 부분으로 다음과 같이 처리해주면 됩니다.

 

◇ Error : Failed to call pdnssec utility 에러 처리 방법

[root@localhost ~]# vi /var/www/html/poweradmin-2.1.7/inc/config.inc.php

디폴트 설정 65  $pdnssec_command = '/usr/bin/pdnssec';
수정 65  $pdnssec_command = '/usr/bin/pdnsutil';

 

◇ Error : Failed to deactivate DNSSEC keys 에러 처리 방법

[root@localhost ~]# vi /var/www/html/poweradmin-2.1.7/delete_domain.php

해당 라인 삭제 [74]      71 if ($confirm == '1') {
     72     if ($zone_info['type'] == 'MASTER') {
     73         $zone_name = get_zone_name_from_id($zone_id);
     74         dnssec_unsecure_zone($zone_name);  [라인삭제]
     75     }

이후 삭제 테스트시 더이상 오류가 발생하지 않습니다.

 

마무리

이로서 설치에서 구동까지 테스트에서는 정상 작동 확인되었습니다. 저는 현재 [ CentOS7 / MariaDB-10.1 /pdns-4.2.X / PowerAdmin-2.1.7 ] 버전으로 직접 설치 및 운영을 최소 1년이상으로 운영을 해보았는데 문제가 없었기 때문에 최신버전에서도 추가 및 삭제 질의 응답까지 동일하게 하는 것으로 보아 실전투입해도 괜찮을까 합니다. 나중에 시간이 지나면 리눅스 Redhat/CentOS 에서 패키지 설치에 대한 버그 픽스가 나올 것으로 예상이 되지만 이것만큼은 2019년도에 나온것치고는 아직도 이슈가 많이 발생을 하네요. 제가 직접 구입한 도메인으로 실서버에 테스트 후 운영에 문제가 없다면 정식버전으로 포스팅 하도록 하겠습니다. 최신버전으로 설치하시는 분들은 위 트러블슈팅을 참고하면 좋을 것으로 보입니다. 긴글 읽으신다고 고생하셨습니다.

Designed by JB FACTORY