我在公司网络中工作,该网络有 DNS 服务器,但没有实际的域。安装 FreeIPA 服务器并设置域(与 bind9 DNS 服务器中的 DNS 区域同名)后,我苦苦思索如何将当前区域移动到 FreeIPA 服务器作为主服务器,将旧的 bind9 服务器作为从服务器。
我已经配置了 FreeIPA 服务器来执行区域传输,但是我在将绑定区域文件转换为 LDIF 以导入 FreeIPA 系统所需的格式方面遇到了困难。我在网上找到了一些脚本,但是它们要么严重过时,要么在使用 pdns_zone2ldap 时出现 named.conf 文件错误。
我觉得自己忽略了一些显而易见的东西,然而经过几天的尝试自己弄清楚之后,我希望有人以前做过这件事并且可以告诉我下一步该怎么做。
编辑:添加更多背景信息
使用 pdns_zone2ldap 时出现以下错误:
pdns_zone2ldap --named-conf=/etc/named.conf --zone-file=company.net.zone --zone-name=company.net --verbose=yes
Fatal error: Error in bind configuration '/etc/named.conf' on line 37: syntax error
有问题的配置文件(/etc/named.conf)如下所示:
/* WARNING: This config file is managed by IPA.
*
* DO NOT MODIFY! Any modification will be overwritten by upgrades.
*
*
* - /etc/named/ipa-options-ext.conf (for options)
* - /etc/named/ipa-logging-ext.conf (for logging options)
* - /etc/named/ipa-ext.conf (all other settings)
*/
options {
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
tkey-gssapi-keytab "/etc/named.keytab";
pid-file "/run/named/named.pid";
managed-keys-directory "/var/named/dynamic";
/* user customizations of options */
include "/etc/named/ipa-options-ext.conf";
/* crypto policy snippet on platforms with system-wide policy. */
include "/etc/crypto-policies/back-ends/bind.config";
};
/* If you want to enable debugging, eg. using the 'rndc trace' command,
* By default, SELinux policy does not allow named to modify the /var/named directory,
* so put the default debug log file in data/ :
*/
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
print-time yes;
};
include "/etc/named/ipa-logging-ext.conf";
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
/* user customization */
include "/etc/named/ipa-ext.conf";
dyndb "ipa" "/usr/lib64/bind/ldap.so" {
uri "ldapi://%2fvar%2frun%2fslapd-company-NET.socket";
base "cn=dns,dc=company,dc=net";
server_id "servername.company.net";
auth_method "sasl";
sasl_mech "EXTERNAL";
krb5_keytab "FILE:/etc/named.keytab";
};
答案1
您不想使用 PDNS 转换器。它不会为您生成适合 FreeIPA 的 LDIF 文件,因为它不了解 FreeIPA 特定的 LDAP 模式。
相反,看看https://github.com/freeipa/zone2dyndb-ldif。此工具知道如何生成 FreeIPA 特定的 LDAP 条目。