New in version 2016.3.0.
This is an alternative to the ldap
interface provided by the ldapmod
execution module.
depends: |
|
---|
salt.modules.ldap3.
LDAPError
(message, cause=None)
Base class of all LDAP exceptions raised by backends.
This is only used for errors encountered while interacting with the LDAP server; usage errors (e.g., invalid backend name) will have a different type.
Variables: | cause -- backend exception object, if applicable |
---|
Add an entry to an LDAP database.
Parameters: |
|
---|---|
Returns: |
|
CLI example:
salt '*' ldap3.add "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'password': 'secret', }, }" "dn='dc=example,dc=com'" "attributes={'example': 'values'}"
Modify an entry in an LDAP database.
This does the same thing as modify()
, but with a simpler interface. Instead of taking a list of directives, it takes a before and after view of an entry, determines the differences between the two, computes the directives, and executes them.
Any attribute value present in before
but missing in after
is deleted. Any attribute value present in after
but missing in before
is added. Any attribute value in the database that is not mentioned in either before
or after
is not altered. Any attribute value that is present in both before
and after
is ignored, regardless of whether that attribute value exists in the database.
Parameters: |
|
---|---|
Returns: |
|
CLI example:
salt '*' ldap3.change "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'password': 'secret'} }" dn='cn=admin,dc=example,dc=com' before="{'example_value': 'before_val'}" after="{'example_value': 'after_val'}"
Connect and optionally bind to an LDAP server.
Parameters: |
connect_spec -- This can be an LDAP connection object returned by a previous call to
|
---|---|
Returns: | an object representing an LDAP connection that can be used as the connect_spec argument to any of the functions in this module (to avoid the overhead of making and terminating multiple connections).This object should be used as a context manager. It is safe to nest |
CLI example:
salt '*' ldap3.connect "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'dn': 'cn=admin,dc=example,dc=com', 'password': 'secret'} }"
Delete an entry from an LDAP database.
Parameters: |
|
---|---|
Returns: |
|
CLI example:
salt '*' ldap3.delete "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'password': 'secret'} }" dn='cn=admin,dc=example,dc=com'
Modify an entry in an LDAP database.
Parameters: |
|
---|---|
Returns: |
|
CLI example:
salt '*' ldap3.modify "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'password': 'secret'} }" dn='cn=admin,dc=example,dc=com' directives="('add', 'example', ['example_val'])"
Search an LDAP database.
Parameters: |
|
---|---|
Returns: |
a dict of results. The dict is empty if there are no results. The dict maps each returned entry's distinguished name to a dict that maps each of the matching attribute names to a list of its values. |
CLI example:
salt '*' ldap3.search "{ 'url': 'ldaps://ldap.example.com/', 'bind': { 'method': 'simple', 'dn': 'cn=admin,dc=example,dc=com', 'password': 'secret', }, }" "base='dc=example,dc=com'"
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.ldap3.html