Finding a resident key stored in an agent without a corresponding file?

Lars Noodén lars.nooden at gmx.com
Mon Mar 22 22:34:54 AEDT 2021


On 3/22/21 1:09 PM, Aaron Jones wrote:
> On 22/03/2021 09:58, Jochen Bern wrote:
>> Umh, *does* every privKey that ssh "offers" (as the debug output calls
>> it) qualify as an actual authentication attempt, and thus count against
>> MaxAuthTries?
>
> Yes, in my experience it does, and with a large keyring collection in
> the agent, or with a lot of keys located at default paths, a server with
> a low MaxAuthTries limit will boot me out, before I can even attempt
> auth, unless I specify an explicit IdentityFile= and also specify
> IdentitiesOnly=yes (so that it doesn't try any others, even those
> located at default paths).

Below is how it looks from the client if there are seven keys in the
agent and the server is set for MaxAuthTries of 6 and the seventh key is
the one that is needed.  For this example, there are no keys in ~/.ssh/
on the client, the extra keys were loaded from another location and the
resident key was loaded into the agent directly from the hardware token.

/Lars

OpenSSH_8.5, LibreSSL 3.3.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xx.yy.zz.1 [xx.yy.zz.1] port 22.
debug1: Connection established.
debug1: identity file /home/foo/.ssh/id_rsa type -1
debug1: identity file /home/foo/.ssh/id_rsa-cert type -1
debug1: identity file /home/foo/.ssh/id_dsa type -1
debug1: identity file /home/foo/.ssh/id_dsa-cert type -1
debug1: identity file /home/foo/.ssh/id_ecdsa type -1
debug1: identity file /home/foo/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/foo/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/foo/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/foo/.ssh/id_ed25519 type -1
debug1: identity file /home/foo/.ssh/id_ed25519-cert type -1
debug1: identity file /home/foo/.ssh/id_ed25519_sk type -1
debug1: identity file /home/foo/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/foo/.ssh/id_xmss type -1
debug1: identity file /home/foo/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.5
debug1: compat_banner: match: OpenSSH_8.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to xx.yy.zz.1:22 as 'foo'
debug1: load_hostkeys: fopen /home/foo/.ssh/known_hosts2: No such file
or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or
directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305 at openssh.com MAC:
<implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305 at openssh.com MAC:
<implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ecdsa-sha2-nistp256
SHA256:t9pNvmtPBL1aF1KSwCWPhKDvHWjuc+JRADd+Lwo6a8I
debug1: load_hostkeys: fopen /home/foo/.ssh/known_hosts2: No such file
or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or
directory
debug1: Host 'xx.yy.zz.1' is known and matches the ECDSA host key.
debug1: Found key in /home/foo/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:3bv7t8Enatq/FlViX7TMjfzn8E4mnmrB4iVLqeftSSo agent
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:uZYDGVKzk/Casnz3epqqLS0uEEvn6vpvg+6/J6YjD/I agent
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:viucCIEHXF2nE3k0GvB1acIasHFCoFEBvgLuCgDEJ7s agent
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:vIb1cYSHBXMp5BEe2Kr8go+k/DQf9JcXCCwLpV70E5c agent
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:ZTmrbytuzGBE/GK8YBkj41AkS9JacZxoyuFZWwpF5Zg agent
debug1: Will attempt key: foo at notebook.localnet.lan ECDSA
SHA256:ORYKRU3jyGhkk6zfu84Pew0cBLb+K4DLHNZvjeflxOk agent
debug1: Will attempt key:  ED25519-SK
SHA256:pTouVKi3dKmAINwkY04Be3YKnIpUF/FoIIM0VxPTBJg authenticator agent
debug1: Will attempt key: /home/foo/.ssh/id_rsa
debug1: Will attempt key: /home/foo/.ssh/id_dsa
debug1: Will attempt key: /home/foo/.ssh/id_ecdsa
debug1: Will attempt key: /home/foo/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/foo/.ssh/id_ed25519
debug1: Will attempt key: /home/foo/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/foo/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info:
server-sig-algs=<ssh-ed25519,sk-ssh-ed25519 at openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256 at openssh.com,webauthn-sk-ecdsa-sha2-nistp256 at openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:3bv7t8Enatq/FlViX7TMjfzn8E4mnmrB4iVLqeftSSo agent
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:uZYDGVKzk/Casnz3epqqLS0uEEvn6vpvg+6/J6YjD/I agent
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:viucCIEHXF2nE3k0GvB1acIasHFCoFEBvgLuCgDEJ7s agent
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:vIb1cYSHBXMp5BEe2Kr8go+k/DQf9JcXCCwLpV70E5c agent
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:ZTmrbytuzGBE/GK8YBkj41AkS9JacZxoyuFZWwpF5Zg agent
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: foo at notebook.localnet.lan ECDSA
SHA256:ORYKRU3jyGhkk6zfu84Pew0cBLb+K4DLHNZvjeflxOk agent
Received disconnect from xx.yy.zz.1 port 22:2: Too many authentication
failures
Disconnected from xx.yy.zz.1 port 22


More information about the openssh-unix-dev mailing list