Bug 1468541

Summary: Satellite is not allowing recreation of SSH-key in Users
Product: Red Hat Satellite Reporter: Jitendra Yejare <jyejare>
Component: Users & RolesAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, dhlavacd, ehelms, jyejare, mhulan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.15.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:03:51 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:
Bug Depends On:    
Bug Blocks: 1493109    
Attachments:
Description Flags
Screenshot Attached none

Description Jitendra Yejare 2017-07-07 11:20:10 UTC
Created attachment 1295261 [details]
Screenshot Attached

Description of problem:
Satellite is not allowing the recreation of SSH key after deleting that SSH key once from satellite.
It throws an error notification of 'Fingerprint has already been taken'.

Version-Release number of selected component (if applicable):
Satellite 6.3.0 Snap 5

How reproducible:
Always

Steps to Reproduce:
1. Create SSH key in any users(i tried in Admin) template
2. Delete that SSH key from users template.
3. Attempt to add same SSH key is same user template.

Actual results:
1. Satellite UI throws error notification - Fingerprint has already been taken.
2. SSH key is not added to user template.

Expected results:
Recreation/Re-Addition of SSH key in user template should be successful for any number of times. Error notification should not be displayed for recreation of SSH key.

Additional info:

Comment 3 Jitendra Yejare 2017-07-11 10:20:52 UTC
Hi Marek,

One update is that, I am facing this issue only for Super Admin user.

