Skip to content

pam: apply SIDs from PAC to authentication indicators#8571

Open
sumit-bose wants to merge 3 commits intoSSSD:masterfrom
sumit-bose:pac_ama
Open

pam: apply SIDs from PAC to authentication indicators#8571
sumit-bose wants to merge 3 commits intoSSSD:masterfrom
sumit-bose:pac_ama

Conversation

@sumit-bose
Copy link
Copy Markdown
Contributor

This patch reads the PAC of a Kerberos ticket while evaluating the
authentication indicators of the Kerberos ticket during a pam_sss_gss
request. Based on the value of the pam_gssapi_indicators_apply option
the found SIDs might add additional authentication indicators to the
evaluation.

The primary use case is to handle SIDs added by Active Directory's
Authentication Mechanism Assurance (AMA).

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the pam_gssapi_indicators_apply configuration option, which allows SSSD to assign additional authentication indicators based on information extracted from Kerberos tickets, specifically SIDs from the PAC. The implementation involves updating the configuration schema, documentation, and the PAM responder's GSSAPI logic to handle PAC data parsing and SID-to-indicator mapping. Review feedback identifies a bug where an error code is not properly set upon memory allocation failure and suggests improving the robustness of GSSAPI attribute matching to avoid partial string matches.

Comment on lines +575 to +579
if (exported == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Unable to pre-allocate indicators\n");
goto done;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If talloc_strdup fails, ret is not updated to reflect the error. It will retain its value from the previous call to ad_get_sids_from_pac. This can lead to the error being masked. You should set ret = ENOMEM; before jumping to done.

    if (exported == NULL) {
        DEBUG(SSSDBG_CRIT_FAILURE,
              "Unable to pre-allocate indicators\n");
        ret = ENOMEM;
        goto done;
    }

Comment on lines 662 to +663
if (strncmp(AUTH_INDICATORS_TAG, attrs->elements[i].value,
sizeof(AUTH_INDICATORS_TAG) - 1) != 0)
sizeof(AUTH_INDICATORS_TAG) - 1) == 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The check for AUTH_INDICATORS_TAG uses strncmp without checking the length of the attribute name. This could lead to a partial match if another attribute name starts with "auth-indicators". For consistency and correctness, it's better to perform an exact match, similar to how MSPAC_TAG is checked.

        if (attrs->elements[i].length == sizeof(AUTH_INDICATORS_TAG) - 1 &&
            strncmp(AUTH_INDICATORS_TAG, (char *)attrs->elements[i].value,
                    sizeof(AUTH_INDICATORS_TAG) - 1) == 0) {

struct samr_RidWithAttributeArray groups;
};

errno_t ad_get_sids_from_pac(TALLOC_CTX *mem_ctx,

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 211 lines.
To make ad_get_sids_from_pac() better reusable it is moved with its
dependencies into ad_pac_common.c
@sumit-bose sumit-bose force-pushed the pac_ama branch 2 times, most recently from 7869c3e to 6b4d62b Compare April 1, 2026 19:13
This patch reads the PAC of a Kerberos ticket while evaluating the
authentication indicators of the Kerberos ticket during a pam_sss_gss
request. Based on the value of the pam_gssapi_indicators_apply option
the found SIDs might add additional authentication indicators to the
evaluation.

The primary use case is to handle SIDs added by Active Directory's
Authentication Mechanism Assurance (AMA).
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 this pull request may close these issues.

2 participants