Bug 856876 - Caught unexpected error messages when adding an sshkey with private key
Summary: Caught unexpected error messages when adding an sshkey with private key
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Hiro Asari
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-13 02:52 UTC by Jianwei Hou
Modified: 2015-05-15 02:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-10 02:50:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jianwei Hou 2012-09-13 02:52:36 UTC
Description of problem:
Try to add an sshkey with a private key, unexpected messages are returned.

Version-Release number of selected component (if applicable):
rhc-0.99.1

How reproducible:
Always

Steps to Reproduce:
1. Generate a pair of sshkeys with ssh-keygen
   ssh-keygen -f newkey1
2. try to add an sshkey with a private key
   rhc sshkey add invalid newkey1
  
Actual results:
[openshift@fc17 .ssh]$ rhc sshkey add invalid newkey1
/usr/local/share/gems/gems/net-ssh-2.5.2/lib/net/ssh/key_factory.rb:101:in `load_data_public_key': not a public key "" (OpenSSL::PKey::PKeyError)
	from /usr/local/share/gems/gems/rhc-0.99.1/lib/rhc/commands/sshkey.rb:59:in `add'
	from /usr/local/share/gems/gems/rhc-0.99.1/lib/rhc/commands.rb:103:in `block (3 levels) in to_commander'
	from /usr/local/share/gems/gems/commander-4.1.2/lib/commander/command.rb:180:in `call'
	from /usr/local/share/gems/gems/commander-4.1.2/lib/commander/command.rb:180:in `call'
	from /usr/local/share/gems/gems/commander-4.1.2/lib/commander/command.rb:155:in `run'
	from /usr/local/share/gems/gems/commander-4.1.2/lib/commander/runner.rb:402:in `run_active_command'
	from /usr/local/share/gems/gems/rhc-0.99.1/lib/rhc/command_runner.rb:30:in `run!'
	from /usr/local/share/gems/gems/commander-4.1.2/lib/commander/delegates.rb:11:in `run!'
	from /usr/local/share/gems/gems/rhc-0.99.1/lib/rhc/cli.rb:40:in `start'
	from /usr/local/share/gems/gems/rhc-0.99.1/bin/rhc:62:in `<top (required)>'
	from /usr/local/bin/rhc:23:in `load'
	from /usr/local/bin/rhc:23:in `<main>'


Expected results:
Should return message showing this key type is invalid instead of massive backtrace

Additional info:
There is no such problem with previous rhc client version rhc-0.98.14

Comment 1 Hiro Asari 2012-09-13 14:56:36 UTC
Previously, I do not believe we verified the data before uploading to the server. Now we do, and we did not all the exceptions that can be throwing while doing so.

Will fix it shortly.

Comment 2 Hiro Asari 2012-09-13 15:32:31 UTC
https://github.com/openshift/rhc/pull/163

Comment 3 Jianwei Hou 2012-09-21 02:08:09 UTC
Fix is merged in. Move it to ON_QA to verify this bug with latest client.

Comment 4 Jianwei Hou 2012-09-21 02:10:55 UTC
Verified with rhc-0.99.2

Steps:
1. Generate a pair of sshkeys with ssh-keygen
   ssh-keygen -f newkey1
2. try to add an sshkey with a private key
   rhc sshkey add invalid newkey1

Result:
Reasonable message is displayed:

hjw@my .ssh$ rhc sshkey add invalid newkey1
File 'newkey1' contains invalid data

Comment 5 Hiro Asari 2012-10-01 19:40:51 UTC
https://github.com/J5/rhc/pull/17

Note that this is a contrived use case where we had not tested previously.

Comment 6 Hiro Asari 2012-10-10 02:50:29 UTC
J5 and I came to the conclusion that we should not cater to this highly unlikely scenario.


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