登录->计算节点中的ProxyJump仍然需要密码

登录->计算节点中的ProxyJump仍然需要密码

我想从笔记本电脑 ssh 到 COMPUTE,但必须通过登录,并且 COMPUTE 和登录共享用户(因此没有单独的 ssh 配置)。

这个问题类似于这个例外的是,就我而言,我的服务器是登录/计算设置的。因此,堡垒(登录)和目标(计算节点)上的用户帐户/用户目录是相同的。 LAPTOP 无法直接 ssh 进入 COMPUTE,而必须通过 LOGIN。

LAPTOP --> [LOGIN --> COMPUTE]
|                        ^
+------------ X ---------+

LAPTOP(Windows)上,我有以下 .ssh/config:

Host loginnode
    HostName login.company.org
    User bramvanroy
    IdentityFile ~/.ssh/mycompanykey

Host computenode
    HostName compute.company.org
    User bramvanroy
    IdentityFile ~/.ssh/mycompanykey
    ProxyJump loginnode

在 上LOGIN,有它自己的配置,如下所示:

Host computenode
    HostName compute
    User bramvanroy
    ForwardAgent yes

权限:

  • authorized_keys: 600
  • config: 644

虽然我确实可以在没有密码的情况下从笔记本电脑 ssh 登录 ( ssh loginnode),但当我尝试时ssh computenode,仍然要求我输入密码。

这是为什么?我该如何解决这个问题?

同样,据我所知,我无法在登录/计算之间使用中间 SSH 密钥,因为它们都使用相同的帐户和配置。


输出ssh -vvv computenode(真实姓名/IP地址不同):

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data config
debug1: config line 31: Applying options for computenode
debug3: Failed to open file:ssh_config error:2
debug1: Setting implicit ProxyCommand from ProxyJump: "C:\\Windows\\System32\\OpenSSH\\ssh.exe"  -vvv -W "[%h]:%p" loginnode
debug1: Executing proxy command: exec "C:\\Windows\\System32\\OpenSSH\\ssh.exe"  -vvv -W "[compute.company.org]:22" loginnode
debug3: spawning "C:\\Windows\\System32\\OpenSSH\\ssh.exe"  -vvv -W "[compute.company.org]:22" loginnode
debug3: w32_getpeername ERROR: not sock :2
debug3: Failed to open file:.ssh/loginnode.pub error:2
debug1: identity file loginnode type -1
debug3: Failed to open file:.ssh/loginnode-cert error:2
debug3: Failed to open file:.ssh/loginnode-cert.pub error:2
debug1: identity file loginnode-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data config
debug1: config line 26: Applying options for loginnode
debug3: Failed to open file:ssh_config error:2
debug2: resolving "login.company.org" port 22
debug2: ssh_connect_direct
debug1: Connecting to loginnode REDACTED port 22.
debug1: Connection established.
debug3: Failed to open file:.ssh/loginnode.pub error:2
debug1: identity file loginnode type -1
debug3: Failed to open file:.ssh/loginnode-cert error:2
debug3: Failed to open file:.ssh/loginnode-cert.pub error:2
debug1: identity file loginnode-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to login.company.org:22 as 'bramvanroy'
debug3: hostkeys_foreach: reading file "known_hosts"
debug3: record_hostkey: found key type ECDSA in file known_hosts:6
debug3: load_hostkeys: loaded 1 keys from login.company.org
debug3: Failed to open file:.ssh/known_hosts2 error:2
debug3: Failed to open file:ssh_known_hosts error:2
debug3: Failed to open file:ssh_known_hosts2 error:2
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],diffie-hellman-group-exchange-sha256
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: REDACTED
debug3: hostkeys_foreach: reading file "known_hosts"
debug3: record_hostkey: found key type ECDSA in file known_hosts:6
debug3: load_hostkeys: loaded 1 keys from login.company.org
debug3: Failed to open file:.ssh/known_hosts2 error:2
debug3: Failed to open file:ssh_known_hosts error:2
debug3: Failed to open file:ssh_known_hosts2 error:2
debug3: hostkeys_foreach: reading file "known_hosts"
debug3: record_hostkey: found key type ECDSA in file known_hosts:6
debug3: load_hostkeys: loaded 1 keys from REDACTED
debug3: Failed to open file:.ssh/known_hosts2 error:2
debug3: Failed to open file:ssh_known_hosts error:2
debug3: Failed to open file:ssh_known_hosts2 error:2
debug1: Host 'login.company.org' is known and matches the ECDSA host key.
debug1: Found key in known_hosts:6
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: loginnode  explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: loginnode
debug3: sign_and_send_pubkey: REDACTED
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to login.company.org (REDACTED:22).
debug3: ssh_init_stdio_forwarding: compute.company.org:22
debug1: channel_connect_stdio_fwd compute.company.org:22
debug1: channel 0: new [stdio-forward]
debug2: fd 4 setting O_NONBLOCK
debug2: fd 5 setting O_NONBLOCK
debug3: w32_getsockname ERROR: bad fd: -1
debug3: w32_getpeername ERROR: bad fd: -1
debug3: w32_getpeername ERROR: bad fd: -1
debug1: getpeername failed: Bad file descriptor
debug3: send packet: type 90
debug2: fd 3 setting TCP_NODELAY
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.7
debug1: match: OpenSSH_8.7 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to compute.company.org:22 as 'bramvanroy'
debug3: hostkeys_foreach: reading file "known_hosts"
debug3: record_hostkey: found key type ECDSA in file known_hosts:9
debug3: load_hostkeys: loaded 1 keys from compute.company.org
debug3: Failed to open file:.ssh/known_hosts2 error:2
debug3: Failed to open file:ssh_known_hosts error:2
debug3: Failed to open file:ssh_known_hosts2 error:2
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: ciphers stoc: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: REDACTED
debug3: hostkeys_foreach: reading file "known_hosts"
debug3: record_hostkey: found key type ECDSA in file known_hosts:9
debug3: load_hostkeys: loaded 1 keys from compute.company.org
debug3: Failed to open file:.ssh/known_hosts2 error:2
debug3: Failed to open file:ssh_known_hosts error:2
debug3: Failed to open file:ssh_known_hosts2 error:2
debug1: Host 'compute.company.org' is known and matches the ECDSA host key.
debug1: Found key in known_hosts:9
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: loginnode  explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: loginnode
debug3: sign_and_send_pubkey: REDACTED
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 60
debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory

答案1

从该数据转储中,出现的关键问题是:

debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: loginnode  explicit

它尝试连接回您的 SSH 代理,但套接字似乎不存在。

您确定代理正在运行吗?

答案2

系统管理员让我知道问题是COMPUTE没有use_nfs_home_dirs启用 SELinux 参数。启用后,现在一切都按预期进行。

相关内容