Bug 1378209

Summary: Replication stops working only when fips mode is set to true
Product: Red Hat Enterprise Linux 7 Reporter: Noriko Hosoi <nhosoi>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: urgent Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: urgent    
Version: 7.3CC: amsharma, enewland, mreynolds, msauton, nkinder, rmeggins
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.6.1-3.el7 Doc Type: Bug Fix
Doc Text:
In FIPS mode, the "slapd_pk11_getInternalKeySlot()" function is now used to retrieve the key slot for a token The Red Hat Directory Server previously tried to retrieve the key slot from a fixed token name, when FIPS mode was enabled on the security database. However, the token name can change. If the key slot is not found, Directory Server is unable to decode the replication manager's password and replication sessions fail. To fix the problem, the "slapd_pk11_getInternalKeySlot()" function now uses FIPS mode to retrieve the current key slot. As a result, replication sessions using *SSL* or *STTARTTLS* no longer fail in the described situation.
Story Points: ---
Clone Of:
: 1388581 (view as bug list) Environment:
Last Closed: 2017-08-01 21:10:21 UTC Type: ---
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: 1390154, 1449195    
Bug Blocks: 1388581, 1425952    

Description Noriko Hosoi 2016-09-21 20:20:22 UTC
Description of problem:

After turning fips mode true, on the dirsrv nss, replication stops working,
getting error like:

NSMMReplicationPlugin - agmt="cn=ReplAgrmt_ds-clone1" (ds-clone1:636): Decoding
of the credentials failed.

Replication stops working only when fips mode is set to true

Version-Release number of selected component (if applicable):
rpm -qa | grep 389
389-admin-1.1.43-2.el6dsrv.x86_64
389-ds-console-1.2.12-2.el6dsrv.noarch
389-console-1.1.16-1.el6dsrv.noarch
389-ds-base-libs-1.2.11.15-74.el6.x86_64
389-admin-console-1.1.11-1.el6dsrv.noarch
389-ds-console-doc-1.2.12-2.el6dsrv.noarch
389-adminutil-1.1.22-1.el6dsrv.x86_64
389-admin-console-doc-1.1.11-1.el6dsrv.noarch
389-ds-base-1.2.11.15-74.el6.x86_64

rpm -qa | grep redhat-ds
redhat-ds-console-9.1.2-1.el6dsrv.noarch
redhat-ds-admin-9.1.2-1.el6dsrv.x86_64
redhat-ds-9.1.2-1.el6dsrv.x86_64
redhat-ds-base-9.1.2-1.el6dsrv.x86_64
redhat-ds-console-doc-9.1.2-1.el6dsrv.noarch

rpm -q nss
nss-3.21.0-8.el6.x86_64

How reproducible:
Looks like this only affects if replication has been setup and confirmed
working before fips mode is turn on.

Steps to Reproduce:
1. modutil -dbdir . -fips true
2. service dirsrv restart ds-<name>

Actual results:

[..] NSMMReplicationPlugin - agmt="cn=ReplAgrmt_ds-clone1" (ds-clone1:636): Decoding of the credentials failed.

Note: this issue is applied to rhel-7, as well.

Comment 2 Marc Sauton 2016-10-25 00:54:43 UTC
GSS Approved Z-Stream

Comment 3 Noriko Hosoi 2016-10-25 15:51:30 UTC
Hi Mark,

The DS side of this issue is already fixed?
The upstream ticket shows your push to the repo.
https://fedorahosted.org/389/ticket/48909
(but the state is still ASSIGNED ;).

If you think this problem is already solved, could you please close the ticket and change the status of this bug to POST?
Thanks!

Please note that the ldapjdk bugs are filed and ready to be rebuilt.
https://bugzilla.redhat.com/show_bug.cgi?id=1382856 (7.4.0)
https://bugzilla.redhat.com/show_bug.cgi?id=1388500 (7.3.z)

Comment 4 Noriko Hosoi 2016-10-25 15:52:41 UTC
Oops, I did not meant to change the status... :p

