Bug 1612 - ssh-add should not discard constraints if the agent fails to implement them
Summary: ssh-add should not discard constraints if the agent fails to implement them
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-add (show other bugs)
Version: 5.2p1
Hardware: Other Linux
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_4
  Show dependency treegraph
 
Reported: 2009-06-21 09:41 AEST by Daniel Kahn Gillmor
Modified: 2010-03-26 10:51 AEDT (History)
2 users (show)

See Also:


Attachments
ssh-add should not retry key addition without constraints if constraints fail. (588 bytes, patch)
2009-06-21 09:41 AEST, Daniel Kahn Gillmor
no flags Details | Diff
Revised patch (2.00 KB, patch)
2009-08-27 10:24 AEST, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Kahn Gillmor 2009-06-21 09:41:32 AEST
Created attachment 1652 [details]
ssh-add should not retry key addition without constraints if constraints fail.

When ssh-add tries to add a key to the agent with constraints, and the agent rejects the addition, ssh-add appears to retry the addition without constraints.

This is dangerous behavior when the agent does not support certain constraints.  For example, if a user uses an agent (such as the current ssh-agent implementation in gnome-keyring) that does not support confirmation or maximum lifetime, then using:

  ssh-add -t 3600

will print an error message but then proceed to re-add the key withut the constrained lifetime.  this causes the agent to retain the key far past the specified time, an explicit contravention of the user's declared intent.

I expect more conservative behavior from openssh when handling sensitive material.  Discarding the constraint and retrying should be a choice left to the user, not taken automatically by ssh-add.

the attached patch should fix this behavior.
Comment 1 Damien Miller 2009-08-27 10:24:56 AEST
Created attachment 1674 [details]
Revised patch

With your patch, we can garbage collect ssh_add_identity() since nothing calls it anymore.
Comment 2 Damien Miller 2009-08-28 03:45:08 AEST
Patch applied, this will be in openssh-5.4
Comment 3 Damien Miller 2009-10-06 15:02:22 AEDT
Mass move of RESOLVED bugs to CLOSED now that 5.3 is out.
Comment 4 Daniel Kahn Gillmor 2009-10-07 06:55:57 AEDT
Sorry, but the patch doesn't seem to present in the 5.3p1 tarball, and it also does not appear to be applied to the head of CVS (where i'd expect it to be for 5.4, which is not yet out).

I'm probably misunderstanding some piece of the workflow, but this doesn't look resolved to me.
Comment 5 Darren Tucker 2009-10-07 08:18:42 AEDT
It's been committed to OpenBSD but not yet synced to portable (we weren't syncing HEAD while we were working on the 5.3p1 release).  Now that 5.3 is out we'll start pulling the changes in again.

See for example: http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/authfd.c
Comment 6 Darren Tucker 2010-03-26 10:51:09 AEDT
With the release of 5.4p1, this bug is now considered closed.