Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONNECT_ERROR in 3rd TLS handshake on Fedora (NSS backend) #60

Closed
tiran opened this issue Nov 29, 2017 · 3 comments · Fixed by #112
Closed

CONNECT_ERROR in 3rd TLS handshake on Fedora (NSS backend) #60

tiran opened this issue Nov 29, 2017 · 3 comments · Fixed by #112
Milestone

Comments

@tiran
Copy link
Member

tiran commented Nov 29, 2017

PR #42 introduced a test for SASL EXTERNAL auth with TLS client certs. The test case works fine on Travis (Ubuntu). It's also passing on Fedora 27 when executed alone. But when executed with the rest of the test case, slapd refuses STARTTLS with CONNECT_ERROR. PR #59 disables the test temporarily.

I need to investigate why the test is failing. It might be related to the fact that Fedora uses NSS instead of OpenSSL.

@tiran
Copy link
Member Author

tiran commented Nov 30, 2017

I was able to track this down to a problem with NSS layer in openldap. It looks like SECMOD_RestartModules() call fails. I also wonder why tlsm_deferred_ctx_init is called again. It's protected by PR_CallOnceWithArg() so it should only be initialized once.

Breakpoint 2, alloc_handle (ctx_arg=0x55f297b0e480, is_server=0) at tls2.c:280
280     {
(gdb) n
284             if ( ctx_arg ) {
(gdb) p ctx
$6 = <optimized out>
(gdb) n
292             ssl = tls_imp->ti_session_new( ctx, is_server );
(gdb) p tls_imp
$7 = <optimized out>
(gdb) p tls_imp->ti_session_new
value has been optimized out
(gdb) s
tlsm_session_new (ctx=0x55f297b0e480, is_server=0) at tls_m.c:2769
warning: Source file is more recent than executable.
2769    {
(gdb) n
2776            c->tc_is_server = is_server;
(gdb) n
2777            LDAP_MUTEX_LOCK( &tlsm_init_mutex );
(gdb) n
2778            status = PR_CallOnceWithArg( &c->tc_callonce, tlsm_deferred_ctx_init, c );
(gdb) n
2779            LDAP_MUTEX_UNLOCK( &tlsm_init_mutex );
(gdb) n
2778            status = PR_CallOnceWithArg( &c->tc_callonce, tlsm_deferred_ctx_init, c );
(gdb) n
2779            LDAP_MUTEX_UNLOCK( &tlsm_init_mutex );
(gdb) n
2780            if ( PR_SUCCESS != status ) {
(gdb) p status
$8 = PR_FAILURE

Next session

Breakpoint 3, tlsm_deferred_ctx_init (arg=0x55f297b0e480) at tls_m.c:2329
2329    {
(gdb) n
2339            if ( tlsm_deferred_init( ctx ) ) {
(gdb) s
tlsm_deferred_init (arg=<optimized out>) at tls_m.c:1836
1836            struct ldaptls *lt = ctx->tc_config;
(gdb) n
1855            if ( SECFailure == ( rc = SECMOD_RestartModules(PR_FALSE /* do not force */) ) ) {
(gdb) n
tlsm_deferred_ctx_init (arg=0x55f297b0e480) at tls_m.c:2329
2329    {
(gdb) n
2339            if ( tlsm_deferred_init( ctx ) ) {
(gdb) n
2340                Debug( LDAP_DEBUG_ANY,
(gdb) n
2656                            return -1;
(gdb) n
2682    }

tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
See python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
See python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran
Copy link
Member Author

tiran commented Nov 30, 2017

tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
See python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@encukou encukou added this to the 3.0 milestone Nov 30, 2017
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
Some TLS tests are broken or flaky when libldap is compiled with NSS as
TLS provider. It currently affects Fedora 27 and older releases.

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1519167

python-ldap#60

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
Some TLS tests are broken or flaky when libldap is compiled with NSS as
TLS provider. It currently affects Fedora 27 and older releases.

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1519167

python-ldap#60

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
Some TLS tests are broken or flaky when libldap is compiled with NSS as
TLS provider. It currently affects Fedora 27 and older releases.

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1519167

python-ldap#60

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
Some TLS tests are broken or flaky when libldap is compiled with NSS as
TLS provider. It currently affects Fedora 27 and older releases.

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1519167

python-ldap#60

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Nov 30, 2017
Some TLS tests are broken or flaky when libldap is compiled with NSS as
TLS provider. It currently affects Fedora 27 and older releases.

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1519167

python-ldap#60

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Dec 5, 2017
See python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Dec 5, 2017
See python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran changed the title Investigate failing test_external_tlscert on F27 CONNECT_ERROR in 3rd TLS handshake on Fedora (NSS backend) Dec 7, 2017
@tiran
Copy link
Member Author

tiran commented Dec 7, 2017

It was an issue in OpenLDAP's NSS backend, see https://bugzilla.redhat.com/show_bug.cgi?id=1520990 for more details. Matus Honek has pushed fixes:

tiran added a commit to tiran/python-ldap that referenced this issue Dec 7, 2017
The NSS issue has been fixed in Fedora update openldap-2.4.45-2.fc26 and
openldap-2.4.45-4.fc27. Fedora users can now execute all tests.

Includes documentation for build requirements and minimum versions on
Fedora.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1520990
Closes: python-ldap#60
Closes: python-ldap#51
Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Dec 7, 2017
The NSS issue has been fixed in Fedora update openldap-2.4.45-2.fc26 and
openldap-2.4.45-4.fc27. Fedora users can now execute all tests.

Includes documentation for build requirements and minimum versions on
Fedora.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1520990
Closes: python-ldap#60
Closes: python-ldap#51
Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Dec 15, 2017
The new test case simply creates 10 connections and calls start_tls_s()
after OPT_X_TLS_NEWCTX.

See: python-ldap#60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
encukou pushed a commit that referenced this issue Dec 15, 2017
The new test case simply creates 10 connections and calls start_tls_s()
after OPT_X_TLS_NEWCTX.

#134
See: #60
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants