namedmanager 一個用戶管理 bind 的 web gui
namedmanager 作用
使用新的 Amberphplib 框架,兼容 MySQL 5.6 STRICT SQL模式
是一個基於 Web 的 DNS 管理係統,可用來添加、調整和刪除 DNS 的 zones/records 數據,支持 Bind 作為後端的 DNS 服務,支持 IPv4 和 IPv6.
namedmanager 軟件安裝方法
下載倉庫地址
wget -O /etc/yum.repos.d/amberdms-c6-public.repo https://repos.jethrocarr.com/config/centos/6/amberdms-c6-public.repo
安裝 namedmanager 軟件包
[root@station140 rpm]# yum -y install namedmanager*
留意安裝信息
BIND/NAMED CONFIGURATION
NamedManager BIND components have been installed, you will need to install
and configure bind/named to use the configuration file by adding the
following to /etc/named.conf:
#
# Include NamedManager Configuration
#
include "/etc/named.namedmanager.conf";
NAMEDMANAGER BIND CONFIGURATION
You need to set the application configuration in /etc/namedmanager/config-bind.php
提示: 當前需要修改 named.conf , 添加 include "/etc/named.namedmanager.conf"; 語法, 另外 php 管理頁麵需要配置 /etc/namedmanager/config-bind.php 文件
參考主要配置文件與作用
Path | Details |
/etc/namedmanager/ | Configuration directory for NamedManager |
/etc/cron.d/namedmanager-bind | NamedManager cronjobs |
/etc/init.d/namedmanager_logpush | Bootscript for starting/stopping the log collector |
/etc/named.conf | Default name for your Bind name server configuration file. |
/var/named/chroot/etc/named.conf | using bind-chroot. |
crond.d 下計劃任務說明
/etc/cron.d/namedmanager-bind
# check for new configuration every minute
*/1 * * * * root php -q /usr/share/namedmanager/bind/namedmanager_bind_configwriter.php >> /var/log/namedmanager_bind_configwriter
# PHP slowly leaks memory, restart the process weekly to prevent it getting too large over months
01 01 * * 0 root /etc/init.d/namedmanager_logpush restart >> /dev/null 2>&1
每分鍾把 mysql 中的 DNS 數據數據刷新並記錄到日誌中
修改文件屬性
[root@station149 etc]# chkconfig --level 35 namedmanager_logpush on
[root@station149 etc]# chown named.root /etc/named.namedmanager.conf
檢測 namedmanager 配置文件是否正確方法
php -q /usr/share/namedmanager/bind/namedmanager_bind_configwriter.php
數據庫配置
啟動數據庫
[root@station149 rpm]# service mysqld start
初始化 MySQL 數據庫: Installing MySQL system tables...
OK
Filling help tables...
OK
Please report any problems with the /usr/bin/mysqlbug script!
[確定]
正在啟動 mysqld: [確定]
更新 MySQL 管理員密碼
[root@station149 resources]# mysql
mysql> update mysql.user set password=password('mypasswd') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
載入 namedmanager 表到數據庫
[root@station149 rpm]# cd /usr/share/namedmanager/resources/; ./autoinstall.pl
autoinstall.pl
This script setups the NamedManager database components:
* NamedManager MySQL user
* NamedManager database
* NamedManager configuration files
THIS SCRIPT ONLY NEEDS TO BE RUN FOR THE VERY FIRST INSTALL OF NAMEDMANAGER.
DO NOT RUN FOR ANY OTHER REASON
Please enter MySQL root password (if any): mypasswd
Searching ../sql/ for latest install schema...
../sql//version_20131222_install.sql is the latest file and will be used for the install.
Importing file ../sql//version_20131222_install.sql
Creating user...
Updating configuration file...
DB installation complete!
You can now login with the default username/password of setup/setup123 at https://localhost/namedmanager
BIND 服務器配置
安裝 bind 服務
[root@terry resources]# yum install -y bind-*
配置 bind
[root@terry resources]# cp -p /etc/named.namedmanager.conf /var/named/chroot/etc/ [root@terry resources]# vi /var/named/chroot/etc/named.conf
named.conf 文件內容
options { listen-on port 53 { 0.0.0.0; }; // listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { 0.0.0.0; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key"; include "/etc/named.namedmanager.conf";
啟動 bind 服務
[root@terry resources]# service named start
http + php 啟動
[root@terry resources]# vi /etc/namedmanager/config-bind.php
<?php /* Sample Configuration File Copy this file to config-settings.php This file should be read-only to the user whom the bind configuration scripts are running as. */ /* API Configuration */ $config["api_url"] = "https://192.168.48.141/namedmanager"; // Application Install Location $config["api_server_name"] = "station141.vtest.com"; // [必須寫主機名] $config["api_auth_key"] = "mykey"; // [該密鑰隨意定義] /* Log file to find messages from Named. Note that: * File should be in syslog format * Named Manager uses tail -f to read it, this can break with logrotate - make sure that either "copytruncate" mode is used, or tail processes are killed */ $config["log_file"] = "/var/log/messages"; /* Lock File Used to prevent clashes when multiple instances are accidently run. */ $config["lock_file"] = "/var/lock/namedmanager_lock"; $config["bind"]["version"] = "9"; // version of bind (currently only 9 is supported, although others may work) $config["bind"]["reload"] = "/usr/sbin/rndc reload"; // command to reload bind config & zonefiles $config["bind"]["config"] = "/var/named/chroot/etc/named.namedmanager.conf"; // configuration file to write bind config too $config["bind"]["zonefiledir"] = "/var/named/chroot/var/named/"; // directory to write zonefiles too // note: if using chroot bind, will often be /var/named/chroot/var/named/ $config["bind"]["verify_zone"] = "/usr/sbin/named-checkzone"; // Used to verify each generated zonefile as OK $config["bind"]["verify_config"] = "/usr/sbin/named-checkconf"; // Used to verify generated NamedManager configuration /* Unusual Compatibility Options */ // Include a full path to the zonefiles in Bind - useful if Bind lacks a // directory configuration or you really, really to store you zonefiles // in a different location // // $config["bind"]["zonefullpath"] = "on"; // force debugging on for all users + scripts // (note: debugging can be enabled on a per-user basis by an admin via the web interface) //$_SESSION["user"]["debug"] = "on"; ?>
創建 named.namedmanager.conf 文件, 文件
[root@terry resources]# cp /etc/named.namedmanager.conf /var/named/chroot/etc/ [root@terry resources]# chown named:named /var/named/chroot/etc/named.namedmanager.conf
啟動 apache 服務器
[root@terry resources]# service httpd restart
停止 httpd: [確定]
正在啟動 httpd:[Thu Jan 16 15:12:12 2014] [warn] Useless use of AllowOverride in line 11 of /etc/httpd/conf.d/namedmanager.conf.
[確定]
啟動網頁服務器 https://192.168.48.141/namedmanager 進行登錄測試 (默認 setup/setup123)
參考圖形配置方法
選擇 configuration ,
填寫 管理員 email (terry@station141.vtest.com)
填寫 ADMIN_API_KEY (之前 /var/named/chroot/etc/named.namedmanager.conf 中定義的密鑰)
選擇 Domains/zones -> View Domains 通過 Add New Domain 添加一個新的域
添加域過程中
配置 DNS FQDN 為當前域中的 DNS 服務器主機名
選擇服務器類型, [API]
再次填寫 ADMIN_API_KEY 密鑰
定義當期主機為 DNS 主服務器
確保最後綠色部分為配置文件同步中, 假設非綠色顯示, 則需要進一步排錯
參見下圖, 域被增加
添加主機 A 記錄方法
再次添加反向解析域
添加反向解析 PTR 記錄方法
最後更新:2017-04-03 12:54:53