Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1856758

Summary: foreman-proxy ssh key is copied 3 times to the provisioned machine in /root/.ssh/authorized_keys
Product: Red Hat Satellite Reporter: Ahmed Eladawy <aeladawy>
Component: Provisioning TemplatesAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: arahaman, gsigrisi, kagarwal, kupadhya, matthew.lesieur, mhulan, oddvar.tjugen, smeyer, tbrisker
Target Milestone: 6.9.0Keywords: Patch, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_remote_execution-4.2.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-21 13:15:01 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 Ahmed Eladawy 2020-07-14 11:57:03 UTC
Description of problem:

The foreman-proxy is copied 3 times on the provisioned machine in /root/.ssh/authorized_keys when the remote execution is available.

By previewing the remote_execution_ssh_keys snippet , it shows the foreman-proxy keys of the satellite and the capsule 3 times

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

Red Hat satellite 6.7

How reproducible:

100%

Steps to Reproduce:
1. Provision a new machine.
2. Check file /root/.ssh/authorized_keys
3. Also by previewing remote_execution_ssh_keys snippet.

Actual results:

The ssh key is replicated 3 times

Expected results:

The ssh key has only one entry for the satellite and one for the capsule if existing.

Comment 4 Bryan Kearney 2020-09-08 08:03:12 UTC
Upstream bug assigned to aruzicka

Comment 5 Bryan Kearney 2020-09-08 08:03:14 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30762 has been resolved.

Comment 8 Brad Buckingham 2020-11-20 13:48:50 UTC
*** Bug 1898589 has been marked as a duplicate of this bug. ***

Comment 9 Roman Plevka 2021-02-24 12:05:50 UTC
VERIFIED
on sat6.9.0-14.0

the snippet now works correctly and the provisioned host ends up with a single occurrence of the key in authorized_keys file of root user:

```
[root@abel-frames ~]# cat ~/.ssh/authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCes4pAjGQ62TWSC2E6k0YcxCPV1nWKOfNjBtcVuOIqnC/kQ4Nh3JxAcRbaj9/zn4zWYXyYO4bS9AtvAweHf1C1fuzUopr73Rs822GlaktlA6UdwyGEv9gO2+INvNEyG167kAIa9qxygbqfiDnpjBCTdDE4iIlEkAvIdDv4sFEUOi4zmV5aBTRh0S3/UbtqH5Yescp2mRzpbz7AA4dEpjDu5mnVZXtsv8omhvukPgf9UNol6v4fMPHlPNvL8zZ8CXe51JAWcFzVS2rwKqt6R7nwhb6XEuVkNFNc8VgF52njoFQVUOia/XYcjzJmZI7kib2omcVfTxwIM/zgA38rjtdb foreman-proxy@<redacted>.com
[root@abel-frames ~]#
```

Comment 12 errata-xmlrpc 2021-04-21 13:15:01 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 (Moderate: Satellite 6.9 Release), 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-2021:1313