Kerberos 服务票证是否由 mount.cifs 或内核缓存?

Kerberos 服务票证是否由 mount.cifs 或内核缓存?

使用 krbr5i 安装 CIFS 共享并随后销毁我的 Kerberos 票证时,kdestroy仍然可以在同一台服务器上安装其他共享。这怎么可能?mount.cifs 不必再次将服务票证发送到共享服务器吗?票证是否缓存在某处?这是由内核(或 cifs.upcall)处理的吗?

卸载所有共享后,mount.cifs 将失败(正如预期的那样)。

重现步骤:

$ # Aquire tgt:
$ kinit
Password for [email protected]:
$ # Mount share1 and get cifs ticket:
$ sudo mount.cifs -v -o sec=krb5i,cache=strict,rw,user=sahisb,cruid=$UID,cifsacl,nounix,multiuser,vers=2.1 //dc.domain.example.com/share1 /share1
mount.cifs kernel mount options: ip=[redacted],unc=\\dc.domain.example.com\share1,sec=krb5i,cache=strict,cifsacl,nounix,multiuser,vers=2.1,cruid=1297401199,user=sahisb,pass=********
$ # Destroy tgt and cifs ticket:
$ kdestroy
$ # Mount share2. I expected this to fail but it will succeed:
$ sudo mount.cifs -v -o sec=krb5i,cache=strict,rw,user=sahisb,cruid=$UID,cifsacl,nounix,multiuser,vers=2.1 //dc.domain.example.com/share2 /share2
mount.cifs kernel mount options: ip=[redacted],unc=\\dc.domain.example.com\share2,sec=krb5i,cache=strict,cifsacl,nounix,multiuser,vers=2.1,cruid=1297401199,user=sahisb,pass=********

此时,klist 仍然找不到凭据缓存。现在让我们尝试卸载共享并再次挂载它们:

$ umount /share1
$ umount /share2
$ sudo mount.cifs -v -o sec=krb5i,cache=strict,rw,user=sahisb,cruid=$UID,cifsacl,nounix,multiuser,vers=2.1 //dc.domain.example.com/share2 /share2
mount.cifs kernel mount options: ip=[redacted],unc=\\dc.domain.example.com\share2,sec=krb5i,cache=strict,cifsacl,nounix,multiuser,vers=2.1,cruid=1297401199,user=sahisb,pass=********
mount error(126): Required key not available

正如预期的那样失败了。

答案1

当挂载 CIFS/SMB 共享时,会创建一个会话(如果服务的凭证(在本例中为 kerberos 服务票证)正确)。创建会话后,我们无需再进行身份验证。

由于 share1 和 share2 由同一服务 (dc.domain.example.com) 提供,因此对这些文件的所有请求都使用相同的会话。

相关内容