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 1714921 - x509.Name -> ipapython.dn.DN does not handle multi-valued RDNs
Summary: x509.Name -> ipapython.dn.DN does not handle multi-valued RDNs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa
Version: 7.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: IPA Maintainers
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-29 08:06 UTC by Florence Blanc-Renaud
Modified: 2020-03-31 19:56 UTC (History)
6 users (show)

Fixed In Version: ipa-4.6.6-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:55:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1083 0 None None None 2020-03-31 19:56:18 UTC

Description Florence Blanc-Renaud 2019-05-29 08:06:53 UTC
Cloned from upstream: https://pagure.io/freeipa/issue/7963

### Issue
Converting python-cryptography `Name` with multi-valued RDN to `ipapython.dn.DN` flattens the name into single-valued RDNs.

#### Steps to Reproduce
1. Construct a `Name` with multi-valued RDN.  (Example certificate below)
2. Apply `DN` to the `Name`.
3. Observe that DN structre was flattened.


#### Actual behavior

With certificate:
```
-----BEGIN CERTIFICATE-----
MIIDATCCAemgAwIBAgIFALE9OAwwDQYJKoZIhvcNAQELBQAwQjEeMAkGA1UEBhMC
QVUwEQYDVQQIEwpRdWVlbnNsYW5kMRMwEQYDVQQKEwpBY21lLCBJbmMuMQswCQYD
VQQDEwJDQTAeFw0xOTA1MjgwMjUyMTdaFw0xOTA4MjgwMjUyMTdaMEIxHjAJBgNV
BAYTAkFVMBEGA1UECBMKUXVlZW5zbGFuZDETMBEGA1UEChMKQWNtZSwgSW5jLjEL
MAkGA1UEAxMCQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDQhzXb
385c33IoOKQfsxPbHoTyxjIJ6sTT7Aj0qKMfac4c1chgKK9vp1YXWmPgKHScQz3T
oRQjtmUiDxH+EiSTjQ8HMi8/S15JwJyB0KaFmjv+0W3A5WJbb8HmgnBJN/30pDfn
fxBF6wNb04gAoZG2JqCKOVQJtVZBHGOxUsdibk2WY7FKppwybMLtB1j/euJCRtv1
uMOTso/isRo+saAzw9MWiI5vFDpAZ1acxdb1EMmQOPbWda0WlM8vVqlk0i96Zp0N
2j7n+Ic9AMVosyKfohUEl2iwGwHothRtoPcIX58VRU7QzDfuaYKIv6/dKR6WXlMB
q8mDJcD3fkooFpcXAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAIPFxJp6EHC9sHvl
T4y06zgBfnPg5XFLD+F5JLKJZuQ3eQF7nBH3DzI9kAOpRZmHdEGIMKpj1Kd7qTVF
+WGy7U2Fx5gfWPXjL5VOOe9uPy0gsZAQebuSr1pWAMo/XIQzIK9TZV8/RBnLwZe4
MeK++2JnGYC3FrxEjGm5EyGPDRGIMvccAHIckZUasmr82DcbpvJhWDx+OQE0+bGP
JUZhqVLizhu3dpz+WcBxh0AS4xEKsCl7PmELUFlTNKeahUGPWPwjGD9zPHszVmzq
3Zpmxil9rrtCBnCEYbJY/rsnkwEU4Jckcpe9kvQ1cMCMITK1YMRdPcO1+o7brGqH
IzClrDA=
-----END CERTIFICATE-----
```

Observe the flattening of the structure:
```
>>> cert.subject
<Name([<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.6, name=countryName)>, value='AU')>, <NameAttribute
(oid=<ObjectIdentifier(oid=2.5.4.8, name=stateOrProvinceName)>, value='Queensland')>, <NameAttribute(oid=
<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, value='Acme, Inc.')>, <NameAttribute(oid=<Object
Identifier(oid=2.5.4.3, name=commonName)>, value='CA')>])>                                              
>>> DN(cert.subject)
ipapython.dn.DN('CN=CA,O=Acme\, Inc.,ST=Queensland,C=AU')                                               
```

#### Expected behavior

```
>>> DN(cert.subject)
ipapython.dn.DN('CN=CA,O=Acme\, Inc.,ST=Queensland+C=AU')
#                                                 ^
```

Comment 2 Florence Blanc-Renaud 2019-05-29 08:08:43 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/7963

Comment 3 Florence Blanc-Renaud 2019-05-29 08:10:34 UTC
Fixed upstream:
master:
    https://pagure.io/freeipa/c/891d54e46f9c237493f7985d4d8ea19d4d051d09 dn: handle multi-valued RDNs in Name conversion

ipa-4-6:
    https://pagure.io/freeipa/c/030ec9a82767310cdebe26847741d22e6f5da9bc dn: handle multi-valued RDNs in Name conversion

ipa-4-7:
    https://pagure.io/freeipa/c/b4936d9e17486ec5f849740bd4d431449004537d dn: handle multi-valued RDNs in Name conversion

Comment 4 Florence Blanc-Renaud 2019-06-11 17:52:45 UTC
Fixed upstream
master:
    https://pagure.io/freeipa/c/ad7472970305f7be2d3afc65fda1e86296d118dd dn: sort AVAs when converting from x509.Name

ipa-4-7:
    https://pagure.io/freeipa/c/cc2bbcf6b3a5967324d698b42976f2de4df45375 dn: sort AVAs when converting from x509.Name


ipa-4-6:
    https://pagure.io/freeipa/c/9e3f47103441bb28448c6177a64bbad67e08e2b2 dn: sort AVAs when converting from x509.Name

Comment 7 Mohammad Rizwan 2019-11-06 11:24:39 UTC
version:
ipa-server-4.6.6-9.el7.x86_64

Autmation logs:
[root@master ~]# python2 -m unittest -v ipatests.test_ipapython.test_dn
test_cmp (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_create (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_hashing (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_indexing (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_properties (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_str (ipatests.test_ipapython.test_dn.TestAVA) ... ok
test_assignments (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_cmp (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_concat (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_create (ipatests.test_ipapython.test_dn.TestDN) ... ok

test_eq_multi_rdn (ipatests.test_ipapython.test_dn.TestDN) ... ok                  <<<<<<<<<<<<<<<<<<

test_find (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_hashing (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_indexing (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_iter (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_replace (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_str (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_x500_text (ipatests.test_ipapython.test_dn.TestDN) ... ok
test_escape (ipatests.test_ipapython.test_dn.TestEscapes) ... ok
test_i18n (ipatests.test_ipapython.test_dn.TestInternationalization) ... ok
test_assignments (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_cmp (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_concat (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_create (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_hashing (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_indexing (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_iter (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_properties (ipatests.test_ipapython.test_dn.TestRDN) ... ok
test_str (ipatests.test_ipapython.test_dn.TestRDN) ... ok

----------------------------------------------------------------------
Ran 29 tests in 0.016s

OK

Automation passed. Hence marking the bug as verified.

Comment 10 errata-xmlrpc 2020-03-31 19:55:52 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/RHBA-2020:1083


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