Bug 555646

Summary: OpenSSH ignores keys in ~/.ssh/config and offers keys from Seahorse instead
Product: [Fedora] Fedora Reporter: Phillip Smith <fukawi2+fedora>
Component: opensshAssignee: Jan F. Chadima <jchadima>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 12CC: ajschult, fabsh, fukawi2+fedora, jchadima, mgrepl, tmraz, tschweikle
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-03 19:23:22 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Phillip Smith 2010-01-14 23:29:35 EST
Description of problem:
I have 4 SSH keys for various purposes. Seahorse is aware of all of them, however SSH ignores the "IdentityFile" config in ~/.ssh/config and instead uses the keys from Seahorse in alphabetical order. This means I can not login to servers where the MaxAuthAttempts is set to 3 as my 3 attempts expire before getting to the 4th key (which is the one that will let me login).

Version-Release number of selected component (if applicable):
Fedora 12
OpenSSH_5.2p1
OpenSSL 0.9.8l

How reproducible:
Always

Steps to Reproduce:
1. Create 4 SSH keys and add to Seahorse
2. Configure ~/.ssh/config with server details, including an IdentityFile directive
3. Set server to only allow 3 auth attempts
4. Try to login with '-v' flag to ssh. You will see all keys offered in alphabetical order.
  
Actual results:
Can not login to server because key is not chosen from config file and it pulled from Seahorse instead.

Expected results:
IdentityFile directive from ~/.ssh/config is chosen first, then any IdentifyFile directives in /etc/ssh/ssh_config and only then is Seahorse asked for further keys.

Additional info:
~/.ssh/config
=========================================================
Host *
	ControlMaster auto
	ControlPath ~/.ssh/master-%r@%h:%p
	VerifyHostKeyDNS yes

<SNIP OTHER HOSTS>

Host dingo dingo.DOMAIN.nl
	hostname dingo.DOMAIN.nl
	port 5801
	user fukawi2
	IdentityFile ~/.ssh/privatekey_personal.dsa
	DynamicForward localhost:3128
=========================================================

Output from SSH with debug turned on. You can see other keys being offered (marked with a *) before the one configured in IdentityFile above.
=========================================================
phillips@phil-desktop ~  $ ssh dingo -v
OpenSSH_5.2p1, OpenSSL 1.0.0-fips-beta4 10 Nov 2009
debug1: Reading configuration data /home/phillips/.ssh/config
debug1: Applying options for *
debug1: Applying options for dingo
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/phillips/.ssh/master-fukawi2@dingo.DOMAIN.nl:5801" does not exist
debug1: Connecting to dingo.DOMAIN.nl [74.207.xxx.xx] port 5801.
debug1: Connection established.
debug1: identity file /home/phillips/.ssh/privatekey_personal.dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
debug1: match: OpenSSH_5.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: found 2 insecure fingerprints in DNS
debug1: matching host key fingerprint found in DNS
debug1: Host '[dingo.DOMAIN.nl]:5801' is known and matches the RSA host key.
debug1: Found key in /home/phillips/.ssh/known_hosts:108
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
* debug1: Offering public key: fukawi2-archserver
debug1: Authentications that can continue: publickey,password
* debug1: Offering public key: .ssh/privatekey_nwb.dsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/phillips/.ssh/privatekey_personal.dsa
=========================================================
Comment 1 Fabian A. Scherschel 2010-05-18 04:03:27 EDT
I think I ran into this bug or something similar when trying to push to Gitorious. I only have one SSH key which used to work but suddenly git reported the following on a push:

Agent admitted failure to sign using the key. Permission denied (publickey).

Regenerating the key and doing a "ssh-add ~/.ssh/id_rsa" fixed the problem. I think this is related to the follwing gnome-keyring / ssh-agent bug described in Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/201786
Comment 2 Phillip Smith 2010-05-18 05:17:55 EDT
I think that's a different problem. I do not see the error "Agent admitted failure to sign using the key".

Then again, it *could* be the same problem manifesting differently.
Comment 3 Fabian A. Scherschel 2010-05-18 05:32:00 EDT
I was assuming this since Seahorse is involved. I am by no means an expert in all things SSH. I will file a separate bug if that is wanted.
Comment 4 Phillip Smith 2010-05-18 05:43:09 EDT
*shrugs* I'm not sure either -- I'm just saying that I don't get that exact error message.... Someone more knowledgeable than both of us in this area can determine hopefully ;)
Comment 5 Michael Spahn 2010-10-10 14:07:52 EDT
*** Bug 641684 has been marked as a duplicate of this bug. ***
Comment 6 Bug Zapper 2010-11-03 20:56:32 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  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 WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 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 please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Fabian A. Scherschel 2010-11-05 04:19:54 EDT
Are we sure this is fixed in F14? I haven't had any problems so far but I haven't done much uploading to Gitorious lately (which is where this error would mostly surface for me).
Comment 8 Jan F. Chadima 2010-11-08 07:45:14 EST
Did you test to use IdentitiesOnly ssh command? Maybe in some Host.... section?
Comment 9 Fabian A. Scherschel 2010-11-08 08:02:59 EST
How would I go about doing that?
Comment 10 Jan F. Chadima 2010-11-20 07:27:19 EST
man ssh_config
Comment 11 Bug Zapper 2010-12-03 19:23:22 EST
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.