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 1496224 - Export changelog db fails when the changelog encryption is configured
Summary: Export changelog db fails when the changelog encryption is configured
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.4
Hardware: x86_64
OS: Linux
high
urgent
Target Milestone: rc
: ---
Assignee: mreynolds
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-26 17:08 UTC by Sankar Ramalingam
Modified: 2017-10-12 13:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-12 13:57:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Sankar Ramalingam 2017-09-26 17:08:33 UTC
Description of problem: Exporting changelogdb files to LDIF file fails when changelog encryption is configured. 


Version-Release number of selected component (if applicable): 389-ds-base-1.3.6.1-20


How reproducible: Consistently


Steps to Reproduce:
1. Configure two master replication
2. Configure changelog encryption for master1.
Refer to the design doc - http://directory.fedoraproject.org/docs/389ds/FAQ/changelog-encryption.html
3. Add few users with password and check if changelog's unhashed#user#password attribute is encrypted in master1.
4. Check if changelog db can be backed up in ldif file.

[root@hp-dl80gen9-01 ~]# PORT=39001 ; ldapmodify -x -p $PORT -h  localhost -D "cn=Directory Manager" -w password  << EOF
dn: cn=replica,cn="dc=example,dc=com",cn=mapping tree,cn=config
changetype: modify
add: nsds5Task
nsds5Task: CL2LDIF
EOF

modifying entry "cn=replica,cn="dc=example,dc=com",cn=mapping tree,cn=config"

The task seems to be completed successfully, but the error log shows that its not.
[26/Sep/2017:12:55:56.942528576 -0400] - INFO - NSMMReplicationPlugin - replica_execute_cl2ldif_task - Beginning changelog export of replica "f381588d-a2da11e7-9f71c0b1-92fa1179"
[26/Sep/2017:12:55:56.967812915 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:56.984312936 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "objectclass: 74" failed


Actual results: changelogdb backup fails.

_back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.

Expected results: Changelogdb backup should succeed.


Additional info:

[26/Sep/2017:12:55:56.942528576 -0400] - INFO - NSMMReplicationPlugin - replica_execute_cl2ldif_task - Beginning changelog export of replica "f381588d-a2da11e7-9f71c0b1-92fa1179"
[26/Sep/2017:12:55:56.967812915 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:56.984312936 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "objectclass: 74" failed
[26/Sep/2017:12:55:57.000967728 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.017600832 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "objectclass: 6c" failed
[26/Sep/2017:12:55:57.034334786 -0400] - ERR - _back_crypt_crypto_op - Digest final failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.051018299 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "objectclass: 65" failed
[26/Sep/2017:12:55:57.067695660 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.084378182 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "cn: 72" failed
[26/Sep/2017:12:55:57.101079754 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.117722180 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "creatorsName: 63" failed
[26/Sep/2017:12:55:57.134417392 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.151104621 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "modifiersName: 63" failed
[26/Sep/2017:12:55:57.167759978 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.184462149 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "createTimestamp: 32" failed
[26/Sep/2017:12:55:57.201114768 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.217826947 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "modifyTimestamp: 32" failed
[26/Sep/2017:12:55:57.234502694 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.251205311 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "nsUniqueId: 66" failed
[26/Sep/2017:12:55:57.267852859 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.284515297 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "parentid: 31" failed
[26/Sep/2017:12:55:57.301221071 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.317887280 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "entryid: 31" failed
[26/Sep/2017:12:55:57.334584638 -0400] - ERR - _back_crypt_crypto_op - Failed on cipher AES : -8190 - security library: received bad data.
[26/Sep/2017:12:55:57.351246749 -0400] - ERR - NSMMReplicationPlugin - changelog program - _cl5ReadMod - Decrypting "entrydn: 63" failed
[26/Sep/2017:12:55:57.367920123 -0400] - ERR - slapi_mods2entry - Add_values for type nsUniqueId failed (rc: 16)

Comment 2 Sankar Ramalingam 2017-09-26 17:32:53 UTC
Additional details to reproduce the problem:

Setup: 2 master replication setup
Steps:
1. Stop the server instance and edit /etc/dirsrv/slapd-master1/dse.ldif file.
2. Add "nsslapd-encryptionalgorithm: AES" under cn=changelog5,cn=config entry.
3. Start the server instance.
4. Add user entry with password to master1
5. Check if unhashed#user#password attribute is encrypted by doing dbscan -f
/usr/bin/dbscan -f /var/lib/dirsrv/slapd-master1/changelogdb/xyz.db

You can see that the changelog entry for newly added user is encrypted.
6. Now, try to take the changelog db backup.
[root@hp-dl80gen9-01 ~]# PORT=39001 ; ldapmodify -x -p $PORT -h  localhost -D "cn=Directory Manager" -w password  << EOF
dn: cn=replica,cn="dc=example,dc=com",cn=mapping tree,cn=config
changetype: modify
add: nsds5Task
nsds5Task: CL2LDIF
EOF

7. Changelog db backup fails and that can be observed from error logs.

NSS packages present on the test machine.

[root@hp-dl80gen9-01 ~]# rpm -qa |grep -i nss-
nss-softokn-freebl-3.28.3-8.el7_4.x86_64
nss-softokn-3.28.3-8.el7_4.x86_64
nss-pem-1.0.3-4.el7.x86_64
python-nss-0.16.0-3.el7.x86_64
mod_nss-1.0.14-10.el7_4.1.x86_64
nss-util-3.28.4-3.el7.x86_64
nss-debuginfo-3.28.4-14.el7_4.x86_64
nss-sysinit-3.28.4-14.el7_4.x86_64
nss-tools-3.28.4-14.el7_4.x86_64
nss-3.28.4-14.el7_4.x86_64

Comment 3 Ludwig 2017-09-26 18:01:26 UTC
do you already have entries in the changelog when you enable encryption ?

you cannot have a mix of encrypted and clear entries in the changelog.

Comment 4 Sankar Ramalingam 2017-09-27 12:48:38 UTC
(In reply to Ludwig from comment #3)
> do you already have entries in the changelog when you enable encryption ?
> 
> you cannot have a mix of encrypted and clear entries in the changelog.
Yes, I have mix of encrypted and cleartext entries in changelog. It is present since, I used replication topology from lib389 - topology_m2.

Comment 5 Ludwig 2017-09-27 13:20:07 UTC
this does not work. if you enable encryption after having enries in the changelog you need to reinit the changelog. you could eitehr:
- reimport the database via ldif 
- reinit the server from another server
- try to 
-- export cl to ldif
-- enable cl encryption
-- reimport the cl


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