gpt4 book ai didi

php - 在 DNS 区域 Bind 10 中运行 PHP

转载 作者:IT王子 更新时间:2023-10-29 00:13:19 25 4
gpt4 key购买 nike

我正在使用带有 BIND 10.1.2 的 linux CentOS 6.64

我在主 DNS (example.com) 中有一个附加区域 (list.example.com)

绑定(bind)(命名)配置文件/etc/named.conf 包含区域:

zone "list.example.com" IN {
type master;
file "list-example-com.zone";
allow-query { localhost; };
allow-transfer { 127.0.0.1; };
};

区域文件list-example-com.zone如下:

$TTL 86400      ; 1 day
@ IN SOA ns1.example.com. hostmaster.example.com. (
2004032201 ; serial
7200 ; refresh (2 hours)
5400 ; retry (1.5 hours)
1814400 ; expire (3 weeks)
86400 ; minimum (1 day)
)
IN NS ns1.example.com.
;
IN A 192.168.177.22
;
; -----------------------------------------------------------------
49.30.22.66 IN A 127.0.0.3
44.63.20.10 IN A 127.0.0.2
64.42.10.5 IN A 127.0.0.2
14.3.6.8 IN A 127.0.0.3

// AND OTHER 1000S OF RECORDS LIKE THAT!

我们以其中一个重新编码的 IP 为例

IP 44.63.20.10 的“A DNS 查找”将是:

44.63.20.10.list.example.com 将从 DNS 返回 127.0.0.2

好的,现在我想做的是,我不想列出 1000 条 IP 记录,我只想在 named.conf、区域文件或任何其他文件中运行 PHP 文件来执行一些代码并为“A”返回 127.0.0.2 IP 44.63.20.10 的 DNS"

我的文件.php:

<?php

// Just need to get the required IP (44.63.20.10) and the DNS_TYPE of the request (A, TXT,...ect) then:
// Execute some PHP codes to do some stuff (including connect to mysql database..ect)
// If the IP is TRUE, then return: (44.63.20.10 IN DNS_TYPE X)

?>

希望你清楚。

我有自己的 PHP 文件,只需要知道是否可以这样做?如果是,那么如何?有什么想法吗?

谢谢。

最佳答案

您必须使用 BIND 全功能 API,它允许“插件”替换指定区域和来自 BIND 的 BIND 内部数据库功能。

您需要编辑 BIND 源文件和 makefile.in,然后重新构建 BIND,包括您的源文件和头文件。

要从他的 API 开始,找到位于目录 bind-release/lib/dns/include/dns/db.h 中的文件 db.h,其中 bind-release 应该替换为您所在的位置和版本号解压源分发,例如/usr/src/bind/10.1.2

这是一个副本 http://pastebin.com/yTN5Aq03

关于php - 在 DNS 区域 Bind 10 中运行 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31181272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com