Bug 856876 - Caught unexpected error messages when adding an sshkey with private key
Caught unexpected error messages when adding an sshkey with private key
Status: CLOSED WONTFIX
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Hiro Asari
libra bugs
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-12 22:52 EDT by Jianwei Hou
Modified: 2015-05-14 22:04 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-09 22:50:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jianwei Hou 2012-09-12 22:52:36 EDT
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 10:56:36 EDT
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 11:32:31 EDT
https://github.com/openshift/rhc/pull/163
Comment 3 Jianwei Hou 2012-09-20 22:08:09 EDT
Fix is merged in. Move it to ON_QA to verify this bug with latest client.
Comment 4 Jianwei Hou 2012-09-20 22:10:55 EDT
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 15:40:51 EDT
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-09 22:50:29 EDT
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.