Bug 982524

Summary: Show garbage strings when adding invalid public sshkey which with blank key type
Product: OpenShift Online Reporter: Meng Bo <bmeng>
Component: ocAssignee: Clayton Coleman <ccoleman>
Status: CLOSED CANTFIX QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.x   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-09 18:32:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Meng Bo 2013-07-09 08:54:04 UTC
Description of problem:
Modify the public ssh key with removing the key type in the beginning of the id_rsa.pub. Then try to add the invalid key to my account. Some garbage strings will show in the warning message.

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

How reproducible:
always

Steps to Reproduce:
1.Remove the key type in a public ssh key
2.Add the above public key via rhc client
rhc sshkey add key ~/.ssh/invalid_id_rsa.pub
3.

Actual results:
$ rhc sshkey add key1 invalid_id_rsa.pub -d
DEBUG: Using config file /home/bmeng/.openshift/express.conf
DEBUG: #<NotImplementedError: unsupported key type `ZjXh��hq�]�f�'>
File 'invalid_id_rsa.pub' does not appear to be a recognizable key file (unsupported key type `ZjXh��hq�]�f�'). You may specify the '--confirm' flag to add the key
anyway.


Expected results:
Should not show the garbage strings.

Additional info:
See also: https://bugzilla.redhat.com/show_bug.cgi?id=953473
This bug reported the related issue and marked as Won't fix. But the output is more ugly for now.

Comment 1 Clayton Coleman 2013-07-09 18:32:29 UTC
Because of the way that OpenSSL is designed, we have no way of handling this beyond what we do today.  There are many types of keys, and we don't know whether a key will always have a visible type.  So we can't filter out the garbage characters.