从 AD PDC 安装 kerberos cifs 多用户

从 AD PDC 安装 kerberos cifs 多用户

我正在尝试从 Windows DC 在具有多用户支持的 ubuntu 服务器上安装 cifs 文件夹。

我可以在服务器上以 root 身份获取用户 kerberos 票证,并使用 kerberos 挂载目录,没有任何问题。但我不想以用户身份挂载目录,它应该以多用户身份挂载,并可供服务器上的所有用户访问。

也许这只是一个关于理解的一般问题,也许你可以纠正我这里的错误。

  • 多用户挂载服务器需要来自 DC 的密钥表(cifs/samba.domain 的 ktpass 导出)
  • Samba 使用此 keytab 来挂载 DC 共享多用户
  • Winbind / kerberos 根据 DC 对用户进行身份验证并发出票证
  • 用户可以使用他的票证访问共享

我在 DC 上导出了一个 keytab 文件,并将其作为全局 keytab 文件 /etc/krb5.keytab

root@remote:/etc# klist -ke
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- --------------------------------------------------------------------------
   3 cifs/[email protected] (des-cbc-md5) 

但是我仍然无法挂载目录,因为密钥不可用,挂载错误(126):所需密钥不可用

系统日志显示了以下内容:

May 17 11:37:22 remote cifs.upcall: key description: cifs.spnego;0;0;3f000000;ver=0x2;host=nina.mbeya.domain.org;ip4=10.10.10.17;sec=krb5;uid=0x0;creduid=0x0;user=root;pid=0x599b
May 17 11:37:22 remote cifs.upcall: ver=2
May 17 11:37:22 remote cifs.upcall: host=nina.mbeya.domain.org
May 17 11:37:22 remote cifs.upcall: ip=10.10.10.17
May 17 11:37:22 remote cifs.upcall: sec=1
May 17 11:37:22 remote cifs.upcall: uid=0
May 17 11:37:22 remote cifs.upcall: creduid=0
May 17 11:37:22 remote cifs.upcall: user=root
May 17 11:37:22 remote cifs.upcall: pid=22939
May 17 11:37:22 remote cifs.upcall: find_krb5_cc: considering /tmp/krb5cc_1000
May 17 11:37:22 remote cifs.upcall: find_krb5_cc: /tmp/krb5cc_1000 is owned by 1000, not 0
May 17 11:37:22 remote cifs.upcall: krb5_get_init_creds_keytab: -1765328378
May 17 11:37:22 remote cifs.upcall: handle_krb5_mech: getting service ticket for cifs/nina.mbeya.domain.org
May 17 11:37:22 remote cifs.upcall: cifs_krb5_get_req: unable to resolve (null) to ccache
May 17 11:37:22 remote cifs.upcall: handle_krb5_mech: failed to obtain service ticket (-1765328245)
May 17 11:37:22 remote cifs.upcall: handle_krb5_mech: getting service ticket for host/nina.mbeya.domain.org
May 17 11:37:22 remote cifs.upcall: cifs_krb5_get_req: unable to resolve (null) to ccache
May 17 11:37:22 remote cifs.upcall: handle_krb5_mech: failed to obtain service ticket (-1765328245)

我非常感激对此的任何意见。

谢谢

答案1

您注意到您可以获得“以 root 身份获取用户 Kerberos 票证”,但是出现“密钥不可用”错误。

find_krb5_cc: /tmp/krb5cc_1000 is owned by 1000, not 0

此错误意味着 mount.cifs 无权访问 Kerberos 票证,因为它不属于调用 mount.cifs 的 root (userid: 0)。我假设 root 使用用户密码获得的 Kerberos 票证仅供该用户使用。

现在,为什么 mount 想要让票证归 root 所有?第一行的这一部分:

uid=0x0;creduid=0x0;user=root;

可能是原因。Mount.cifs 正在执行以 root 身份。您可能想尝试将 uid 和 creduid 更改为用户的 useruid。

我不知道您从哪里调用 mount.cifs,所以如果说得有点模糊,我很抱歉。您能否提供您正在运行的 mount.cifs 命令及其选项?

至于共享“可供服务器上的所有用户访问”:我在用户登录后运行 pam_mount 并使用其用户名、密码和 Kerberos 票证挂载共享,因此我没有使用 keytab。这是我调用的挂载命令:

mount -t cifs //<SERVER>/<VOLUME> <MOUNTPOINT> -o username=%(USER),sec=krb5,domain=<DOMAIN>,cruid=%(USERUID),uid=%(USERUID),gid=%(USERGID),rw

将授权用户添加到单个组。同时将 file_mode= 和 dir_mode= 设置为正确的权限,以使该组具有对文件的读/写访问权限,例如 770。

相关内容