Skip to content

ldaps: add LDAPS support - #264

Open
shridhargadekar wants to merge 7 commits into
SSSD:masterfrom
shridhargadekar:cert_ldaps
Open

shridhargadekar wants to merge 7 commits into
SSSD:masterfrom
shridhargadekar:cert_ldaps

Conversation

@shridhargadekar

Copy link
Copy Markdown
Contributor
  • Add export_root_ca_certificate() to ADHost, SambaHost, and IPAHost
  • Add CertUtils (client.cert) utility for system-level CA cert install into /etc/openldap/ldap.conf — works with adcli, realmd, ldapsearch
  • Add SSSDCommonConfiguration helpers: ad_use_ldaps(), samba_use_ldaps(), ipa_set_tls_cacert() for SSSD-specific LDAPS configuration

Comment thread sssd_test_framework/hosts/ad.py Outdated
Comment thread sssd_test_framework/hosts/ipa.py Outdated
Comment thread sssd_test_framework/hosts/samba.py Outdated
Comment thread sssd_test_framework/utils/cert.py Outdated
Comment thread sssd_test_framework/utils/cert.py Outdated
Comment thread sssd_test_framework/utils/cert.py Outdated
Comment thread sssd_test_framework/utils/sssd.py Outdated
@shridhargadekar
shridhargadekar force-pushed the cert_ldaps branch 4 times, most recently from a94e0cc to 41ed743 Compare August 10, 2026 19:05

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a couple of quick notes until I can test this out.

Comment thread sssd_test_framework/roles/ad.py
Comment thread sssd_test_framework/roles/ad.py
@shridhargadekar

Copy link
Copy Markdown
Contributor Author

Depends upon #255

Comment thread sssd_test_framework/roles/client.py Outdated
Comment thread sssd_test_framework/utils/sssd.py Outdated
Comment thread sssd_test_framework/roles/client.py Outdated
Comment thread sssd_test_framework/roles/ad.py
Comment thread sssd_test_framework/roles/client.py Outdated
Comment thread sssd_test_framework/utils/sssd.py Outdated

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure the AD export method is working as expected. My testing showed the certutil fail and the old commit worked better but, I'm not sure it's pulling the expected certificate.

Comment thread sssd_test_framework/roles/ad.py
Comment thread sssd_test_framework/roles/ad.py
Comment thread sssd_test_framework/roles/ad.py Outdated
Comment thread sssd_test_framework/roles/client.py Outdated
@shridhargadekar
shridhargadekar force-pushed the cert_ldaps branch 3 times, most recently from effb2c3 to b9de358 Compare August 27, 2026 19:59
Comment thread sssd_test_framework/roles/client.py Outdated
Comment thread sssd_test_framework/roles/client.py Outdated
@spoore1

spoore1 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

FYI, latest updates are passing:

======================================== short test summary info ========================================
PASSED tests/test_adcli.py::test_adcli__join_and_update_with_ldaps (ad)
PASSED tests/test_adcli.py::test_adcli__delete_computer_with_ldaps (ad)
PASSED tests/test_adcli.py::test_adcli__join_and_update_with_ldaps (samba)
PASSED tests/test_adcli.py::test_adcli__delete_computer_with_ldaps (samba)
=================================== 4 passed, 84 deselected in 59.91s ===================================

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small change suggestion unless I'm misreading something.

Comment thread sssd_test_framework/roles/ad.py
@shridhargadekar
shridhargadekar force-pushed the cert_ldaps branch 2 times, most recently from 060ea99 to a279b3d Compare October 6, 2026 13:41
@sumit-bose

Copy link
Copy Markdown
Contributor

Hi,

I'm still fine with this PR, but I think ti would be good to squash some of the related patches into one.

bye,
Sumit

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just two minor questions about using the cat command.

Code appears to be working and I ran it with a slight modification to the tests in SSSD/sssd#9137

Comment thread sssd_test_framework/utils/tools.py Outdated
Comment thread sssd_test_framework/topology_controllers.py Outdated

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes LGTM. Testing with SSSD/sssd#9137 is passing with this:

