Bug 1048474

Summary: TLS does not work for ldap, incorrect TLS & Debug attribute setting in rlm_ldap
Product: [Fedora] Fedora Reporter: John Dennis <jdennis>
Component: freeradiusAssignee: John Dennis <jdennis>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: jdennis, lemenkov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freeradius-3.0.1-2.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1048475 (view as bug list) Environment:
Last Closed: 2014-01-15 00:23:53 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: 1048475    

Description John Dennis 2014-01-04 13:55:11 UTC
rlm_ldap cannot successfully establish TLS connections with an OpenLDAP server. This is because the TLS connection attributes are not set when the OpenLDAP client library tries to make a connection. The failing connection causes the radius server to fail to initialize and it immediately exits.

The problem is related to use of LDAP_OPT_X_TLS_NEWCTX to establish a per connection TLS context. Apparently LDAP_OPT_X_TLS_NEWCTX has to be called *after* calling ldap_set_option() to set the TLS attributes, if it's called prior to setting the attributes (as is the current code) then the TLS attributes are not copied into the new TLS context.

Not sure, but this might only be a problem for the MozNSS module as opposed to the OpenSSL module (OpenLDAP can be built with different crypto implementations). Currently Red Hat is the only distribution that deploys OpenLDAP with MozNSS which might explain why this problem was not seen upstream. I want to investigate further on this.

Moving LDAP_OPT_X_TLS_NEWCTX to after setting the TLS attributes fixes the connection failures.

During debugging it was also discovered that the way rlm_ldap sets the LDAP debug flag is also incorrect. The debug flag needs to be set on the global context, not the per connection context. As currently implemented one cannot get the ldap library to emit debug information, this also needs fixing.

Comment 1 Fedora Update System 2014-01-15 00:32:14 UTC
freeradius-3.0.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/freeradius-3.0.1-1.fc20

Comment 2 Fedora Update System 2014-01-23 17:22:12 UTC
freeradius-3.0.1-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/freeradius-3.0.1-2.fc20

Comment 3 Fedora Update System 2014-01-28 04:36:30 UTC
freeradius-3.0.1-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.