Production logs:
2017-07-11 06:15:37 57a92fe1 [app] [I] Started GET "/users/3-admin/ssh_keys/new" for 10.65.223.122 at 2017-07-11 06:15:37 -0400
2017-07-11 06:15:37 57a92fe1 [app] [I] Processing by SshKeysController#new as HTML
2017-07-11 06:15:37 57a92fe1 [app] [I]   Parameters: {"user_id"=>"3-admin"}
2017-07-11 06:15:37 57a92fe1 [app] [I] Current user: admin (administrator)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered ssh_keys/_form.html.erb (4.7ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered ssh_keys/new.html.erb within layouts/application (7.5ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered layouts/_application_content.html.erb (0.3ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered home/_submenu.html.erb (2.0ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered home/_user_dropdown.html.erb (1.5ms)
2017-07-11 06:15:37 57a92fe1 [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered home/_topbar.html.erb (5.0ms)
2017-07-11 06:15:37 57a92fe1 [app] [I]   Rendered layouts/base.html.erb (6.9ms)
2017-07-11 06:15:37 57a92fe1 [app] [I] Completed 200 OK in 32ms (Views: 20.6ms | ActiveRecord: 3.3ms)
2017-07-11 06:15:37 3c613444 [app] [I] Started GET "/users/3-admin/ssh_keys/new" for 10.65.223.122 at 2017-07-11 06:15:37 -0400
2017-07-11 06:15:37 3c613444 [app] [I] Processing by SshKeysController#new as HTML
2017-07-11 06:15:37 3c613444 [app] [I]   Parameters: {"user_id"=>"3-admin"}
2017-07-11 06:15:37 3c613444 [app] [I] Current user: admin (administrator)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered ssh_keys/_form.html.erb (3.2ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered ssh_keys/new.html.erb within layouts/application (6.1ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered layouts/_application_content.html.erb (0.3ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered home/_submenu.html.erb (2.0ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered home/_user_dropdown.html.erb (1.5ms)
2017-07-11 06:15:37 3c613444 [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered home/_topbar.html.erb (4.8ms)
2017-07-11 06:15:37 3c613444 [app] [I]   Rendered layouts/base.html.erb (6.8ms)
2017-07-11 06:15:37 3c613444 [app] [I] Completed 200 OK in 25ms (Views: 14.7ms | ActiveRecord: 2.8ms)
2017-07-11 06:15:38 2d7dd4b5 [app] [I] Started GET "/notification_recipients" for 10.65.223.122 at 2017-07-11 06:15:38 -0400
2017-07-11 06:15:38 2d7dd4b5 [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-07-11 06:15:38 2d7dd4b5 [app] [I] Current user: admin (administrator)
2017-07-11 06:15:38 2d7dd4b5 [app] [I] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.7ms)
2017-07-11 06:15:41 70f68e46 [app] [I] Started POST "/users/3-admin/ssh_keys" for 10.65.223.122 at 2017-07-11 06:15:41 -0400
2017-07-11 06:15:41 70f68e46 [app] [I] Processing by SshKeysController#create as HTML
2017-07-11 06:15:41 70f68e46 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"kofFJNQ0NX8ihQIIAA4ipij1DJ+NQwfhurTmwILpTfNXej8zVexu5tYnRMfYMz9hsDAprh1rUlqp/rzN0K31jA==", "ssh_key"=>{"key"=>"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXb0vgvmYwAeZ1SMMGBHK/+Mv0gx17URhnU26FBwb3PqDr1+KVzrs1lkeFWFVqSEQmWSANfb9QgEJ5xXUwuB0CjgURdpYQTj98C7wTwDcUw5lMxDaMYb1VES8hhG2ORDk1H1mb5pNNby5ghYEORkI43VOzOu6SsZpPuWkxJbhj7pRo++xiMCDsfnsktOXyeWoes0Ig1dLj2mlZe3HP5BtPhJLwrzO1bd3POSsJFuEwALUF0mWQ6TEqzA8vqID/dcjpzMnaiFl6IOswjrLboF1SMhk4/2qLFYMDkSHYjGQC0GvxuSA7Vvsk1J19UG9Hs5HAyGzHImNEw9ptzzOQcKut root.lab.eng.bos.redhat.com", "name"=>"root.lab.eng.bos.redhat.com"}, "commit"=>"Submit", "user_id"=>"3-admin"}
2017-07-11 06:15:41 70f68e46 [app] [I] Current user: admin (administrator)
2017-07-11 06:15:42 70f68e46 [app] [I] Failed to save: Fingerprint has already been taken
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered ssh_keys/_form.html.erb (3.0ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered ssh_keys/new.html.erb within layouts/application (5.0ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered layouts/_application_content.html.erb (0.3ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered home/_submenu.html.erb (1.9ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered home/_user_dropdown.html.erb (1.5ms)
2017-07-11 06:15:42 70f68e46 [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered home/_topbar.html.erb (4.8ms)
2017-07-11 06:15:42 70f68e46 [app] [I]   Rendered layouts/base.html.erb (6.8ms)
2017-07-11 06:15:42 70f68e46 [app] [I] Completed 200 OK in 30ms (Views: 13.2ms | ActiveRecord: 3.7ms)
2017-07-11 06:15:42 5b991f4c [app] [I] Started GET "/notification_recipients" for 10.65.223.122 at 2017-07-11 06:15:42 -0400
2017-07-11 06:15:42 5b991f4c [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-07-11 06:15:42 5b991f4c [app] [I] Current user: admin (administrator)
2017-07-11 06:15:42 5b991f4c [app] [I] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.8ms)
2017-07-11 06:15:53 0bca123e [app] [I] Started GET "/notification_recipients" for 10.65.223.122 at 2017-07-11 06:15:53 -0400
2017-07-11 06:15:53 0bca123e [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-07-11 06:15:53 0bca123e [app] [I] Current user: admin (administrator)
2017-07-11 06:15:53 0bca123e [app] [I] Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.8ms)


Why I consider this as blocker ?
Answer - Because Once the ssh key is deleted from Admin user then there is no another way to add it, neither from CLI and nor from API. 
I know customer can copy paste the SSH key but thats really hectic for customer if he has tomes of host to copy ssh key.

Comment 4 Marek Hulan 2017-07-14 08:57:32 UTC
Created redmine issue http://projects.theforeman.org/issues/20306 from this bug

Comment 5 Satellite Program 2017-07-14 10:11:38 UTC
Upstream bug assigned to mhulan

Comment 6 Satellite Program 2017-07-14 10:11:41 UTC
Upstream bug assigned to mhulan

Comment 7 Satellite Program 2017-07-19 20:11:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20306 has been resolved.

Comment 8 Jitendra Yejare 2017-08-28 11:53:35 UTC
Verified!

Satelite 6.3.0 Snap 13

Steps:
1. Create SSH key in any Admin user
2. Delete that SSH key from Admin user
3. Attempt to add same SSH key Admin user

Actual results:
Satellite is now allowing to recreate the SSH-key

Comment 9 Bryan Kearney 2018-02-21 17:03:51 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336