======================================== short test summary info ========================================
PASSED tests/test_authentication.py::test_authentication__user_lookup_over_ldaps (ad)
PASSED tests/test_authentication.py::test_authentication__user_authentication_over_ldaps (ad)
PASSED tests/test_authentication.py::test_authentication__user_lookup_over_ldaps (ipa)
PASSED tests/test_authentication.py::test_authentication__user_authentication_over_ldaps (ipa)
PASSED tests/test_ldaps.py::test_ldaps__ipa_ssl_tls_sets_sssd_options (ipa)
PASSED tests/test_ldaps.py::test_ldaps__ipa_user_lookup_over_starttls (ipa)
PASSED tests/test_authentication.py::test_authentication__user_lookup_over_ldaps (samba)
PASSED tests/test_authentication.py::test_authentication__user_authentication_over_ldaps (samba)
PASSED tests/test_ldaps.py::test_ldaps__samba_user_lookup_over_ldaps (samba)
PASSED tests/test_ldaps.py::test_ldaps__samba_ca_cert_present_on_client (samba)
PASSED tests/test_ldaps.py::test_ldaps__samba_ssl_tls_sets_sssd_options (samba)
============================ 11 passed, 969 deselected in 193.78s (0:03:13) =============================

spoore1
spoore1 previously approved these changes Oct 14, 2026
sumit-bose
sumit-bose previously approved these changes Oct 14, 2026

@sumit-bose sumit-bose left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

as said I agree with the PR and is working well in my tests, ACK.

But I still would prefer if some of releated the patches can be squashed together.

bye,
Sumit

danlavu
danlavu previously approved these changes Oct 14, 2026

@danlavu danlavu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for all the changes, the PR looks good. One nitpick, please make those changes but I'm approving.


client.fs.backup("/etc/resolv.conf")

# Install IPA CA certificate so LDAPS/STARTTLS tests can use it without per-test setup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please match the comments' style and provide a one-line summary. The extra information isn't particularly useful.

Install the provider CA certificate on the client

is sufficient.

provider.fs.backup("/etc/resolv.conf")
provider.fs.write("/etc/resolv.conf", f"search {provider.domain}\nnameserver 127.0.0.1\n\n")

# Install the provider's CA certificate on the client so LDAPS tests can use it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please match the comments' style and provide a one-line summary. The extra information isn't particularly useful.

Install the provider CA certificate on the client

is sufficient.

shridhargadekar and others added 7 commits October 15, 2026 01:38
Add export_root_ca_certificate() abstract method to GenericProvider
and implement it in the AD, IPA, and Samba roles.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add OpenSSLUtils to utils/tools.py with install_ca_cert(),
install_ca_cert_from_server(), and _configure_openldap() helpers.
Add install_ca_cert() and ssl attribute to the Client role.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ADTopologyController (Samba) and IPATopologyController now install the
provider's CA certificate on the client via OpenSSLUtils before the
provisioned check, so LDAPS/STARTTLS tests have the cert available
without any per-test setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace use_ldaps() with ssl_tls() in SSSDCommonConfiguration. The CA
certificate is now pre-installed by the topology controller, so ssl_tls()
only sets the SSSD domain options (ad_use_ldaps or ldap_id_use_start_tls)
and ldap_tls_cacert path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove install_ca_cert(), install_ca_cert_from_server(), use_ldaps(), and
_configure_tls_cacert() from the Client role. Add self.ssl (OpenSSLUtils)
for tests that still need to install a cert manually (e.g. AD with no AD CS).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move cert export logic from ADCertificateAuthority to ADHost so topology
controllers can access it directly without going through role fixtures.

ADCertificateAuthority._get_ca_config() and get_ca_cert() now delegate
to self.host, keeping the role-level API unchanged.

ADTopologyController gains an ADHost cert install branch with two-level
fallback: ADCS/PowerShell first, then openssl s_client, so cert install
works regardless of whether Windows Certificate Services is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- utils/tools: make install_ca_cert idempotent; add fs.backup() for
  ldap.conf; replace conn.run cat with fs.exists/fs.read
- topology_controllers: check client before fetching cert to skip
  redundant SSH round-trips; name certs by topology (ipa-ca.crt,
  samba-ca.crt, ad-ca.crt); replace conn.run cat with fs.exists/fs.read

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@spoore1 spoore1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still LGTM after the comment updates.

@sumit-bose sumit-bose left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

still ACK, although I still think that related parts of the patches can be squashed together.

bye,
Sumit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants