5.4.2. 使用 TSIG 身份验证配置动态 DNS 更新

您可以将 IdM 服务器配置为使用 rndc.key 密钥文件对 DNS(TSIG)技术的 secret key 事务身份验证进行身份验证。TSIG 协议在 RFC2845 中定义。

先决条件

  • 您必须确保 IdM 服务器已部署并正确配置基于主机的防火墙。如需更多信息,请参阅 Linux 域身份、身份验证和策略指南中的 端口要求
  • 您必须在 IdM 服务器上获取 root 用户访问。
  • 您必须确认 Satellite 服务器或胶囊服务器是否配置为为您的部署提供 DNS 服务。
  • 您必须在用于管理用于部署的 DNS 服务的卫星或胶囊的基础操作系统上配置 DNS、DHCP 和 TFTP 服务。
  • 您必须创建回答文件的备份。如果已损坏,您可以使用备份将回答文件恢复到其原始状态。如需更多信息,请参阅配置 Satellite 服务器

流程

要使用 TSIG 身份验证配置动态 DNS 更新,请完成以下步骤:

在 IdM 服务器中启用对 DNS 区的外部更新

  1. 在 IdM 服务器中,在 /etc/named.conf 文件的顶部添加以下内容:

    ########################################################################
    
    include "/etc/rndc.key";
    controls  {
    inet _IdM_Server_IP_Address_ port 953 allow { _Satellite_IP_Address_; } keys { "rndc-key"; };
    };
    ########################################################################
  2. 重新载入 named 服务以使更改生效:

    # systemctl reload named
  3. 在 IdM web UI 中,进入 Network Services > DNS > DNS Zones 并点区的名称。在 Settings 选项卡中,应用以下更改:

    1. BIND 更新策略 框中添加以下内容:

      grant "rndc-key" zonesub ANY;
    2. Dynamic update 设置为 True
    3. Update 保存更改。
  4. /etc/rndc.key 文件从 IdM 服务器复制到 Satellite 服务器的基础操作系统。使用以下命令:

    # scp /etc/rndc.key root@satellite.example.com:/etc/rndc.key
  5. 要为 rndc.key 文件设置正确的所有权、权限和 SELinux 上下文,请输入以下命令:

    # restorecon -v /etc/rndc.key
    # chown -v root:named /etc/rndc.key
    # chmod -v 640 /etc/rndc.key
  6. foreman-proxy 用户手动分配给 指定组。通常, satellite-installer 可确保 foreman-proxy 用户属于 命名 UNIX 组,但在这种情形中,卫星不管理用户和组,因此您需要手动将 foreman-proxy 用户分配给指定组。

    # usermod -a -G named foreman-proxy
  7. 在控制台中,输入以下 satellite-installer 命令,将 Satellite 配置为使用外部 DNS 服务器:

    # satellite-installer --scenario satellite \
    --foreman-proxy-dns=true \
    --foreman-proxy-dns-managed=false \
    --foreman-proxy-dns-provider=nsupdate \
    --foreman-proxy-dns-server="IdM_Server_IP_Address" \
    --foreman-proxy-keyfile=/etc/rndc.key \
    --foreman-proxy-dns-ttl=86400

将外部更新测试到 IdM 服务器中的 DNS 区

  1. 安装 bind-utils 工具:

    # yum install bind-utils
  2. 确保卫星服务器的 /etc/rndc.key 文件中的密钥与 IdM 服务器上的 /etc/rndc.key 文件中的密钥相同:

    key "rndc-key" {
            algorithm hmac-md5;
            secret "secret-key==";
    };
  3. 在卫星服务器上,为主机创建一个测试 DNS 条目。例如,在 IdM 服务器上具有 A 记录 192.168.25.20 的主机 test.example.com,地址为 192.168.25.1

    # echo -e "server 192.168.25.1\n \
    update add test.example.com 3600 IN A 192.168.25.20\n \
    send\n" | nsupdate -k /etc/rndc.key
  4. 在 Satellite 服务器中测试 DNS 条目:

    # nslookup test.example.com 192.168.25.1
    Server:		192.168.25.1
    Address:	192.168.25.1#53
    
    Name:	test.example.com
    Address: 192.168.25.20
  5. 要在 IdM web UI 中查看条目,请导航至 Network Services > DNS Zones。点区域的名称,并按名称搜索主机。
  6. 如果成功解析,请删除测试 DNS 条目:

    # echo -e "server 192.168.25.1\n \
    update delete test.example.com 3600 IN A 192.168.25.20\n \
    send\n" | nsupdate -k /etc/rndc.key
  7. 确认 DNS 条目已被删除:

    # nslookup test.example.com 192.168.25.1

    如果成功删除了记录,上面的 nslookup 命令会失败并返回 SERVFAIL 错误消息。