Bug 1999992

Summary: ipa migrate-ds command fails to warn when compat plugin is enabled
Product: Red Hat Enterprise Linux 8 Reporter: Sudhir Menon <sumenon>
Component: ipaAssignee: Florence Blanc-Renaud <frenaud>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: frenaud, lmiksik, rcritten, ssidhaye, tscherf, twoerner
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: idm-client-8050020210913151510.de73ecb2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2002285 2004165 (view as bug list) Environment:
Last Closed: 2021-11-09 18:29:52 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: 2002285, 2004165    

Description Sudhir Menon 2021-09-01 07:12:11 UTC
Description of problem: ipa migrate-ds command fails to warn compat plugin is enabled

Version-Release number of selected component (if applicable):
ipa-server-4.9.6-4.module+el8.5.0+11912+1b4496cf.x86_64
389-ds-base-1.4.3.23-10.module+el8.5.0+12398+47000435.x86_64
pki-ca-10.11.0-2.module+el8.5.0+12220+9cc212a8.noarch
selinux-policy-3.14.3-79.el8.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install IPA server and client
2. Ensure enable-migration=TRUE in IPA server and compat plugin is enabled
3. Setup dsinstance on the IPA client and add users to the instance.
4. Run migrate-ds command on IPA client

Actual results:
Migration is done, and the warning is missing saying that 'compat plugin is enabled'.

[root@client ~]# echo password | ipa migrate-ds ldap://client.rhel85.test:389 > /tmp/compatenabled1.out
-----------
migrate-ds:
-----------
Migrated:
  user: puser1
  group: demo_group, group1, group2, hr managers, qa managers, pd managers, accounting managers
Failed user:
Failed group:
----------
Passwords have been migrated in pre-hashed format.
IPA is unable to generate Kerberos keys unless provided
with clear text passwords. All migrated users need to
login at https://your.domain/ipa/migration/ before they
can use their Kerberos accounts.

Expected results:
Warning needs to be displayed for compat plugin being enabled.

Additional info: 
https://bugzilla.redhat.com/show_bug.cgi?id=783270#c6

Comment 2 Florence Blanc-Renaud 2021-09-01 09:12:05 UTC
The migrate-ds plugin is doing an internal ldapsearch in order to find if the compat plugin is enabled, equivalent to
ldapsearch -Y GSSAPI -b cn=compat,$SUFFIX -s base "(objectClass=*)" * aci

This search does not return any entry, and the plugin considers that the compat tree is not enabled.

This looks similar to https://bugzilla.redhat.com/show_bug.cgi?id=1958909 except that 1958909 was fixed for base searches below cn=compat,$SUFFIX (for instance -b cn=admins,cn=groups,cn=compat,$SUFFIX). It seems that the fix was not sufficient:
# ldapsearch -LLL -o ldif-wrap=no  -D cn=directory\ manager -w Secret123 -b cn=compat,dc=ipa,dc=test -s base "(objectClass=*)"
No such object (32)
Matched DN: dc=ipa,dc=test
# rpm -qa ipa-server slapi-nis
ipa-server-4.9.6-4.module+el8.5.0+11912+1b4496cf.x86_64
slapi-nis-0.56.6-3.module+el8.5.0+11645+9d3a3007.x86_64


On IPA side, we can check if compat plugin is enabled by reading the entry cn=Schema Compatibility,cn=plugins,cn=config: if the attribute "nsslapd-pluginEnabled" is set to on, then the plugin is enabled.

Comment 3 Florence Blanc-Renaud 2021-09-01 09:49:05 UTC
Opened https://bugzilla.redhat.com/show_bug.cgi?id=2000060 to track the base search on cn=compat,$SUFFIX issue.

We can either wait for a fix of 2000060, or modify migrate-ds code with a workaround (search -b cn=users,cn=compat,$SUFFIX -s base instead of search -b cn=compat,$SUFFIX -s base for instance).
Note that my previous suggestion (reading the entry cn=Schema Compatibility,cn=plugins,cn=config) would not work as this entry is protected by ACIs and only directory manager could read its content. Since migrate-ds is run with a kerberos ticket (usually admin), the entry would not be returned and migrate-ds would wrongly assume that the compat plugin is not enabled.

Comment 4 Florence Blanc-Renaud 2021-09-07 15:02:02 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/8984

Comment 5 Florence Blanc-Renaud 2021-09-08 08:25:42 UTC
Fixed upstream
master:
https://pagure.io/freeipa/c/2ba3028b968f8d3c27980c9921c0c08b29d024e9

Comment 6 Florence Blanc-Renaud 2021-09-08 12:47:43 UTC
Fixed upstream
ipa-4-9:
https://pagure.io/freeipa/c/3c4f9e7347965ff9a887147df34e720224ffa7cc

Comment 9 Florence Blanc-Renaud 2021-09-09 08:30:51 UTC
Removing "depends on" as a workaround has been implemented in the fix for this BZ.

Comment 18 errata-xmlrpc 2021-11-09 18:29: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 (ipa 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/RHBA-2021:4230