Skip to content

SSSD on IPA should fail with short names#8261

Merged
sumit-bose merged 4 commits intoSSSD:masterfrom
thalman:ipa_fail_on_short_names
Dec 15, 2025
Merged

SSSD on IPA should fail with short names#8261
sumit-bose merged 4 commits intoSSSD:masterfrom
thalman:ipa_fail_on_short_names

Conversation

@thalman
Copy link
Contributor

@thalman thalman commented Dec 3, 2025

SSSD should refuse to start when SSSD is in server mode and full_name_format is set to %1s$.

Copy link

@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 correctly implements a check to prevent SSSD from starting in IPA server mode when full_name_format is set to use only short names. The accompanying test case is also well-written and verifies the new behavior. My only suggestion is to add a system log message for the startup failure to improve visibility for administrators, as the current implementation only logs to the debug log.

@thalman thalman added the Trivial A single reviewer is sufficient to review the Pull Request label Dec 4, 2025
@sumit-bose
Copy link
Contributor

Hi,

thank you for the patch. I think Gemini's comment is valid and I wonder if you can combine the new check with the existing one in an if-else-if block to make clear that the same option is checked.

While checking the code I found that ipa_trusted_subdom_init() is declared twice in src/providers/ipa/ipa_subdomains.h. This does not harm but maybe you can fix this with this PR as well?

A second, not related item, CONFDB_DEFAULT_FULL_NAME_FORMAT_INTERNAL in the existing check makes no sense and I even do not understand why it was added initially. I think the define and the related check can be removed. But if you prefer this can be handled with a different PR as well like the item before.

bye,
Sumit

@thalman
Copy link
Contributor Author

thalman commented Dec 10, 2025

Hi @sumit-bose , I fixed the if - else - if part in the commit.

The other two items I did as separate commits.

1. SSSD must refuse to start
:customerscenario: False
"""
cfg = "[domain/ipa.test]\nfull_name_format = %1$s\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi,

the IPA domain might not be called ipa.test in all test environment, I guess it would be better to use ipa.domain instead or the framework functions which can modify sssd.conf directly.

Is there a reason for using a config snippet?

bye,
Sumit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, updated.

Regarding snippets - yes it is needed here. The main config is somehow overwritten/managed by topology. I did not look into details tough. This was the easiest way to set it.

@thalman thalman force-pushed the ipa_fail_on_short_names branch from 2e4db1c to a641592 Compare December 10, 2025 13:57
Copy link
Contributor

@madhuriupadhye madhuriupadhye left a comment

Choose a reason for hiding this comment

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

See inline


@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopology.IPA)
def test_ipa__prohibited_short_names(client: Client, ipa: IPA):
Copy link
Contributor

Choose a reason for hiding this comment

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

The client: Client parameter is not used anywhere, please remove it.

"""
cfg = f"[domain/{ipa.domain}]\nfull_name_format = %1$s\n"
ipa.fs.write("/etc/sssd/conf.d/shortname.conf", cfg, mode="640")
result = ipa.host.conn.exec(["systemctl", "restart", "sssd"], raise_on_error=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of raw command, we can use this, result = ipa.sssd.restart(raise_on_error=False, apply_config=False)

:customerscenario: False
"""
cfg = f"[domain/{ipa.domain}]\nfull_name_format = %1$s\n"
ipa.fs.write("/etc/sssd/conf.d/shortname.conf", cfg, mode="640")
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate the code with a blank line, following the setup, step, and result.

@thalman thalman force-pushed the ipa_fail_on_short_names branch from a641592 to cde7d34 Compare December 10, 2025 19:36
@thalman
Copy link
Contributor Author

thalman commented Dec 10, 2025

Thanks to Madhuri's comments I also found a way how to do the test without snippet, lets wait for CI to see if it works.

@thalman thalman force-pushed the ipa_fail_on_short_names branch from cde7d34 to 1b27317 Compare December 10, 2025 19:40
@thalman
Copy link
Contributor Author

thalman commented Dec 11, 2025

@madhuriupadhye, take a look at the test updates.

ci-failures are not related to this change.

Copy link
Contributor

@madhuriupadhye madhuriupadhye left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!!

Copy link
Contributor

@sumit-bose sumit-bose left a comment

Choose a reason for hiding this comment

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

Hi,

thank you for the update, test look much nicer now, ACK.

bye,
Sumit

@sumit-bose
Copy link
Contributor

Hi,

I restarted the two failed test to see if it works better now and will set 'Accepted' when they are done.

bye,
Sumit

SSSD in server mode on IPA server is not allowed to use
short names.

Reviewed-by: Madhuri Upadhye <mupadhye@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Madhuri Upadhye <mupadhye@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
This format is not used anywhere except in unnecessary check.
This update removes it.

Reviewed-by: Madhuri Upadhye <mupadhye@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Madhuri Upadhye <mupadhye@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
@sssd-bot
Copy link
Contributor

The pull request was accepted by @sumit-bose with the following PR CI status:


🟢 CodeFactor (success)
🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-41-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-41) (success)
🟢 ci / intgcheck (fedora-42) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-41) (success)
🟢 ci / system (fedora-42) (success)
🟢 ci / system (fedora-43) (success)
🟢 ci / system (fedora-44) (success)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot sssd-bot force-pushed the ipa_fail_on_short_names branch from 1b27317 to 42be2d4 Compare December 11, 2025 12:06
@sumit-bose sumit-bose merged commit 8360424 into SSSD:master Dec 15, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted backport-to-sssd-2-9 Trivial A single reviewer is sufficient to review the Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants