Bug 855186 - SSH key added twice
SSH key added twice
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Jhon Honce
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2012-09-06 19:16 EDT by Krishna Raman
Modified: 2015-05-14 18:59 EDT (History)
5 users (show)

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

Attachments (Terms of Use)

  None (edit)
Description Krishna Raman 2012-09-06 19:16:33 EDT
Description of problem:
I can issue 2 ssh-key add commands to mcollective with the ssh key content and comment and it gets added 2 times to the authorized_keys file.

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

How reproducible:

Steps to Reproduce:
1. Issue mcollecitve call to add an ssh key
2. Issue same mcollective call again
Actual results:
Key added 2 times

Expected results:
Key added once and updated to latest content if it already exists.

Additional info:
Key comment should be used to match up which key to update.
Comment 1 John Poelstra 2012-09-07 14:50:49 EDT
looking into
Comment 2 Jhon Honce 2012-09-10 11:35:56 EDT
Fixed in https://github.com/openshift/crankcase/pull/464
Comment 3 John Poelstra 2012-09-11 13:05:49 EDT
code is written, working on testing, will have a fix or reduce severity by tomorrow
Comment 4 Jhon Honce 2012-09-11 15:35:16 EDT
Patch for fix in https://github.com/openshift/crankcase/pull/470
Comment 5 Xiaoli Tian 2012-09-11 22:12:39 EDT
Above pull request is merged in  devenv_2156
Comment 6 Jianwei Hou 2012-09-13 04:18:07 EDT
Verifed on devenv_2168 in two ways

1. Add an sshkey with the same name, it will fail:
hjw@my .ssh$ rhc sshkey add default newkey1.pub 
Password: ***

SSH key with name default already exists. Use a different name or delete conflicting key and retry.

2. On node, used a script to try to add sshkey with different content and but same comment.
1) create an application, and check the authorized_keys file from node
2) run script, add a content to the existing key, the authorized_keys should be updated with the new content

#! /usr/bin/env ruby

require '/usr/lib/ruby/gems/1.8/gems/stickshift-node-0.16.9/lib/stickshift-node/model/unix_user.rb'
include StickShift

t = UnixUser.new('8e8ff64316404edab3f3f76732096f5c','8e8ff64316404edab3f3f76732096f5c','8e8ff64316404edab3f3f76732096f5c')

puts $?

[root@ip-10-4-226-236 .ssh]# cat authorized_keys 
command="/usr/bin/trap-user",no-X11-forwarding ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqAwFkqSAYFjicIHp28aIHh4Gc8T/VxWnud02/LSlPMZQ98vcPQVQlPPE9wPUhlJ00Nw5V/WaReRC5DlpJFh1b9AMWLnZA5bVaGCnmJYex5Lh72mmoVkAarxxD+Koo13yZuhObBM859dZQfPCFCr732SxtAg0Vd4roFY5r/B7TF+XoNvLc8qAzfQdgGi6JTNXH59x+3wkNGjWjc3r4+S89byZ7dIcCVo8VBrSMKsC4VbRhpZ8IRIpHbAH+/PAy/jdWcfvE+jd7HB9JnT/qqW5A5lRkfCkAtmr/YYZvFbbNhyLiS9zOxLTTEFDgmIJS05lvgHzs/bO5+4D00N1w+Yir1 OPENSHIFT-8e8ff64316404edab3f3f76732096f5cdefault

It was updated successfully.

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