[bind] 貢獻一個自己寫的DNS管理系統

用了Bind-DLZ 有View功能,目前公司裏自己在用,因爲單位暫時沒那麼多資源,只設置了電線和網通線路,默認都是電線,需要其他資源的需要修改小數據庫。添加了一些小 功能,可以查看當前bind的運行狀態,以及域名信息,如果down了會有顯示,以後有時間應該會陸續添加一些小功能,方便管理DNS,因爲很喜歡做界 面,也會多多美化下。我已經修改成通用版本了,可以正常使用。bind-dlz 安裝請查看相關文檔,我稍後會把這裏的配置傳上來。下一個版本將添加清理緩存的功能和控制bind服務啟動的功能。

mycdn.rar (218.03 KB, 下載次數: 147)



namede.conf文件的代碼(開了遞歸,因為現在機器在內網):


key "rndc-key" {
algorithm hmac-md5;
secret "gOszdwp5stjsnfI7MybyIg==";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};

options{
directory "/usr/local/bind/etc";
forwarders {202.96.209.133;};
pid-file "/usr/local/bind/etc/named.pid";
statistics-file "/usr/local/bind/etc/named.stats";
recursion yes;
allow-query {any;};
allow-transfer {any;};
};

logging {
channel bind_info {
file "/var/log/bind.log" versions 20 size 20m;
print-category yes;
print-time yes;
severity notice;
};
category default {
bind_info;
};
};


include "/usr/local/bind/etc/view.conf";
include "/usr/local/bind/etc/cnc.acl";
複製代碼




view.conf部份的代碼:


#cnc-view
VIEw "cnc_view" {
match-clients { CNC; };
allow-query-cache { ANY; };
allow-recursion { ANY; };
allow-transfer { ANY; };
recursion yes;

dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}
{select zone from dns_records where zone = '$zone$' and view='CNC' limit 1}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
else data end from dns_records where zone = '$zone$' and view='CNC' and host = '$record$'
and not (type = 'SOA' or type = 'NS')}
{select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum
from dns_records where zone = '$zone$' and (type = 'SOA' or type='NS')}
{select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,
minimum from dns_records where zone = '$zone$' and view='CNC' and not (type = 'SOA' or type = 'NS')}
{select zone from xfr_table where zone = '$zone$' and view='CNC' and client = '$client$'}
{update data_count set count = count + 1 where zone ='$zone$'}";
};
zone "." IN {
type hint;
file "named.root";
};
};
#cnc-view
view "any_view" {
match-clients { ANY; };
allow-query-cache { ANY; };
allow-recursion { ANY; };
allow-transfer { ANT; };

dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}
{select zone from dns_records where zone = '$zone$' and view='TELCOM' limit 1}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
else data end from dns_records where zone = '$zone$' and view='TELCOM' and host = '$record$'
and not (type = 'SOA' or type = 'NS')}
{select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum
from dns_records where zone = '$zone$' and (type = 'SOA' or type='NS')}
{select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,
minimum from dns_records where zone = '$zone$' and view='TELCOM' and not (type = 'SOA' or type = 'NS')
}
{select zone from xfr_table where zone = '$zone$' and view='TELCOM' and client = '$client$'}
{update data_count set count = count + 1 where zone ='$zone$'}";
};
zone "." IN {
type hint;
file "named.root";
};
};
複製代碼




安裝方法:


修改 config/config.php  裏面的mysql連接參數


默認用戶名: admin1 密碼admin1



4.jpg
3.jpg
2.jpg
1.jpg







轉http://bbs.linuxtone.org/thread-8055-1-1.html








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章