Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ssh-agent certificate not recognized with IdentitiesOnly #494

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexpFr
Copy link

@AlexpFr AlexpFr commented May 1, 2024

The certificate present in the SSH agent is not added to the keys to be tested when 'IdentitiesOnly yes' is configured in the ~/.ssh/config file.

$ cat ~/.ssh/config
Host exemple.org
	IdentityFile ~/.ssh/id_ed25519.pub
	IdentitiesOnly Yes
$ ssh-add -l
256 SHA256:<FINGERPRINT> <COMMENT> (ED25519)
256 SHA256:<FINGERPRINT> <COMMENT> (ED25519-CERT)
$ ls ~/.ssh/
config    id_ed25519.pub

With the same configuration, 'ssh' defaults to looking for a certificate in ~/.ssh/id_ed25519.pub-cert::

$ ssh -vvv user@exemple.org
debug1: identity file ~/.ssh/id_ed25519.pub type 3
debug1: identity file ~/.ssh/id_ed25519.pub-cert type -1

I believe the expected behavior should also include searching for the certificate in the agent.

I have attempted a very simple fix.

The certificate is added from the agent with 'IdentitiesOnly Yes'. The code is redundant, but it works.

Yet another inconsistency: 'ssh-keygen' generates certificates in the form id_ed25519-cert.pub, whereas "ssh" searches for id_ed25519.pub-cert.

@AlexpFr AlexpFr force-pushed the fix/ssh-agent-certificate-identityOnly branch from 6b5283e to e02295a Compare June 23, 2024 22:18
@djmdjm
Copy link
Contributor

djmdjm commented Aug 17, 2024

I believe the expected behavior should also include searching for the certificate in the agent.

Why? Your configuration explicitly requests only a plain key be used:

Host exemple.org
	IdentityFile ~/.ssh/id_ed25519.pub
	IdentitiesOnly Yes

If you want the certificate too then why not specify it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants