Bug 722959

Summary: TLS_REQCERT=never ignored when the certificate is expired
Product: Red Hat Enterprise Linux 6 Reporter: Jan Vcelak <jvcelak>
Component: openldapAssignee: Jan Vcelak <jvcelak>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: jhrozek, jplans, jvcelak, jzeleny, omoris, ovasik, tsmetana
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openldap-2.4.23-17.el6 Doc Type: Bug Fix
Doc Text:
- openldap client tool settings contain TLS_REQCERT=never, remote LDAP server has certificate, which was issued by CA whose certificate is expired, the client tries to connect to that server - the connection fails as the CA certificate is expired - patch was applied to ignore expired CA certificate, when TLS_REQCERT is set to 'never' - the connection to server while TLS_REQCERT=never is set succeeds, even if the certificate issuer's certificate is not valid
Story Points: ---
Clone Of:
: 722961 (view as bug list) Environment:
Last Closed: 2011-12-06 12:12:58 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:    
Bug Blocks: 722961    
Attachments:
Description Flags
proposed patch none

Description Jan Vcelak 2011-07-18 15:39:41 UTC
Description of problem:

Setting TLS_REQCERT=never is ignored, when the server certificate is before/after validity period. In that moment, connection fails.

Version-Release number of selected component (if applicable):

openldap-2.4.23-15.el6
openldap-2.4.24-3.fc15

How reproducible:

Set up certificates in slapd to allow TLS/SSL. The certificate can be invalid (invalid issuer, invalid server name, etc.).

Run: LDAPTLS_REQCERT=never ldapsearch -x -ZZ ...

The execution will be successful, TLS will be used.

Change your system time out of the validity period of the certificate. Run the same command again. The command will fail this time.

[root@rhel6-i686 ~]# date 010101012020
St led  1 01:01:00 CET 2020
[root@rhel6-i686 ~]# LDAPTLS_REQCERT=never ldapsearch -x -ZZ -d1
...
TLS: file slapd.pem does not end in [.0] - does not appear to be a CA certificate directory file with a properly hashed file name - skipping.
TLS: loaded CA certificate file /etc/openldap/cacerts/da4d55fe.0 from CA certificate directory /etc/openldap/cacerts.
TLS: certificate [E=root,CN=localhost.localdomain,OU=SomeOrganizationalUnit,O=SomeOrganization,L=SomeCity,ST=SomeState,C=--] is not valid - error -8181:Unknown code ___f 11.
TLS: certificate [E=root,CN=localhost.localdomain,OU=SomeOrganizationalUnit,O=SomeOrganization,L=SomeCity,ST=SomeState,C=--] is not valid - error -8162:Unknown code ___f 30.
TLS: certificate [E=root,CN=localhost.localdomain,OU=SomeOrganizationalUnit,O=SomeOrganization,L=SomeCity,ST=SomeState,C=--] is not valid - error -8162:Unknown code ___f 30.
TLS: error: connect - force handshake failure: errno 0 - moznss error -8162
TLS: can't connect: TLS error -8162:Unknown code ___f 30.
ldap_err2string
ldap_start_tls: Connect error (-11)
        additional info: TLS error -8162:Unknown code ___f 30

Additional info:

openldap-2.4.25-1.fc16 is not affected.

Comment 1 Jan Vcelak 2011-07-20 16:57:10 UTC
Not completely true. All versions of OpenLDAP with MozNSS are affected. When the issuer certificate is expired, the connection will terminate.

When the certificate validation is disabled (e.g. TLS_REQCERT=never), another error has to be ignored - SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE.

Comment 2 Jan Vcelak 2011-07-20 16:57:55 UTC
Created attachment 514059 [details]
proposed patch

Comment 3 Jan Vcelak 2011-07-20 17:06:54 UTC
Submitted upstream: http://www.openldap.org/its/index.cgi?findid=6998

Comment 4 Jan Vcelak 2011-08-08 08:53:51 UTC
Patch was applied upstream.

http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commit;h=e8ac17e

Comment 6 Jan Vcelak 2011-08-15 08:24:31 UTC
Resolved in openldap-2.4.23-17.el6

Comment 7 Jan Vcelak 2011-08-15 10:49:21 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
- openldap client tool settings contain TLS_REQCERT=never, remote LDAP server has certificate, which was issued by CA whose certificate is expired, the client tries to connect to that server
- the connection fails as the CA certificate is expired
- patch was applied to ignore expired CA certificate, when TLS_REQCERT is set to 'never'
- the connection to server while TLS_REQCERT=never is set succeeds, even if the certificate issuer's certificate is not valid

Comment 10 errata-xmlrpc 2011-12-06 12:12:58 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.

http://rhn.redhat.com/errata/RHBA-2011-1514.html