这个问题是关于NFSv4中的id映射出错的。
NFS服务器:Synology DS,DSM 5.2。
客户端:常规FC22机器,它自动挂载为上面导出的文件夹之一。
这两台机器都注册了一个freeIPA域的客户端,因此使用freeIPA服务器作为DNS和LDAP服务器。
当LDAP用户login客户端时,它会find已安装的文件夹。 所以挂载工作。 但是,文件的所有权被映射为nobody:nobody 。 我知道这个“没有人问题”并不是什么新东西,但是迄今为止我find的解决scheme都没有解决这个问题。
$ ssh ldapuser1@client1 ldapuser1@client1's password: -bash-4.3$ id uid=1172000004(ldapuser1) gid=1172000004(ldapuser1) groups=1172000004(ldapuser1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
ldapuser1可以正确login并具有uid 1172000004。
-bash-4.3$ pwd /home/ldapuser1 -bash-4.3$ ls -lan total 8 drwxrwxrwx. 2 1172000004 1172000004 4096 18 aug 17:34 . drwxr-xr-x. 3 0 0 0 18 aug 18:33 ..
LDAP用户在其主目录中正确着陆,先创build并分配给他。 但是任何新文件都会得到错误的所有权:
-bash-4.3$ touch a -bash-4.3$ ls -lan total 8 drwxrwxrwx. 2 1172000004 1172000004 4096 18 aug 18:41 . drwxr-xr-x. 3 0 0 0 18 aug 18:33 .. -rwxrwxrwx. 1 99 100 0 18 aug 18:42 a
请注意,99:100是guest:users服务器上的用户。 服务器上的文件idmapd.conf告诉将nobody:nobody映射到guest:users 。
$ exportfs -v /volume1/shared_homes xxx.xxx.0.0/24(rw,async,no_root_squash,no_subtree_check,insecure_locks,anonuid=1025,anongid=100,sec=krb5,rw,no_root_squash,no_all_squash) $ klist -k /etc/nfs/krb5.keytab Keytab name: FILE:/etc/nfs/krb5.keytab KVNO Principal ---- -------------------------------------------------------------------------- 5 nfs/[email protected] 5 nfs/[email protected] 5 nfs/[email protected] 5 nfs/[email protected] $ cat /etc/idmapd.conf [General] Domain=hq.example.com Verbosity=10 [Mapping] Nobody-User=guest Nobody-Group=users [Translation] Method=nsswitch GSS-Methods=static,synomap [Static] $ cat /etc/nsswitch.conf passwd: files ldap winbind shadow: files ldap winbind group: files ldap winbind osts: files dns wins bootparams: files ethers: files netmasks: files networks: files protocols: files rpc: files services: files netgroup: files publickey: nisplus automount: files aliases: files
$ automount -s Mount point: /home source(s): instance type(s): sss map: auto.home * | -fstype=nfs4,rw,sec=krb5,soft,rsize=8192,wsize=8192 nfs-server.hq.example.com:/volume1/shared_homes/& $ df nfs-server.hq.example.com:/volume1/shared_homes/ldapuser1 11609721368 2208608120 9400994464 20% /home/ldapuser1 $ cat /etc/idmapd.conf [General] Domain=hq.example.com $ cat /etc/nsswitch.conf passwd: files sss shadow: files sss group: files sss hosts: files dns myhostname bootparams: nisplus [NOTFOUND=return] files ethers: files netmasks: files networks: files protocols: files rpc: files services: files sss netgroup: files sss publickey: nisplus automount: files sss aliases: files nisplus sudoers: files sss $ cat /etc/sysconfig/nfs | egrep -v "^#" RPCNFSDARGS="" RPCMOUNTDOPTS="" STATDARG="" SMNOTIFYARGS="" RPCIDMAPDARGS="" RPCGSSDARGS="-vvv" GSS_USE_PROXY="yes" RPCSVCGSSDARGS="-vvv" BLKMAPDARGS="" SECURE_NFS=yes
Aug 18 18:50:59 nfs-server idmapd[14622]: nfsdcb: authbuf=gss/krb5 authtype=user Aug 18 18:50:59 nfs-server idmapd[14622]: nfs4_uid_to_name: calling nsswitch->uid_to_name Aug 18 18:50:59 nfs-server idmapd[14622]: nfs4_uid_to_name: nsswitch->uid_to_name returned 0 Aug 18 18:50:59 nfs-server idmapd[14622]: nfs4_uid_to_name: final return value is 0 Aug 18 18:50:59 nfs-server idmapd[14622]: Server : (user) id "1173000004" -> name "[email protected]" Aug 18 18:50:59 nfs-server idmapd[14622]: nfsdcb: authbuf=gss/krb5 authtype=group Aug 18 18:50:59 nfs-server idmapd[14622]: nfs4_gid_to_name: calling nsswitch->gid_to_name Aug 18 18:51:00 nfs-server idmapd[14622]: nfs4_gid_to_name: nsswitch->gid_to_name returned 0 Aug 18 18:51:00 nfs-server idmapd[14622]: nfs4_gid_to_name: final return value is 0 Aug 18 18:51:00 nfs-server idmapd[14622]: Server : (group) id "1173000004" -> name "[email protected]"
请注意,似乎正确的用户/域请求映射。 但是在日志中,我也发现了很多对[email protected]和[email protected]映射的参考。
aug 18 18:50:59 client1.hq.example.com nfsidmap[2118]: key: 0x274d13a5 type: uid value: [email protected] timeout 600 aug 18 18:50:59 client1.hq.example.com nfsidmap[2118]: nfs4_name_to_uid: calling nsswitch->name_to_uid aug 18 18:50:59 client1.hq.example.com nfsidmap[2118]: nss_getpwnam: name '[email protected]' domain 'hq.example.com': resulting localname 'ldapuser1' aug 18 18:50:59 client1.hq.example.com nfsidmap[2118]: nfs4_name_to_uid: nsswitch->name_to_uid returned 0 aug 18 18:50:59 client1.hq.example.com nfsidmap[2118]: nfs4_name_to_uid: final return value is 0 aug 18 18:50:59 client1.hq.example.com nfsidmap[2120]: key: 0x3e28949 type: gid value: [email protected] timeout 600 aug 18 18:50:59 client1.hq.example.com nfsidmap[2120]: nfs4_name_to_gid: calling nsswitch->name_to_gid aug 18 18:50:59 client1.hq.example.com nfsidmap[2120]: nfs4_name_to_gid: nsswitch->name_to_gid returned 0 aug 18 18:50:59 client1.hq.example.com nfsidmap[2120]: nfs4_name_to_gid: final return value is 0
idmapd.conf中缺less或不一致的Domain设置。 这里正确的设置在两边 ldapuser1 2)在idmapd.conf添加一个条目,该条目表示[email protected]=ldapuser1 。 但是,这不是目标。 SSSD 。 不过,我认为它应该工作。 我完全被困在这一点上。 我甚至不知道在哪里寻求帮助。 Synology的支持声称,这应该工作。 根据freeIPA开发者的说法,这甚至是无关紧要的,因为不是可用的IPA特定的,而是“正义的”NFS&co问题。 这是有争议的,因为所有这些技术连接和使用的方式都是freeIPA特有的。
无论如何,我不知道该看什么。 这就是为什么我在这里问,希望有人能让我做至less更多一步。 任何猜测都是值得欢迎的!
经过与Synology支持的会议后,我终于明白,由于DSM 5.2的限制,目前无法正常工作。
问题是,DSM假定LDAP服务器使用UMich模式 ,这是NFS特定的,因此在GSS请求进入时查找属性GSSAuthName 。相反,FreeIpa将Kerberos主体存储在LDAP中,并且对于每个Kerberos主体始终存在krbPrincipalName属性可用。
没有findGSSAuthName ,DSM将每个请求映射到nobody 。
我向Synology发出了function请求,以便使用SSSD正确处理ID映射。
在此之前,我诉诸sec=sys 。 注意:确定“启用UID / GID转换”ni Synology LDAPconfiguration未被选中!