Bug 843365 - Keys with the same content can be added in command line interface
Keys with the same content can be added in command line interface
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
2.x
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Clayton Coleman
libra bugs
: Reopened, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-26 03:01 EDT by Wei Sun
Modified: 2015-05-14 22:01 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-11-06 13:50:17 EST
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 Wei Sun 2012-07-26 03:01:25 EDT
Description of problem:
Keys with different names but the same content can be added in command line interface now.

Version-Release number of selected component (if applicable):
dev_1912
rhc-0.96.3-1.el6_3.noarch

How reproducible:

always
Steps to Reproduce:
1.Add a new ssh key
rhc sshkey add -i test1 -k ~/.ssh/id_rsa.pub
2.rhc sshkey list

SSH keys
========
       Name: key1
       Type: ssh-rsa
Fingerprint: 93:a8:15:e1:23:df:75:7b:5a:11:cf:fa:f3:d1:da:9f

       Name: test1
       Type: ssh-rsa
Fingerprint: a5:e3:20:13:e4:8f:39:83:b1:f4:3d:72:0c:87:b6:1c

3.Adding another key with different key name but the same content
 rhc sshkey add -i test2 -k ~/.ssh/id_rsa.pub
  
Actual results:
Keys with the same content can be added .

[wsun@localhost ~]$ rhc sshkey list
Password: 


SSH keys
========
       Name: test2
       Type: ssh-rsa
Fingerprint: a5:e3:20:13:e4:8f:39:83:b1:f4:3d:72:0c:87:b6:1c

       Name: test1
       Type: ssh-rsa
Fingerprint: a5:e3:20:13:e4:8f:39:83:b1:f4:3d:72:0c:87:b6:1c

       Name: key1
       Type: ssh-rsa
Fingerprint: 93:a8:15:e1:23:df:75:7b:5a:11:cf:fa:f3:d1:da:9f


Expected results:
Keys with the same content should not be added.

Additional info:
Comment 1 Rob Millner 2012-07-26 14:11:26 EDT
Is this really a bug?  If the end-user has duplicated their own keys under different names there's probably an organizational reason why and I'm not sure we should prevent it.
Comment 2 Clayton Coleman 2012-08-13 17:51:18 EDT
This is old api vs new api.  I agree with Rob in principle though that allowing duplicate keys doesn't really hurt us.  When we switch to new api this bug will go away.
Comment 3 John (J5) Palmieri 2012-10-09 12:37:57 EDT
Closing to clean up queue.  This doesn't look like a bug.
Comment 4 Xiaoli Tian 2012-10-09 22:24:48 EDT
The bug may be fixed during the rhc refactor, now we could not add the same content twice now.
Comment 5 Xiaoli Tian 2012-10-09 22:26:28 EDT
Move it to ON_QA for verifying on fork_ami_US2597_US2599_US2813_US2817_US2872_US2816_US2814_213
Comment 6 Wei Sun 2012-10-09 22:32:49 EDT
verified on devenv_2304,and client build from fork_ami_US2597_US2599_US2813_US2817_US2872_US2816_US2814_213

Step:
1.Add a new ssh key
 rhc sshkey add test1 ~/.ssh/id_rsa.pub 

[sunwei@dhcp-8-229 ~]$ rhc sshkey add test1 ~/.ssh/id_rsa.pub 
Password: ******


RESULT:
SSH key /home/sunwei/.ssh/id_rsa.pub has been added as 'test1'

2.rhc sshkey list

[sunwei@dhcp-8-229 ~]$ rhc sshkey list -p redhat

RESULT:
       Name: test1
       Type: ssh-rsa
Fingerprint: 75:d6:c7:d5:7c:ec:07:ab:16:08:7a:6b:48:3b:d2:fe


3.Adding another key with different key name but the same content

[sunwei@dhcp-8-229 ~]$ rhc sshkey add test2 ~/.ssh/id_rsa.pub 
Password: ******

Given public key is already in use. Use different key or delete conflicting key and retry.

4.rhc sshkey list

[sunwei@dhcp-8-229 ~]$ rhc sshkey list -p redhat

RESULT:
       Name: test1
       Type: ssh-rsa
Fingerprint: 75:d6:c7:d5:7c:ec:07:ab:16:08:7a:6b:48:3b:d2:fe

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