Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1399249

Summary: [RFE] sos obfuscates full database connection url for openstack components
Product: Red Hat Enterprise Linux 7 Reporter: Vagner Farias <vfarias>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: agk, apevec, bmr, gavin, lhh, lyarwood, mhradile, plambri, sbradley, srevivo, vfarias
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 7.4   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-06 08:00:16 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: 1473612    

Description Vagner Farias 2016-11-28 16:13:02 UTC
Description of problem:
sos reports don't include database connection url for openstack components because this information is obfuscated. Probably this was a side effect of obfuscating the password, which is part of the url.

$ grep '^connection\s*=' etc/{nova,glance,cinder,neutron}/*.conf
etc/nova/nova.conf:connection = *********
etc/glance/glance-api.conf:connection = *********
etc/glance/glance-registry.conf:connection = *********
etc/cinder/cinder.conf:connection = *********
etc/neutron/neutron.conf:connection = *********


Version-Release number of selected component (if applicable):
sos-3.2-36.el7ost.2.noarch

How reproducible:
Always.

Steps to Reproduce:
1. Run sosreport on an openstack controller node
2. Open the tarfile and cd into the directory
2. grep '^connection\s*=' etc/{nova,glance,cinder,neutron}/*.conf

Actual results:
$ grep '^connection\s*=' etc/{nova,glance,cinder,neutron}/*.conf
etc/nova/nova.conf:connection = *********
etc/glance/glance-api.conf:connection = *********
etc/glance/glance-registry.conf:connection = *********
etc/cinder/cinder.conf:connection = *********
etc/neutron/neutron.conf:connection = *********

Expected results:
Database server login, address and database should be shown, like in the example below. 

$ grep '^connection\s*=' etc/{nova,glance,cinder,neutron}/*.conf
etc/nova/nova.conf:connection = mysql://nova:********@mariadb-server/nova
etc/glance/glance-api.conf:connection = mysql://glance:********@mariadb-server/glance
etc/glance/glance-registry.conf:connection = mysql://glance:********@mariadb-server/glance
etc/cinder/cinder.conf:connection = mysql://cinder:********@mariadb-server/cinder
etc/neutron/neutron.conf:connection = mysql://neutron:********@mariadb-server/neutron

Comment 4 Pavel Moravec 2018-03-03 17:02:18 UTC
Lee or Vagner,
could you please provide valid examples of the URL with passwords syntax (that is obfuscated now), such that we can come up with better regexp?

Comment 5 Vagner Farias 2018-03-06 20:59:20 UTC
The following is from OSP 11.

[root@controller ~]# grep '^connection\s*=' /etc/{nova,glance,cinder,neutron}/*.conf
/etc/nova/nova.conf:connection=mysql+pymysql://nova_api:tYscXjtg6FC4u8rDxDPnXAkkp.0.21/nova_api?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
/etc/nova/nova.conf:connection=mysql+pymysql://nova:tYscXjtg6FC4u8rDxDPnXAkkp.0.21/nova?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
/etc/nova/nova.conf:connection=mysql+pymysql://nova_placement:tYscXjtg6FC4u8rDxDPnXAkkp.0.21/nova_placement?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
/etc/glance/glance-api.conf:connection = mysql+pymysql://glance:BpjdGYndqYFEXcAfzaqTFEUC6.0.21/glance?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
/etc/cinder/cinder.conf:connection = mysql+pymysql://cinder:hMeRV32kUMCuHPQzHEg3dD9Vt.0.21/cinder?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
/etc/neutron/neutron.conf:connection=mysql+pymysql://neutron:tY9hAuBeEGH7k7A2KkzKWhnhx.0.21/ovs_neutron?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo

I'm sure that earlier versions had a slightly different syntax, as you may see in comment #0 (expected results).

Some differences I can see:

connection=mysql  x   connection=mysql+pymsql

The end of the line also changed. Now it has a "?" and some additional information.

I'm not a regexp expert, but I think the standard is more or less:

connection=[protocol]://[login_name]:[password]@[hostname_or_IP]/[service_name]

I can't tell if passwords may have ":" or "@" characters.

Comment 6 Pavel Moravec 2018-03-08 20:47:31 UTC
Thanks. I created PR 

https://github.com/sosreport/sos/pull/1246

that would be great to test (for potential copy&paste or forgotten-character errors).

Comment 7 Vagner Farias 2018-03-09 14:46:46 UTC
I may test, at least in OSP 11, when a RPM package is made available.

Comment 13 Pavel Moravec 2018-04-11 06:53:23 UTC
devel_ack+ for 7.6

Comment 15 Pavel Moravec 2018-11-06 08:00:16 UTC
This should have been fixed in RHEL7.6 due to previous updates done in sos 3.6 we rebased to in 7.6. Hence closing the BZ as fixed in current release:

package: sos-3.6-11

7.6.0 errata: https://access.redhat.com/errata/RHEA-2018:3144
7.6.0-day errata: https://access.redhat.com/errata/RHBA-2018:3338

(either one contains the fix)