发个dns管理系统
- xxx2011-07-19金牌会员1565
最近的DNS不平静啊,老是有服务商挂掉,于是乎就想自己组DNS给自己用。
昨天写了半天的智能DNS系统,写的我腰酸背痛腿抽筋。好不容易写点东西出来了,突然在网上发现一个简单的DNS管理系统,虽然简单了点,但是还能用,就拿来凑合着用吧,不要折腾自己了
感觉自己真的老了,盯着电脑一个小时眼睛就开始痛了。。。以前24小时都能挺得住的,现在几个小时都熬不住了。
废话不多说,上菜
linuxtone论坛上firstsko童鞋发布的
请先安装配置Bind-DLZ-mysql> "
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[ 本帖最后由 xxx 于 2011-7-19 07:41 编辑 ]