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 1526735 - SSSD allows to set ldap_sasl_minssf = negative values, without error logging
Summary: SSSD allows to set ldap_sasl_minssf = negative values, without error logging
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cyrus-sasl
Version: 7.5
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelen
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-16 23:31 UTC by Amith
Modified: 2018-06-19 06:18 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-19 06:18:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
SSSD_BE strace files (1.80 MB, text/plain)
2018-02-11 14:18 UTC, Amith
no flags Details
Another SSSD_BE backend trace file. (61.29 KB, text/plain)
2018-02-11 14:19 UTC, Amith
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1431586 0 unspecified CLOSED GSSAPI mechanism does not correctly report or calculate SSF values for Kerberos 2021-02-22 00:41:40 UTC

Internal Links: 1431586

Description Amith 2017-12-16 23:31:43 UTC
Description of problem:
Test failures were observed during krb-provider (GSSAPI/SASL) regression runs. When ldap_sasl_minssf is set to invalid values (negative numbers), SSSD used to log "unknown authentication method" error. User lookup and auth used to fail. However with the latest build, SSSD allows -ve numbers. It logs error only when ldap_sasl_minssf is greater than 256.

Version-Release number of selected component (if applicable):
sssd-1.16.0-13.el7.x86_64

How reproducible:
Always

Steps to Reproduce:

1. Configure sssd with GSSAPI (against 389ds ldap+krb server). Keep the ldap.conf settings to default. Sample sssd.conf as follows:

[sssd]
config_file_version = 2
sbus_timeout = 30
services = nss, pam
domains = LDAP-KRB5

[nss]
filter_groups = root
filter_users = root

[pam]

[domain/LDAP-KRB5]
debug_level=0xFFF0
id_provider = ldap
ldap_uri = ldap://LDAP_SERVER
ldap_search_base = dc=example,dc=com
auth_provider = krb5
krb5_server = KRB_SERVER
krb5_realm = EXAMPLE.COM
ldap_sasl_mech = GSSAPI
ldap_sasl_authid = host/CLIENT
ldap_sasl_minssf = -112

2. Run user lookup, it works.
# id user_ssftest1
uid=6547654(user_ssftest1) gid=6547654 groups=6547654

3. Check /var/log/sssd/sssd_LDAP-KRB5.log file and grep out "ldap_sasl_" , you will see that it works.

