AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 715066
Accepted
cornuz
cornuz
Asked: 2015-08-19 09:27:52 +0800 CST2015-08-19 09:27:52 +0800 CST 2015-08-19 09:27:52 +0800 CST

kerberized NFSv4 自动挂载的主目录中的错误用户映射

  • 772

简短的问题描述

这个问题是关于 NFSv4 中的 id 映射出错。

NFS 服务器:带有 DSM 5.2 的 Synology DS。

客户端:一台普通的 FC22 机器,它自动挂载为 /home 从上面导出的文件夹之一。

两台机器都是 freeIPA 域的注册客户端,因此使用 freeIPA 服务器作为 DNS 和 LDAP 服务器。

当 LDAP 用户登录客户端时,它会找到已安装的文件夹。所以安装工作。但是,文件的所有权映射为nobody:nobody. 我知道这个“没人的问题”并不新鲜,但到目前为止我发现的解决方案都没有解决这个问题。

LDAP 用户登录和文件触摸

$ 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可以正确登录并拥有 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 用户正确地登录到其主目录中,该目录是预先创建并分配给他的。但是任何新文件都获得了错误的所有权:

-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:100guest: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

备注和问题

  • 在这些情况下,错误映射的最常见原因似乎是双方的Domain设置缺失或不一致。idmapd.conf这里两边都正确设置了
  • 如果我使用静态映射,它就可以工作,即 1)ldapuser1在服务器上创建本地 2)在 [Static] in 下添加一个条目idmapd.conf,其中[email protected]=ldapuser1. 然而,这不是目标。
  • Synology 服务器显然不是 Fedora/RedHat,因此它不是完美的 freeIPA 伴侣。特别是,它错过了SSSD. 不过,我认为它应该工作。

我完全被困在这一点上。我什至不知道去哪里寻求帮助。Synology 支持声称这应该有效。根据 freeIPA 开发人员的说法,这甚至是题外话,因为不是 freeIPA 特定的,而是“只是”NFS & co 问题。这是有争议的,因为所有这些技术的连接和使用方式都是 freeIPA 特定的。

无论如何,我不知道该看什么了。这就是为什么我在这里问希望有人能让我至少向前迈出一步。任何猜测都非常受欢迎!

ldap
  • 1 1 个回答
  • 2135 Views

1 个回答

  • Voted
  1. Best Answer
    cornuz
    2015-08-22T07:55:21+08:002015-08-22T07:55:21+08:00

    在与 Synology 支持进行会话后,我终于明白,由于 DSM 5.2 的限制,目前这无法正常工作。

    问题是 DSM 假定 LDAP 服务器使用UMich 模式,这是特定于 NFS 的,因此在 GSS 请求进入时寻找属性GSSAuthName。相反,FreeIpa 将 Kerberos 主体存储在 LDAP 中,并且对于每个 Kerberos 主体总是有krbPrincipalName属性可用的。

    没有找到GSSAuthName,DSM 将每个请求映射到nobody.

    我已向 Synology 提出功能请求,以使用 SSSD 正确处理 id 映射。

    在那之前,我求助于sec=sys. 注意:确保未选中 Synology LDAP 配置中的“启用 UID/GID 转换”!

    • 1

相关问题

  • Cygwin sshd 和 LDAP 身份验证

  • 从 OpenLDAP 检索操作属性

  • 为 Mac 网络使用 Linux 和 Open LDAP

  • 使用LDAP服务器身份验证的Linux中单个用户的多个登录名

  • 使用 smbldap 管理用户/组的 Web 前端

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve