34.3. 设置 Kerberos 感知 NFS 服务器
- 如果您的任何 NFS 客户端只支持弱加密,如 Red Hat Enterprise Linux 5 客户端:
- 更新 IdM 服务器 Kerberos 配置,以启用弱
des-cbc-crc加密类型:$ ldapmodify -x -D "cn=directory manager" -w password -h ipaserver.example.com -p 389 dn: cn=REALM_NAME,cn=kerberos,dc=example,dc=com changetype: modify add: krbSupportedEncSaltTypes krbSupportedEncSaltTypes: des-cbc-crc:normal - add: krbSupportedEncSaltTypes krbSupportedEncSaltTypes: des-cbc-crc:special - add: krbDefaultEncSaltTypes krbDefaultEncSaltTypes: des-cbc-crc:special - 在 NFS 服务器中,在 NFS 服务器的
/etc/krb5.conf文件中添加以下条目以启用弱加密支持:allow_weak_crypto = true
- 获取Kerberos ticket:
[root@nfs-server ~]# kinit admin - 如果 NFS 主机计算机尚未作为客户端添加到 IdM 域,请创建主机条目。请参阅 第 12.3 节 “添加主机条目”。
- 创建 NFS 服务条目:
[root@nfs-server ~]# ipa service-add nfs/nfs-server.example.com如需更多信息,请参阅 第 16.1 节 “添加和编辑服务条目和密钥选项卡”。 - 使用以下 ipa-getkeytab 命令为 NFS 服务器检索 NFS 服务 keytab,该命令可将密钥保存在
/etc/krb5.keytab文件中:[root@nfs-server ~]# ipa-getkeytab -s ipaserver.example.com -p nfs/nfs-server.example.com -k /etc/krb5.keytab如果您的任何 NFS 客户端只支持弱加密,还会将-e des-cbc-crc选项传递给 命令,以请求 DES 加密 keytab。 - 通过检查服务条目,在 IdM 中使用 keytab 验证 NFS 服务是否已正确配置:
[root@nfs-server ~]# ipa service-show nfs/nfs-server.example.com Principal name: nfs/nfs-server.example.com@IDM.EXAMPLE.COM Principal alias: nfs/nfs-server.example.com@IDM.EXAMPLE.COM Keytab: True Managed by: nfs-server.example.com - 安装 nfs-utils 软件包:
[root@nfs-server ~]# yum install nfs-utils - 运行 ipa-client-automount 工具来配置 NFS 设置:
[root@nfs-server ~] ipa-client-automount Searching for IPA server... IPA server: DNS discovery Location: default Continue to configure the system with these values? [no]: yes Configured /etc/sysconfig/nfs Configured /etc/idmapd.conf Started rpcidmapd Started rpcgssd Restarting sssd, waiting for it to become available. Started autofs默认情况下,这个命令启用安全 NFS 并将/etc/idmapd.conf文件中的Domain参数设置为 IdM DNS 域。如果您使用不同的域,请使用--idmap-domain domain_name参数指定它。 - 将
nfs-idmapd服务配置为在系统引导时自动启动:# systemctl enable nfs-idmapd - 编辑
/etc/exports文件并使用 krb5p Kerberos 安全设置添加共享:/export *(rw,sec=krb5:krb5i:krb5p) /home *(rw,sec=krb5:krb5i:krb5p)这个示例在启用了 Kerberos 身份验证时以读写模式共享/export和/home目录。 - 重新导出共享目录:
[root@nfs-server ~]# exportfs -rav - (可选)将 NFS 服务器配置为 NFS 客户端。请参阅 第 34.4 节 “设置 Kerberos 感知 NFS 客户端”。