Comment 5 mreynolds 2016-10-25 15:57:39 UTC
(In reply to Noriko Hosoi from comment #3)
> Hi Mark,
> 
> The DS side of this issue is already fixed?
> The upstream ticket shows your push to the repo.
> https://fedorahosted.org/389/ticket/48909
> (but the state is still ASSIGNED ;).

This is because we still need two NSS bugs fixed for this to truly work:

 NSS - https://bugzilla.redhat.com/show_bug.cgi?id=1387811
 NSS Softoken - https://bugzilla.redhat.com/show_bug.cgi?id=1387812

> 
> If you think this problem is already solved, could you please close the
> ticket and change the status of this bug to POST?

Well we did all we need to do in DS, but it still won't work until NSS gets fixed.  I'll set it to POST, and we can change it later if need be.

> Thanks!
> 
> Please note that the ldapjdk bugs are filed and ready to be rebuilt.
> https://bugzilla.redhat.com/show_bug.cgi?id=1382856 (7.4.0)
> https://bugzilla.redhat.com/show_bug.cgi?id=1388500 (7.3.z)

Comment 6 Noriko Hosoi 2016-10-25 16:07:11 UTC
(In reply to mreynolds from comment #5)
> Well we did all we need to do in DS, but it still won't work until NSS gets
> fixed.  I'll set it to POST, and we can change it later if need be.

Thanks, Mark!  Yeah, this is needed for building 389-ds-base in parallel to ldapjdk...

Comment 9 mreynolds 2017-03-27 17:17:35 UTC
*** Bug 1425841 has been marked as a duplicate of this bug. ***

Comment 11 Amita Sharma 2017-04-25 07:30:24 UTC
[root@qe-blade-01 slapd-M1]# rpm -qa | grep 389
389-ds-base-1.3.6.1-9.el7.x86_64
389-ds-base-libs-1.3.6.1-9.el7.x86_64
389-ds-base-debuginfo-1.3.6.1-9.el7.x86_64

[root@qe-blade-01 slapd-M1]# rpm -qa | grep nss
nss-3.28.4-2.el7.x86_64


[root@qe-blade-01 slapd-M1]# modutil -dbdir . -chkfips true
FIPS mode disabled.


[root@qe-blade-01 fourwaymmr]# netstat -nlp | grep slapd
tcp6       0      0 :::30107                :::*                    LISTEN      26522/ns-slapd      
tcp6       0      0 :::39790                :::*                    LISTEN      6553/ns-slapd       
tcp6       0      0 :::30100                :::*                    LISTEN      24886/ns-slapd      
tcp6       0      0 :::30101                :::*                    LISTEN      24886/ns-slapd      
tcp6       0      0 :::30102                :::*                    LISTEN      25412/ns-slapd      
tcp6       0      0 :::30103                :::*                    LISTEN      25412/ns-slapd      
tcp6       0      0 :::30104                :::*                    LISTEN      25954/ns-slapd      
tcp6       0      0 :::30105                :::*                    LISTEN      25954/ns-slapd      
tcp6       0      0 :::30106                :::*                    LISTEN      26522/ns-slapd

[root@qe-blade-01 slapd-M1]# /usr/lib64/mozldap/ldapmodify -Z -P "/etc/dirsrv/slapd-M1/cert8.db" -W secret12 -p 30101 -h localhost -D "cn=directory manager" -w Secret123 << EOF
dn: uid=new_user2,dc=example,dc=com
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user2
sn: new_user2
cn: new_user2
EOF

adding new entry uid=new_user2,dc=example,dc=com


[root@qe-blade-01 slapd-M1]# /usr/lib64/mozldap/ldapsearch -Z -P "/etc/dirsrv/slapd-M2/cert8.db" -W secret12 -p 30103 -h localhost -D "cn=directory manager" -w Secret123 -s base -b "uid=new_user2,dc=example,dc=com" "objectclass=*"
version: 1
dn: uid=new_user2,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user2
sn: new_user2
cn: new_user2

=========================================================
After enabling FIPS mode -
[root@qe-blade-01 slapd-M1]# modutil -dbdir . -fips true

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

FIPS mode enabled.

[root@qe-blade-01 slapd-M1]# /usr/lib64/mozldap/ldapmodify -Z -P "/etc/dirsrv/slapd-M1/cert8.db" -W secret12 -p 30101 -h localhost -D "cn=directory manager" -w Secret123 << EOF
> dn: uid=new_user3,dc=example,dc=com
> changetype: add
> objectClass: top
> objectClass: person
> objectClass: organizationalPerson
> objectClass: inetorgperson
> uid: new_user3
> sn: new_user3
> cn: new_user3
> EOF
adding new entry uid=new_user3,dc=example,dc=com

[root@qe-blade-01 slapd-M1]# /usr/lib64/mozldap/ldapsearch -Z -P "/etc/dirsrv/slapd-M2/cert8.db" -W secret12 -p 30103 -h localhost -D "cn=directory manager" -w Secret123 -s base -b "uid=new_user3,dc=example,dc=com" "objectclass=*"
version: 1
dn: uid=new_user3,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user3
sn: new_user3
cn: new_user3

Replication is working fine.

Comment 12 Amita Sharma 2017-05-16 14:22:52 UTC
Failed with latest build.
Bug - https://bugzilla.redhat.com/show_bug.cgi?id=1449195

Comment 14 Amita Sharma 2017-05-23 08:46:59 UTC
[root@vm-idm-011 6.0]# ps -aef | grep slapd
root      1034     1  0 13:02 ?        00:00:01 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-M1 -i /var/run/dirsrv/slapd-M1.pid
root      1548     1  0 13:02 ?        00:00:01 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-M2 -i /var/run/dirsrv/slapd-M2.pid
root      2082     1  0 13:02 ?        00:00:01 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-M3 -i /var/run/dirsrv/slapd-M3.pid
root      2646     1  0 13:02 ?        00:00:01 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-M4 -i /var/run/dirsrv/slapd-M4.pid
root      3587 26560  0 13:08 pts/0    00:00:00 grep --color=auto slapd
root     28621     1  0 13:01 ?        00:00:01 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-deftestinst -i /var/run/dirsrv/slapd-deftestinst.pid

[root@vm-idm-011 6.0]# rpm -qa | grep 389
389-ds-base-debuginfo-1.3.6.1-14.el7.x86_64
389-ds-base-1.3.6.1-14.el7.x86_64
389-ds-base-libs-1.3.6.1-14.el7.x86_64

[root@vm-idm-011 6.0]# rpm -qa | grep nss-
nss-3.28.4-8.el7.x86_64

[root@vm-idm-011 6.0]# netstat -nlp | grep slapd
tcp6       0      0 :::30107                :::*                    LISTEN      2646/ns-slapd       
tcp6       0      0 :::39792                :::*                    LISTEN      28621/ns-slapd      
tcp6       0      0 :::30100                :::*                    LISTEN      1034/ns-slapd       
tcp6       0      0 :::30101                :::*                    LISTEN      1034/ns-slapd       
tcp6       0      0 :::30102                :::*                    LISTEN      1548/ns-slapd       
tcp6       0      0 :::30103                :::*                    LISTEN      1548/ns-slapd       
tcp6       0      0 :::30104                :::*                    LISTEN      2082/ns-slapd       
tcp6       0      0 :::30105                :::*                    LISTEN      2082/ns-slapd       
tcp6       0      0 :::30106                :::*                    LISTEN      2646/ns-slapd 


/usr/lib64/mozldap/ldapmodify -Z -P "/etc/dirsrv/slapd-M1/cert8.db" -W secret12 -p 30101 -h localhost -D "cn=directory manager" -w Secret123 << EOF
dn: uid=new_user2,dc=example,dc=com
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user2
sn: new_user2
cn: new_user2
EOF

/usr/lib64/mozldap/ldapsearch -Z -P "/etc/dirsrv/slapd-M2/cert8.db" -W secret12 -p 30103 -h localhost -D "cn=directory manager" -w Secret123 -s base -b "uid=new_user2,dc=example,dc=com" "objectclass=*"
version: 1
dn: uid=new_user2,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user2
sn: new_user2
cn: new_user2

[root@vm-idm-011 6.0]# modutil -dbdir . -fips true

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

FIPS mode enabled.

/usr/lib64/mozldap/ldapmodify -Z -P "/etc/dirsrv/slapd-M1/cert8.db" -W secret12 -p 30101 -h localhost -D "cn=directory manager" -w Secret123 << EOF
dn: uid=new_user5,dc=example,dc=com
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user5
sn: new_user5
cn: new_user5
EOF

/usr/lib64/mozldap/ldapsearch -Z -P "/etc/dirsrv/slapd-M2/cert8.db" -W secret12 -p 30103 -h localhost -D "cn=directory manager" -w Secret123 -s base -b "uid=new_user5,dc=example,dc=com" "objectclass=*"
version: 1
dn: uid=new_user5,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
uid: new_user5
sn: new_user5
cn: new_user5

Comment 15 errata-xmlrpc 2017-08-01 21:10:21 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-2017:2086