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 1758406 - KRA authentication fails when IPA CA has custom Subject DN
Summary: KRA authentication fails when IPA CA has custom Subject DN
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: Florence Blanc-Renaud
QA Contact: ipa-qe
URL:
Whiteboard:
: 1758995 (view as bug list)
Depends On: 1758404
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-04 04:02 UTC by Fraser Tweedale
Modified: 2023-09-07 20:44 UTC (History)
9 users (show)

Fixed In Version: ipa-4.6.6-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1758404
Environment:
Last Closed: 2020-09-29 19:58:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure freeipa issue 8084 0 None None None 2019-10-04 04:02:09 UTC
Red Hat Product Errata RHSA-2020:3936 0 None None None 2020-09-29 19:59:03 UTC

Description Fraser Tweedale 2019-10-04 04:02:09 UTC
+++ This bug was initially created as a clone of Bug #1758404 +++

Clone of: https://pagure.io/freeipa/issue/8084


Issue

When IPA CA has a custom subject DN (i.e. not CN=Certificate Authority,{subject-base}),
KRA authentication always fails, because the description attribute of the uid=ipakra people entry is not set up correctly.
Steps to Reproduce

1.    Install IPA with custom subject DN, e.g. CN=IPA CA 201910021714,DC=redhat,DC=com
2.    Install KRA
3.    Attempt any operation that contacts KRA (e.g. ipa vault-add).

Actual behavior

Communication with KRA fails.

Expected behavior

Communication with KRA succeeds.

Version/Release/Distribution

4.8 and possibly every version of IPA ever (since we supported custom subject DN).

Additional info:

The probably is clearly seen in the following ldapsearch output:

% ldapsearch -LLL -D cn=directory\ manager -w4me2Test -b o=ipaca '(|(uid=ipara)(uid=ipakra))' description |less
dn: uid=ipara,ou=people,o=ipaca
description: 2;7;CN=IPA CA 201910021714,DC=redhat,DC=com;CN=IPA RA,O=IPA.LOCAL

dn: uid=ipakra,ou=people,o=kra,o=ipaca
description: 2;7;CN=Certificate Authority,O=IPA.LOCAL;CN=IPA RA,O=IPA.LOCAL

The probably may be improper initialisation of the KRAInstance object during installation.
See discussion from mailing list:

> This looks like actual IPA RA subject is fixed in the code in                                                      
> ipaserver/install/krainstance.py:                                                                                  
>                                                                                                                    
> class KRAInstance(DogtagInstance):                                                                                 
> .....                                                                                                              
>    def __create_kra_agent(self):                                                                                   
> .....                                                                                                              
>        # create ipakra user with RA agent certificate                                                              
>        user_dn = DN(('uid', "ipakra"), ('ou', 'people'), self.basedn)                                              
>        entry = conn.make_entry(                                                                                    
>            user_dn,                                                                                                
>            objectClass=['top', 'person', 'organizationalPerson',                                                   
>                         'inetOrgPerson', 'cmsuser'],                                                               
>            uid=["ipakra"],                                                                                         
>            sn=["IPA KRA User"],                                                                                    
>            cn=["IPA KRA User"],                                                                                    
>            usertype=["undefined"],                                                                                 
>            userCertificate=[cert],                                                                                 
>            description=['2;%s;%s;%s' % (                                                                           
>                cert.serial_number,                                                                                 
>                DN(self.subject),                                                                                   
>                DN(('CN', 'IPA RA'), self.subject_base))])                                                          
>        conn.add_entry(entry)                                                                                       
>                                                                                                                    
> I think it should be picked up from the cert. Time for a ticket?                                                   
>                                                                                                                    
Time for a ticket, yes.  But the above code looks ok.  The problem                                                   
is 'self.subject' (the issuer DN) contains the wrong value.  I'll                                                    
follow the reproducer steps to see what's going on.  I suspect                                                       
KRAInstance instance is not initialised properly for some operation.

Comment 2 Fraser Tweedale 2019-10-04 05:07:22 UTC
Verification steps: https://bugzilla.redhat.com/show_bug.cgi?id=1758404#c2

Comment 3 Florence Blanc-Renaud 2019-10-17 06:22:05 UTC
Fixed upstream
master:
https://pagure.io/freeipa/c/326d417d98b092e175623cd28e46586df00e60a2
https://pagure.io/freeipa/c/7ea50ff76d2ee5367b75d999c2baa2a7a480f34a
https://pagure.io/freeipa/c/e767386e7120be3515d6a34529b51ae658248038

