Bug 2119247 - gpg-agent no longer obeys order of ssh keys in sshcontrol file
Summary: gpg-agent no longer obeys order of ssh keys in sshcontrol file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gnupg2
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-18 04:50 UTC by Christian Heimes
Modified: 2023-08-07 14:21 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-07 14:21:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-573 0 None None None 2022-08-18 04:55:28 UTC

Description Christian Heimes 2022-08-18 04:50:54 UTC
Description of problem:
The update from gnupg2-2.3.4-2.fc36.x86_64 to gnupg2-2.3.7-3.fc36.x86_64 broke my SSH setup with gpg-agent as ssh-agent. I have multiple SSH keys registered with gpg-agent. The preferred key is my GPG key on my YubiKey. The others are backups in local encrypted files. With the update the keys are returned in wrong order. SSH now prefers one of my backup keys.

Version-Release number of selected component (if applicable):
gnupg2-2.3.7-3.fc36.x86_64

How reproducible:
always

Steps to Reproduce:
1. configure gpg-agent to act as ssh-agent provider (add enable-ssh-support to ~/.gnupg/gpg-agent.conf and restart agent)
2. add multiple keys to gpg-agent
3. reorder keys in ~/.gnupg/sshcontrol
4. SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh ssh-add -l

Actual results:
ssh-add -l does not list the keys in the order they are specified in ~/.gnupg/sshcontrol instead they seem to be ordered alphanumerical by keygrip fingerprint.

Expected results:
keys are listed in the order they are configured in ~/.gnupg/sshcontrol

Additional info:
A downgrade to 2.3.4-2 and restart of gpg-agent restores the expected behavior.

Comment 1 Jakub Jelen 2022-09-19 13:12:54 UTC
This looks like a fallout from https://dev.gnupg.org/T5996. It was a significant change and from top of my head I do not see a simple way back so let me report the issue upstream:

https://dev.gnupg.org/T6212

The only suggestion I have for you now would be to use `IdentitiesOnly` option of SSH to properly assign identities to servers and not depend on the agent returning the keys in particular order.

Comment 2 Ben Cotton 2023-04-25 17:47:31 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Christian Heimes 2023-04-27 10:20:15 UTC
I can reproduce the issue on Fedora 37 with gnupg2-2.3.8-1.fc37.

Comment 4 Jakub Jelen 2023-08-07 14:21:33 UTC
This was fixed with  2.4.1 which is in rawhide for some time. Closing as I do not plan to backport this fix unless there will be huge demand.


Note You need to log in before you can comment on or make changes to this bug.