标签:DNS管理

贡献一个firstsko写的DNS管理系统

No Comments Linux

用了Bind-DLZ 有View功能,目前公司里自己在用,因为单位暂时没那么多资源,只设置了电线和网通线路,默认都是电线,需要其他资源的需要修改小数据库。添加了一些小功能,可以查看当前bind的运行状态,以及域名信息,如果down了会有显示,以后有时间应该会陆续添加一些小功能,方便管理DNS,因为很喜欢做界面,也会多多美化下。我已经修改成通用版本了,可以正常使用。bind-dlz 安装请查看相关文档,我稍后会把这里的配置传上来。下一個版本將添加清理緩存的功能和控制bind服務啟動的功能。
clip_image001 mycdn.rar (218.03 KB, 下载次数: 1221) 
namede.conf文件的代碼(開了遞歸,因為現在機器在內網):

1. key "rndc-key" {

2. algorithm hmac-md5;

3. secret "gOszdwp5stjsnfI7MybyIg==";

4. };

5.

6. controls {

7. inet 127.0.0.1 port 953

8. allow { 127.0.0.1; } keys { "rndc-key"; };

9. };

10.

11. options{

12. directory "/usr/local/bind/etc";

13. forwarders {202.96.209.133;};

14. pid-file "/usr/local/bind/etc/named.pid";

15. statistics-file "/usr/local/bind/etc/named.stats";

16. recursion yes;

17. allow-query {any;};

18. allow-transfer {any;};

19. };

20.

21. logging {

22. channel bind_info {

23. file "/var/log/bind.log" versions 20 size 20m;

24. print-category yes;

25. print-time yes;

26. severity notice;

27. };

28. category default {

29. bind_info;

30. };

31. };

32.

33.

34. include "/usr/local/bind/etc/view.conf";

35. include "/usr/local/bind/etc/cnc.acl";

复制代码

view.conf部份的代碼:

1. #cnc-view

2. VIEw "cnc_view" {

3. match-clients { CNC; };

4. allow-query-cache { ANY; };

5. allow-recursion { ANY; };

6. allow-transfer { ANY; };

7. recursion yes;

8.

9. dlz "Mysql zone" {

------中间广告---------

10. database "mysql

11. {host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}

12. {select zone from dns_records where zone = ‘$zone$’ and view=’CNC’ limit 1}

13. {select ttl, type, mx_priority, case when lower(type)=’txt’ then concat(‘\"’, data, ‘\"’)

14. else data end from dns_records where zone = ‘$zone$’ and view=’CNC’ and host = ‘$record$’

15. and not (type = ‘SOA’ or type = ‘NS’)}

16. {select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum

17. from dns_records where zone = ‘$zone$’ and (type = ‘SOA’ or type=’NS’)}

18. {select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,

19. minimum from dns_records where zone = ‘$zone$’ and view=’CNC’ and not (type = ‘SOA’ or type = ‘NS’)}

20. {select zone from xfr_table where zone = ‘$zone$’ and view=’CNC’ and client = ‘$client$’}

21. {update data_count set count = count + 1 where zone =’$zone$’}";

22. };

23. zone "." IN {

24. type hint;

25. file "named.root";

26. };

27. };

28. #cnc-view

29. view "any_view" {

30. match-clients { ANY; };

31. allow-query-cache { ANY; };

32. allow-recursion { ANY; };

33. allow-transfer { ANT; };

34.

35. dlz "Mysql zone" {

36. database "mysql

37. {host=127.0.0.1 dbname=dns ssl=false port=3306 user=root pass=Mm123456}

38. {select zone from dns_records where zone = ‘$zone$’ and view=’TELCOM’ limit 1}

39. {select ttl, type, mx_priority, case when lower(type)=’txt’ then concat(‘\"’, data, ‘\"’)

40. else data end from dns_records where zone = ‘$zone$’ and view=’TELCOM’ and host = ‘$record$’

41. and not (type = ‘SOA’ or type = ‘NS’)}

42. {select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum

43. from dns_records where zone = ‘$zone$’ and (type = ‘SOA’ or type=’NS’)}

44. {select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,

45. minimum from dns_records where zone = ‘$zone$’ and view=’TELCOM’ and not (type = ‘SOA’ or type = ‘NS’)

46. }

47. {select zone from xfr_table where zone = ‘$zone$’ and view=’TELCOM’ and client = ‘$client$’}

48. {update data_count set count = count + 1 where zone =’$zone$’}";

49. };

50. zone "." IN {

51. type hint;

52. file "named.root";

53. };

54. };

复制代码

安装方法:
修改 config/config.php  里面的mysql连接参数
默认用户名: admin1 密码admin1
clip_image002
clip_image003
clip_image004
clip_image005
补充内容 (2012-3-3 00:55):
65楼有selboo修改的部分,可以按照当前时间戳来设置TTL,修复了分页的bug。感谢。

by firstsko