sssd_test_framework.utils.ldap

Direct LDAP access to an LDAP server.

Module Attributes

LDAPRecordAttributes

LDAP Record Attributes dictionary type.

Classes

LDAPUtils(*args, **kwargs)

Methods for direct LDAP access to an LDAP server.

sssd_test_framework.utils.ldap.LDAPRecordAttributes

LDAP Record Attributes dictionary type.

alias of dict[str, Any | list[Any] | None]

class sssd_test_framework.utils.ldap.LDAPUtils(*args, **kwargs)

Bases: MultihostUtility[BaseLDAPDomainHost]

Methods for direct LDAP access to an LDAP server.

Find all MultihostUtility objects in the constructor.

property conn: SimpleLDAPObject

LDAP connection for direct manipulation with the directory server through python-ldap.

Return type:

ldap.ldapobject.LDAPObject

property naming_context: str

Default naming context.

Return type:

str

hash_password(password: str) str

Compute sha256 hash of a password that can be used as a value.

Parameters:

password (str) – Password to hash.

Returns:

Base64 of sha256 hash digest.

Return type:

str

dn(rdn: str, basedn: str | None = None) str

Get distinguished name of an object.

Parameters:
  • rdn (str) – Relative DN.

  • basedn (str | None, optional) – Base DN, defaults to None

Returns:

Distinguished name combined as rdn+dn+naming-context.

Return type:

str

add(dn: str, attrs: dict[str, Any | list[Any] | None]) None

Add an LDAP entry.

Parameters:
  • dn (str) – Distinguished name.

  • attrs (LDAPRecordAttributes) – Attributes, key is attribute name.

delete(dn: str) None

Delete LDAP entry.

Parameters:

dn (str) – Distinguished name.

modify(dn: str, *, add: dict[str, Any | list[Any] | None] | None = None, replace: dict[str, Any | list[Any] | None] | None = None, delete: dict[str, Any | list[Any] | None] | None = None) None

Modify LDAP entry.

Parameters:
  • dn (str) – Distinguished name.

  • add (LDAPRecordAttributes | None, optional) – Attributes to add, defaults to None

  • replace (LDAPRecordAttributes | None, optional) – Attributes to replace, defaults to None

  • delete (LDAPRecordAttributes | None, optional) – Attributes to delete, defaults to None