The last commit adds a test in ipatests/test_integration/test_ca_custom_sdn.py (this is a new file, downstream metadata needs to be created to trigger the test).

Comment 4 Florence Blanc-Renaud 2019-10-17 06:43:26 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/8084

Comment 5 Florence Blanc-Renaud 2019-10-17 06:50:05 UTC
*** Bug 1758995 has been marked as a duplicate of this bug. ***

Comment 6 Florence Blanc-Renaud 2020-01-28 09:55:24 UTC
RHEL-7.8 is already near the end of a Development Phase and development is being wrapped up. This bug is being moved to RHEL 7.9.
If you believe this particular bug should be reconsidered for 7.8, please let us know.

Comment 7 Jeremy Vaast 2020-02-03 13:44:27 UTC
Hi Florence,

Even though applying the workaround fixed our environment for some time, the Internal Error message came back and we are now unable to retrieve any Vault. Therefore the workaround doesn't fully fix the issue.
Could you please prioritise this fix so that it can be pushed for 7.8?

Currently support case is opened to try to fix the issue with 7.7.
Thanks,

Comment 8 Florence Blanc-Renaud 2020-02-03 14:13:25 UTC
Hi Jeremy,
do you mean that the "description" attribute of the entry uid=ipakra,ou=people,o=kra,o=ipaca got overwritten?
Do you still see the same value for description in both uid=ipakra,ou=people,o=kra,o=ipaca and uid=ipara,ou=people,o=ipaca?

Comment 9 Jeremy Vaast 2020-02-03 14:20:33 UTC
Hi Florence,

Yes the description attribute was correctly overwritten to match with our custom subject.
The value is also the same for both uid=ipakra,ou=people,o=kra,o=ipaca and uid=ipara,ou=people,o=ipaca.


However we are still seeing the following when trying to retrieve vaults:
# ipa vault-retrieve Secrets --shared
ipa: ERROR: an internal error has occurred

Comment 10 Florence Blanc-Renaud 2020-02-03 14:34:42 UTC
(In reply to Jeremy Vaast from comment #9)
> Hi Florence,
> 
> Yes the description attribute was correctly overwritten to match with our
> custom subject.
> The value is also the same for both uid=ipakra,ou=people,o=kra,o=ipaca and
> uid=ipara,ou=people,o=ipaca.
> 
> 
> However we are still seeing the following when trying to retrieve vaults:
> # ipa vault-retrieve Secrets --shared
> ipa: ERROR: an internal error has occurred

Hi Jeremy,
in this case I would advise to open a new bug as it looks like a different issue. Please include httpd's error_log after enabling the debug mode: 
- create /etc/ipa/server.conf with the following content:
[global]
debug = True

- restart ipa services with 
ipactl restart

- launch the ipa vault-retrieve command
- include /var/log/httpd/error_log to the bugzilla. The error_log will contain the full stack trace of the error and allow us to debug the issue.
After this point you can delete /etc/ipa/server.conf and restart ipa services to disable the debug mode.

Comment 11 Jeremy Vaast 2020-02-03 17:18:19 UTC
Hi Florence,

New Bugzilla was opened here with the requested information
https://bugzilla.redhat.com/show_bug.cgi?id=1797707

Thanks.

Comment 12 Florence Blanc-Renaud 2020-02-06 13:54:00 UTC
Removing needinfo as Jeremy already answered in #c9

Comment 13 Florence Blanc-Renaud 2020-03-24 08:15:02 UTC
Fixed upstream:

ipa-4-8:
    09c6db7 krainstance: set correct issuer DN in uid=ipakra entry
    23f4e00 upgrade: fix ipakra people entry 'description' attribute
    5d68d04 (HEAD) test_integration: add tests for custom CA subject DN

ipa-4-7:
    1071eb2 krainstance: set correct issuer DN in uid=ipakra entry
    4aad2c9 upgrade: fix ipakra people entry 'description' attribute
    4767add (HEAD) test_integration: add tests for custom CA subject DN

ipa-4-6:
    946d96f krainstance: set correct issuer DN in uid=ipakra entry
    2fa8c69 upgrade: fix ipakra people entry 'description' attribute
    0a0e802 (HEAD) test_integration: add tests for custom CA subject DN

Comment 18 Mohammad Rizwan 2020-04-03 10:14:25 UTC
tests passed in pipeline. Hence marking as verified.

Comment 21 errata-xmlrpc 2020-09-29 19:58:29 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: ipa security, bug fix, and enhancement update), 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:3936


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