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 1868971 - Receptor installation job doesn't properly escape data it puts into receptor.conf
Summary: Receptor installation job doesn't properly escape data it puts into receptor....
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: RH Cloud - Cloud Connector
Version: 6.7.0
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: 6.8.0
Assignee: Adam Ruzicka
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
: 1868969 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-14 17:45 UTC by Jessica Hanley
Modified: 2023-12-15 18:51 UTC (History)
3 users (show)

Fixed In Version: ansiblerole-satellite-receptor-installer-0.6.13
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 13:05:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github project-receptor satellite-receptor-installer pull 23 0 None closed BZ #1868971 - Escape passwords containing a percent sign 2020-10-27 16:18:57 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 13:08:33 UTC

Description Jessica Hanley 2020-08-14 17:45:26 UTC
Description of problem:

When there is an issue with the password listed in file "/etc/receptor/rh_656223/receptor.conf", the output of "systemctl status receptor@rh_656223" shows the password in plain text.


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

Satellite 6.7


How reproducible:

always


Steps to Reproduce:
1.  install the cloud connector using our documentation here:  https://access.redhat.com/documentation/en-us/red_hat_insights/2020-04/html-single/remediating_issues_across_your_red_hat_satellite_infrastructure_using_red_hat_insights/index#configuring-cloud-connector-on-satellite-server_remediating-satellite
2.  If the password in file "/etc/receptor/rh_656223/receptor.conf" contains a percent sign character, attempting to start the receptor service will result in a status of "failed".  Running the command "systemctl status receptor@rh_656223" shows the password in plain text.

Actual results:

Failure message in the output of "systemctl status receptor@rh_656223" (where "MYPASSWORD" is the customer's password):

'%' must be followed by '%' or '(', found: MYPASSWORD


Expected results:

The password should not be printed in plain text in system error messages.

Comment 1 Adam Ruzicka 2020-08-17 07:23:58 UTC
*** Bug 1868969 has been marked as a duplicate of this bug. ***

Comment 2 Adam Ruzicka 2020-08-25 12:26:46 UTC
Merged and released in upstream, moving to modified

Comment 3 Lukáš Hellebrandt 2020-09-16 15:20:33 UTC
FailedQA with Sat 6.8 snap 14.

# grep password /etc/receptor/rh_<ID>/receptor.conf 
password=change%me
# systemctl status 'receptor@*' | grep followed
Sep 16 17:14:19 <FQDN>[31952]: '%' must be followed by '%' or '(', found: '%me'

=> Part of the password after '%' is still shown in log.

Note that:
# grep username /usr/share/ansible/roles/project-receptor.satellite_receptor_installer/templates/receptor.conf.j2
username={{ satellite_user | regex_replace('%', '%%') }}

Comment 4 Adam Ruzicka 2020-09-17 06:08:08 UTC
The installer playbook should escape all the percent signs. How did you manage to get a single percent sign in that config file?

Comment 5 Lukáš Hellebrandt 2020-09-17 08:32:56 UTC
I just edited the config file... because why not? I suppose that's what a user would do when e.g. password changed.

Comment 6 Adam Ruzicka 2020-09-17 08:43:19 UTC
We take the credentials from the user and render the config file. Receptor parses the config file (receptor itself, not our plugin) and if it contains something with a percent sign, it fails because it cannot parse the file. When doing so, it logs the offending value. Since we cannot control the parsing, we must solve it from the other side. We can escape the values before rendering the file and thus making sure the file can be parsed by receptor.

If the users change the config by hand, then they have to respect the specifics of the config file format.

Comment 7 Lukáš Hellebrandt 2020-09-17 09:20:05 UTC
After conversation with Adam, I think this BZ needs to be rewritten. The bug is that the installation job doesn't properly escape contents of the configuration file.

The fact that the password is shown in the log is caused by Receptor (not Satellite) being unable to parse the input and showing the offending data - which incidentally contains password.

=> Changing this BZ to track the config file generation. If the user changes the config file manually and Receptor can't parse it, it's not an issue in the Satellie or the installation job.

Do you agree, Adam?

Comment 8 Adam Ruzicka 2020-09-17 09:47:46 UTC
Yes, that is correct.

Comment 9 Lukáš Hellebrandt 2020-09-17 10:08:55 UTC
Verified with Sat 6.8 snap 14.

The password (and other data) is now correctly escaped (% => %%) in the receptor installation playbook, leading to a correct receptor.conf format.

Comment 12 errata-xmlrpc 2020-10-27 13:05:24 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 (Important: Satellite 6.8 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-2020:4366

Comment 13 errata-xmlrpc 2020-10-27 13:08:30 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 (Important: Satellite 6.8 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-2020:4366


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