Hi everyone, This request is a small enhancement to the feature introduced in https://bugzilla.mindrot.org/show_bug.cgi?id=1699 to include the name or path of/to the ssh key. Currently if a key is added automatically by having the option AddKeysToAgent enabled the name/path to the key is not included. This contrasts with keys added manually via ssh-add which include this information. So when using "ssh-add -l" the following is seen: 2048 SHA256:aF4h47lpohn7aXTMtlWFMfEXWtT7zN1CMh2M/NGXgTM (RSA) 2048 SHA256:ihNn8ml5z5rLXULYnXibgBSSZ7PiHVXzgCQywXqGi6I .ssh/test (RSA) The first line was added automatically by use of AddKeysToAgent. The second was added by calling "ssh-add .ssh/test". The missing information could come from the "IdentityFile" in ssh_config or the "-i" parameter if specified in the command line. Having the name of the key is useful to know which keys are currently loaded on the agent. Thanks, Renato
Created attachment 2885 [details] probable fix Could you please try this patch?
Hi Damien, The patch doesn't seem to affect anything. I get exactly the same output as before in both situations.
Created attachment 2894 [details] AddKeysToAgent: Use filename when comment is empty I took a look at this bug by chance and I think I found the 'issue': ssh-add has a check verifying if the 'comment' of the key is NULL or contains only '\0' and replace it with the filename in that case (see https://github.com/openssh/openssh-portable/blob/master/ssh-add.c#L261-L262, seems to have been added in https://github.com/openssh/openssh-portable/commit/2681cdb6e0de7c1af549dac37a9531af202b4434) The attached patch simply duplicate that behaviour (looking at sshkey_parse_private_fileblob_type, RSA key always have a 'NULL' comment). It seems to fix the issue for me, can you confirm?
(In reply to Vincent Brillault from comment #3) > Created attachment 2894 [details] You have a small typo (dupplicate) in the commit message, otherwise the patch works great and fixes the issue. Can we get it reviewed and merged? Thanks, Renato
A similar fix has been committed and will be in OpenSSH 8.2
closing resolved bugs as of 8.6p1 release