前面文章里面提到ipa +nfs 没有昨天,是密钥的问题,经过几天的查找文档与测试,终于可以了,具体如下:
1、 修改ldap 添加密钥类型
cat << EOF >/tmp/nfs_add_des.ldifdn: cn=DADI.COM,cn=kerberos,dc=dadi,dc=comchangetype: modifyadd: krbSupportedEncSaltTypeskrbSupportedEncSaltTypes: des-cbc-crc:normal-add: krbSupportedEncSaltTypeskrbSupportedEncSaltTypes: des-cbc-crc:special-add: krbDefaultEncSaltTypeskrbDefaultEncSaltTypes: des-cbc-crc:specialEOFsed -i 's/^ $//g' /tmp/nfs_add_des.ldifldapmodify -x -D "cn=directory manager" -w 111111 -h ipa.dadi.com -p 389 -f /tmp/nfs_add_des.ldifvi /etc/krb5.conf[libdefaults]allow_weak_crypto = truesupported_enctypes = aes256-cts:normal arcfour-hmac:normal des3-hmac-sha1:normal des-cbc-crc:normal/etc/init.d/krb5kdc restart
2、添加 nfs 主机信息:
kinit adminipa host-add nfs3.dadi.comipa service-add nfs/nfs3.dadi.com
3、添加用户登录ldap mount nfs 键值:
##添加fsm /home 目录ipa automountkey-add default auto.home --key=fsm --info=-fstype=nfs4,rw,sec=krb5i,proto=tcp,vers=4 nfs3.dadi.com:/export/fsm 或者是新建一个Automount Maps 默认为defaultipa automountlocation-add dmzipa automountmap-find dmzipa automountmap-add dmz auto.homeipa automountkey-add dmz auto.master --key=/home --info=auto.homeipa automountkey-add dmz auto.home --key=fsm --info=-fstype=nfs4,rw,sec=krb5i,proto=tcp,vers=4 nfs3.dadi.com:/export/fsm
4、安装配置nfs 服务器:
yum -y install ipa-client nfs-utils ipa-admintools openldap-clientsipa-client-install --mkhomedir --no-ntp --domain=dadi.com --server=ipa.dadi.com --no-sssd -p adminipa.dadi.com 执行:kinit adminipa-getkeytab -s ipa.dadi.com -p host/nfs3.dadi.com -k /tmp/krb5.keytabipa-getkeytab -s ipa.dadi.com -p nfs/nfs3.dadi.com -k /tmp/krb5.keytab -e des-cbc-crcscp /tmp/krb5.keytab nfs3.dadi.com:/tmpnfs3.dadi.com 导入keytab:rm -f /etc/krb5.keytab( echo rkt /tmp/krb5.keytab; echo wkt /etc/krb5.keytab) |ktutil###查看klist -etk perl -npe 's/#SECURE_NFS="yes"/SECURE_NFS="yes"/g' -i /etc/sysconfig/nfscat << EOF > /etc/exports /export *(rw,sec=sys:krb5:krb5i:krb5p)EOFmkdir /export/fsm && cp /etc/skel/.bash* /export/fsm && chmod 700 /export/fsm && chown -R fsm:fsm /export/fsmservice rpcidmapd startservice nfs startservice rpcsvcgssd startservice rpcgssd startchkconfig rpcgssd onchkconfig rpcsvcgssd onchkconfig nfs onchkconfig rpcidmapd onvi /etc/krb5.conf[libdefaults]allow_weak_crypto = true
5、client.dadi.com 上配置:
kinit adminipa-getkeytab -s ipa.dadi.com -p nfs/client.dadi.com -k /etc/krb5.keytab -e des-cbc-crcvi /etc/krb5.conf [libdefaults] allow_weak_crypto = trueipa-client-automount --location=default -S --server=ipa.dadi.com卸载:ipa-client-automount --uninstallchkconfig rpcgssd onservice rpcgssd startservice rpcidmapd startchkconfig rpcidmapd onipa service-show nfs/client.dadi.com Principal: nfs/client.dadi.com@DADI.COM Keytab: True Managed by: client.dadi.com
6、登录测试:
#ssh -l fsm client.dadi.com#df -mhFilesystem Size Used Avail Use% Mounted onnfs3.dadi.com:/export/fsm 51G 180M 49G 1% /home/fsm已经自动mount 了,#mountnfs3.dadi.com:/export/fsm on /home/fsm type nfs (rw,sec=krb5i,vers=4,addr=192.88.50.51,clientaddr=192.88.50.49)
7、其他:
编辑/etc/sysconfig/autofs 添加另外一台 ldap 服务器地址LDAP_URI=ldap://ipa.dadi.com ldap://ipa1.dadi.com
参考文档:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Identity_Management_Guide/kerb-nfs.htmlhttp://www.miljan.org/main/2010/10/18/freeipa-and-automount-nis-maps/