Questions tagged [ldap3]
164 questions
0
votes
2 answers
django-environ - Managing LDAP DN in .env
I have a django web app, with a middleware that intercepts incoming requests, extracts user details (added to header by upstream middleware) in the request header, and checks if user is authorized to access the page if user is member of a…

Honhonhon
- 21
- 5
0
votes
1 answer
Python LDAP3 invalid class in objectClass attribute: group
First of all, the documentation and examples are so bad, please explain for simple people, like me. Rant over.
I am trying to access my organizations ldap server. Ive tried python-ldap, but i ran into issues, where it decodes and encodes responses…

Taavi Ansper
- 143
- 9
0
votes
1 answer
Python Mock patch ldap3 search response
I am trying to mock the below function but I'm not sure how to mock the Connection response:
def get_user_res(user, pass):
res = None
server = Server('my_server')
connnection = Connection(server, user, pass, strategy=SAFE_SYNC,…

Incognito
- 135
- 4
- 14
0
votes
2 answers
How to list own Active Directory group memberships with Python LDAP3?
I log in to Active Directory, then I want to list my own group memberships with Python ldap3 library.
server = Server('server.company.local', get_info=ALL)
conn = Connection(server, user="company\\user", password="password", authentication=NTLM,…

Deer
- 131
- 1
- 7
0
votes
1 answer
ldap3.MODIFY_REPLACE single quotes ( ' )
I have written a Python script and I am using ldap3 module ( https://pypi.org/project/ldap3/) to add,modify attribute value in Oracle ldap.
I am able to modify ldap attribute values that don't have a single quote in it. However some users they have…

vnode12
- 1
- 1
0
votes
1 answer
Using python ldap3, getting memberof by userid
Can someone help me out with a search for memberof by cn = 'userid' ?
this is what I have so far:
c.search( search_base='DC=ms,DC=ds,DC=company,DC=com',
search_filter='(CN=userid)',
search_scope='SUBTREE',
…

Aron Spiess
- 3
- 2
0
votes
0 answers
Python ldap3 Datetime
I'm sending dates to LDAP via Python2/ldap3:
Egress to LDAP (389DS): 20190731000000Z
However, when read from LDAP via Python3/ldap3:
Ingress from LDAP (389DS): 2019-07-31 00:00:00+00:00
In LDAP the EQUALITY is generalizedTimeMatch.
What could be…

user353829
- 1,244
- 5
- 25
- 38
0
votes
1 answer
Get "memberOf" in LDAP3 search for a specific user
I have an example result from LDAP like this:
USERID123, Users, UserProvisioning, Production, ztb.icb.company.com
dn: CN=USERID123, ,OU=Users,OU=UserProvisioning,OU=Production,DC=ztb,DC=icb,DC=company,DC=com
objectClass: top
objectClass:…

JohnDole
- 525
- 5
- 16
0
votes
1 answer
Update LDAP attribute in AD with Python
When I try to update an Active Directory attribute with this code:
dn = (
"CN=user_ldap,OU=dept_name,OU=Application,"
"OU=Service Accounts,OU=Domain Users,DC=company-corp,DC=global"
)
# define the server
server = ldap3.Server(
…

daquezada
- 1,017
- 2
- 10
- 15
0
votes
1 answer
Python ldap3 how to get all attributes plus sAMAccountName
class LDAPAPI(object):
....
def __init__(self, host, user, password, connection_timeout=10):
"""Sets up a connection to AD, ready to be queried by any
methods in the class.
"""
self.server = ldap3.Server(
…

James Lin
- 25,028
- 36
- 133
- 233
0
votes
1 answer
LDAP filter with ldap3 library not working
I am trying to retrieve information from a user from LDAP with the following Python code snippet.
I am using the ldap3 library to query LDAP.
def searchUser():
server = Server('myLdapServer:389')
try:
with Connection(server) as…

Kai78
- 47
- 1
- 6
0
votes
1 answer
enable ad user using python ldap3 getting error unwillingToPerform with 0000052D: SvcErr: DSID-031A12D2, problem 5003 (WILL_NOT_PERFORM)
While enabling user using ldap3 library in python with below code, getting error as mentioned below
connection to AD
server_ip = "192.xxx.0.145"
admin_username = "Domain\\Administrator"
admin_password = "Password"
ad_server = Server(server_ip,…

Akash senta
- 483
- 7
- 16
0
votes
1 answer
ldap3 add user to group after conn.search
currently, I am writing an AWS Lambda function and the idea is, that someone can send an email to a specific address with a username and AD group and it will trigger the function and add this person to the desired group.
I am using the python module…

Lamora
- 11
- 5
0
votes
1 answer
Why is LDAP_MATCHING_RULE_IN_CHAIN or 1.2.840.113556.1.4.1941 giving blank results for AD user's recursive groups?
Tried with below ldap queries.
ldap_query = "(&(objectCategory=Person)(objectClass=user)(member:1.2.840.113556.1.4.1941:=CN=xx,CN=Users,DC=aa,DC=ss,DC=com))"
ldap_query = "(member:1.2.840.113556.1.4.1941:=CN=xx,CN=Users,DC=aa,DC=ss,DC=com)"
Code is…

SmiP
- 155
- 2
- 2
- 16
0
votes
1 answer
ldap3 bind failed when CN and DisplayName are different
I'm new to python LDAP and need to do a search in LDAP, but
When the user's CN and DisplayName are different, I can only connect with Domain\user.
See below:
ldap3.Connection(s, user=user_cn, .... Failed,
ldap3.Connection(s, user=user_domain,…

C.K.
- 4,348
- 29
- 43