[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_mech has value GSSAPI
[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_authid has value host/mgmt7.rhq.lab.eng.bos.redhat.com
[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_realm has no value 
[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_minssf has value -112
[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_canonicalize is FALSE

Actual results:
User lookup and auth works fine without error logging.

Expected results:
ldap_sasl_minssf should work only with valid values. SSSD stopped error logging. In rhel7.4, the above test used to fail with the error :

[sssd[be[LDAP-KRB5]]] [sasl_bind_send] (0x0020): ldap_sasl_bind failed (-6)[Unknown authentication method]


Additional info:

Comment 3 Jakub Hrozek 2017-12-17 21:32:04 UTC
I haven't tested this myself yet, but the code that handles MINSSF is the same for ages:

 281     sasl_mech = dp_opt_get_string(state->opts->basic, SDAP_SASL_MECH);
 282     if (sasl_mech != NULL) {
 283         sasl_minssf = dp_opt_get_int(state->opts->basic, SDAP_SASL_MINSSF);
 284         if (sasl_minssf >= 0) {
 285             ber_sasl_minssf = (ber_len_t)sasl_minssf;
 286             lret = ldap_set_option(state->sh->ldap, LDAP_OPT_X_SASL_SSF_MIN,
 287                                    &ber_sasl_minssf);
 288             if (lret != LDAP_OPT_SUCCESS) {
 289                 DEBUG(SSSDBG_CRIT_FAILURE, "Failed to set LDAP MIN SSF option "
 290                                             "to %d\n", sasl_minssf);
 291                 goto fail;
 292             }
 293         }
 294     }

So negative values should not be taken into account. Do you have a system handy with the negative SSF where the setting causes the lookups to fail?

Also, this message:
[sssd[be[LDAP-KRB5]]] [sasl_bind_send] (0x0020): ldap_sasl_bind failed (-6)[Unknown authentication method]
comes either from openldap-libs or cyrus-sasl, so if anything changed, it's not in SSSD, I presume.

I wouldn't treat this as a regression in SSSD...

Comment 4 Amith 2017-12-18 03:47:30 UTC
(In reply to Jakub Hrozek from comment #3)
> I haven't tested this myself yet, but the code that handles MINSSF is the
> same for ages:
> 
>  281     sasl_mech = dp_opt_get_string(state->opts->basic, SDAP_SASL_MECH);
>  282     if (sasl_mech != NULL) {
>  283         sasl_minssf = dp_opt_get_int(state->opts->basic,
> SDAP_SASL_MINSSF);
>  284         if (sasl_minssf >= 0) {
>  285             ber_sasl_minssf = (ber_len_t)sasl_minssf;
>  286             lret = ldap_set_option(state->sh->ldap,
> LDAP_OPT_X_SASL_SSF_MIN,
>  287                                    &ber_sasl_minssf);
>  288             if (lret != LDAP_OPT_SUCCESS) {
>  289                 DEBUG(SSSDBG_CRIT_FAILURE, "Failed to set LDAP MIN SSF
> option "
>  290                                             "to %d\n", sasl_minssf);
>  291                 goto fail;
>  292             }
>  293         }
>  294     }
> 
> So negative values should not be taken into account. Do you have a system
> handy with the negative SSF where the setting causes the lookups to fail?

User lookup works fine and that is the problem. User lookup is expected to fail when ldap_sasl_minssf is set with -ve values, for example -1 or -999. But in rhel7.5, user lookup works and we don't see any error. Thats why we see failures in test suite as the test was designed to fail with -ve values.

> 
> Also, this message:
> [sssd[be[LDAP-KRB5]]] [sasl_bind_send] (0x0020): ldap_sasl_bind failed
> (-6)[Unknown authentication method]
> comes either from openldap-libs or cyrus-sasl, so if anything changed, it's
> not in SSSD, I presume.
> 
> I wouldn't treat this as a regression in SSSD...

I am not sure whether its a regression in SSSD but i am sure something has changed, somehwere.

Comment 14 Jakub Jelen 2018-01-30 14:49:51 UTC
OK, to summarize, what is the problem here, the tools are accepting negative minssf value, that it did not accept before.

Excuse my basic question, but is there any reason why one would like to set this value? It might not make a lot of sense, but even if the minssf value is negative, any positive one that will be negotiated  will be accepted, which might not be necessarily wrong, isn't it? These values behave basically the same as 0, isn't it?

Even though, it might be unwanted or uncomfortable for you as a QE, I don't see this as a regression or anything that would need to be handled ASAP so I would be for removing the Regression tag and moving it to RHEL7.6 release.

The error from LDAP is LDAP_AUTH_UNKNOWN, which is converted from GSSAPI error using map_gsserr2ldap(), most probably in ldap_int_gss_spnego_bind_s(). You are running your tests against RHEL7.4 (last time you were running the RHEL7.3??), which already have the SPNEGO fixed (bug #1421663 in RHEL7.4) and therefore the code might be going through this mechanism, which is handling the ssf in different way.

Can you run the tests once more and generate ldap debug trace logs so we could compare where did the LDAP failed and when it did not?


There is still many unknowns in this topic and I do not consider it as a big issue so I propose to postpone this to the next release, if you agree.

Comment 16 Amith 2018-02-11 14:18:09 UTC
Created attachment 1394603 [details]
SSSD_BE strace files

Comment 17 Amith 2018-02-11 14:19:48 UTC
Created attachment 1394605 [details]
Another SSSD_BE backend trace file.

Comment 18 Amith 2018-02-11 14:38:41 UTC
Tested this case on SSSD Version sssd-1.16.0-16.el7.x86_64

I have attached two trace files with this bug.
1. sssd_be_strace.9448
2. sssd_be_strace.9542

This bug was discussed in the SSSD-QE weekly meeting and we agree on postponing this to the next release. 

Response to why -ve values were tested with minssf:
 - When minssf is kept default, ie no values are assigned to it in sssd.conf and ldap.conf, then the SSSD log always show "[sssd[be[LDAP-KRB5]]] [dp_get_options] (0x0400): Option ldap_sasl_minssf has value -1". 
Ideally default value should be Zero. So whoever from QE wrote the test cases for "minssf" must have presumed that "-1" is the default value and have tested minssf with negative values as well which is not wrong. Negative testing is as important as the positive one's.

The automated tests were working fine till 7.4, but in 7.5 couple of cases failed. So obviously something changed which caused the regression. I also agree that this is not something that need to be fixed ASAP.


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