如何手动指定 ssh -K 的令牌 (tgt)?

如何手动指定 ssh -K 的令牌 (tgt)?

据我了解,发行ssh -K somehost将使用 kerberos 令牌进行身份验证somehost。是否可以指定使用哪个文件作为令牌?

请注意,我的计算机上未正确设置 Kerberos,但我仅从正确设置了 Kerberos 的计算机复制了 TGT。

更具体地说,我将令牌复制到/tmp/krb5cc_1000(其中 1000 是我的 uid),以便klist按如下方式识别令牌:

➜  ~ klist
Ticket cache: FILE:/tmp/krb5cc_1000
Default principal: [email protected]

Valid starting       Expires              Service principal  
XXXX  
XXXX

我想这样做,因为我目前需要ssh从我的笔记本电脑 (L) 到网关服务器 (G),我可以在其中发出令牌,然后 ssh 到最终服务器 (S)。鉴于令牌可能在较长时间内有效,并且透明的 ssh 转发将简化我的开发设置,我的目标是设置 ssh ProxyCommand。但是,ssh ProxyCommand 要求所有密钥/令牌都存在于本地计算机 (L) 上。

目前我正在使用 ProxyCommand,如下所示:

ProxyCommand ssh gateway nc %h %p

这使我能够建立与 (S) 的连接,但身份验证未完成:

OpenSSH_7.3p1-hpn14v11, OpenSSL 1.0.2k  26 Jan 2017
debug1: Reading configuration data /home/user/.ssh/config
debug1: /home/user/.ssh/config line 1: Applying options for *
debug1: /home/user/.ssh/config line 10: Applying options for S
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec ssh GW nc S -p 22
debug1: permanently_drop_suid: 1000
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3p1-hpn14v11
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Remote is NON-HPN aware
debug1: Authenticating to S:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: AUTH STATE IS 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: REQUESTED ENC.NAME is '[email protected]'
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: REQUESTED ENC.NAME is '[email protected]'
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

GSSAPIAuthentication yes据我所知,我已尝试设置应强制通过 kerberos 进行身份验证。

答案1

是否可以指定使用哪个文件作为令牌?

否。SSH 使用的票证与 GSSAPI 可见且可访问的票证相同klist

从正确设置 Kerberos 的计算机复制 TGT。

我不认为事情是这样的。从头开始并正确设置 kerberos。

这使我能够建立与 (S) 的连接,但身份验证未完成:

根据此日志,身份验证甚至没有开始。它挂在密钥交换上,这完全是另一个问题(除非您会进行 gssapi 密钥交换,但您不会这样做)。

相关内容