我们需要使用 S4U2Proxy 扩展生成模拟的 krb5-tickets (TGS)。票证构建成功,我们可以毫无问题地使用它们,例如与 smbclient 一起使用。但实际上,我们需要将它们与 mount.cifs 或 mount.nfs 一起使用,这不起作用。
当做 kinit (这意味着有一个 TGT)安装时没有任何问题。
挂载或底层功能是否需要 TGT?(Smbclient 显然没有)。如果没有:mount 使用的 krb5-ticket 是否有特殊要求?
这是错误消息:
mount error(126): Required key not available
我认为这是 dmesg 最重要的输出(见下面的完整输出):
cifs_spnego.c: key description = ver=0x2;host=file.mydomain.local;ip4=10.211.55.28;sec=krb5;uid=0x0;creduid=0x3e8;user=jdoe;pid=0x289a
CIFS VFS: Send error in SessSetup = -126
Ubuntu 18.04,内核版本 4.15.0-66-generic
清单:
Ticket cache: FILE:/tmp/krb5cc_1000
Default principal: [email protected]
Valid starting Expires Service principal
11/10/19 06:23:34 11/10/19 16:23:34 cifs/[email protected]
renew until 11/11/19 06:23:34
使用的挂载命令:
sudo mount -t cifs -o username=jdoe,domain=mydomain.local,sec=krb5,cruid=1000 //file.mydomain.local/share1 /mnt
完整的 dmesg 输出:
connect.c: Username: jdoe
connect.c: file mode: 0x1ed dir mode: 0x1ed
connect.c: CIFS VFS: in cifs_mount as Xid: 182 with uid: 0
connect.c: UNC: \\file.mydomain.local\share1
connect.c: Socket created
connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x6d6
fscache.c: cifs_fscache_get_client_cookie: (0x00000000dabd1b06/0x00000000d1987345)
connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 183 with uid: 0
connect.c: Existing smb sess not found
smb2pdu.c: Negotiate protocol
transport.c: Sending smb: smb_len=106
connect.c: Demultiplex PID: 10396
connect.c: RFC1002 header 0xf8
smb2misc.c: smb2_check_message length: 0xfc, smb_buf_length: 0xf8
smb2misc.c: SMB2 data length 120 offset 128
smb2misc.c: SMB2 len 252
transport.c: cifs_sync_mid_result: cmd=0 mid=0 state=4
misc.c: Null buffer passed to cifs_small_buf_release
smb2pdu.c: mode 0x1
smb2pdu.c: negotiated smb3.02 dialect
asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0xbb92
asn1.c: OID len = 7 oid = 0x1 0x2 0x348 0x1bb92
asn1.c: OID len = 8 oid = 0x1 0x2 0x348 0x1bb92
asn1.c: OID len = 10 oid = 0x1 0x3 0x6 0x1
connect.c: Security Mode: 0x1 Capabilities: 0x300067 TimeAdjust: 0
smb2pdu.c: Session Setup
smb2pdu.c: sess setup type 5
cifs_spnego.c: key description = ver=0x2;host=file.mydomain.local;ip4=10.211.55.28;sec=krb5;uid=0x0;creduid=0x3e8;user=jdoe;pid=0x289a
CIFS VFS: Send error in SessSetup = -126
connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 183) rc = -126
fscache.c: cifs_fscache_release_client_cookie: (0x00000000dabd1b06/0x00000000d1987345)
connect.c: CIFS VFS: leaving cifs_mount (xid = 182) rc = -126
是的,keyutils 已安装。同时,我们发现“mount”需要keytab文件中的对应条目指向kerberos。