Questions tagged [ldap3]
164 questions
15
votes
1 answer
Python3 Convert 'CaseInsensitiveDict' to JSON
I am working on what I assumed would be a simple problem but it has really confused. I am making an AD query in Python using the ldap3 module. This query is returning the data as generator of python dictionaries. When I run the type() command…

Joe
- 2,641
- 5
- 22
- 43
14
votes
2 answers
How to bind (authenticate) a user with ldap3 in python3
I'm trying to update some code to python3, using ldap3 version '0.9.7.4'.
(https://pypi.python.org/pypi/ldap3)
Previously, I used python-ldap with python2 to authenticate a user like this:
import ldap
address = "ldap://HOST:389"
con =…

monkut
- 42,176
- 24
- 124
- 155
7
votes
1 answer
Why can't I import LDAPBindError from LDAP3?
Hi I am trying to import 'LDAPBindError' from the ldap3 library and I am getting an import error. Can somebody please explain why this is not working?
from ldap3 import Server, Connection, ALL, LDAPBindError, SUBTREE,…

user1768233
- 1,409
- 3
- 20
- 28
6
votes
1 answer
Connecting to a dummy ldap3 Active Directory server
I was reading on how to use ldap3 for mocking, and got this:
from ldap3 import Server, Connection, OFFLINE_AD_2012_R2, MOCK_SYNC
mock_server = Server('dummy_ad', get_info=OFFLINE_AD_2012_R2)
mock_conn = Connection(mock_server,…

Jay
- 2,535
- 3
- 32
- 44
5
votes
1 answer
Suppress Python ldap3 search result referrals
I am using the ldap3 module in Python to connect to a local AD domain (on my machine in vbox, Server 2016 domain controller), how can I stop the search results from returning referrals? I've set what I could find in other posts and from the docs but…

DYoung
- 841
- 1
- 6
- 11
4
votes
1 answer
Get user status (disabled or active) in Active Directory with ldap3 Python
I am getting a list of all users in Active Directory and I need to check their status — if the user is active or disabled. I expect that userAccountControl should return user status, but I get only 512 for all users but one (who returns 66048) and…

kiryha
- 183
- 1
- 2
- 14
4
votes
1 answer
LDAP3 Module getting more than 1000 results or alternatives
# import class and constants
from ldap3 import Server, Connection, ALL, SUBTREE
# define the server
s = Server(host='xyz', port=xxxx, use_ssl=True, get_info='ALL')
c = Connection(s, auto_bind='NONE', version=3, authentication='ANONYMOUS',…

Jack
- 300
- 2
- 9
4
votes
1 answer
how to read attributes for given DN in ldap3 (how to search with ldap3 if no filter)
If I already have an LDAP DN, how do I get the attributes for that DN with ldap3.Connection.search()? There is no other search criteria, I already have the DN...
I tried searching for dn attribute, but it returned no objects found. I also tried…

cowbert
- 3,212
- 2
- 25
- 34
4
votes
3 answers
Unable to connect to ldap using django-python3-ldap
I am developing django website and I want to use ldap authontation with my application. I am using Django 1.11 to authenticate with the django-python3-ldap.
I tested the connection to my ldap using ldapsearch and it was succeeded and I got the…

Eyla
- 5,751
- 20
- 71
- 116
4
votes
1 answer
Retrieve a list of all attributes in ldap3 (python3-ldap)
Server is not returning same number of attributes for python-ldap and ldap3 Libraries.
The missing attributes are the one that I have to perform some operations.
This is the sample of the search query I used for ldap3:
from ldap3 import…

Mic
- 345
- 1
- 3
- 9
3
votes
1 answer
Python ldap3 how to get all members of a group
I have tried every solution on Stackoverflow for this and none work.
Using python3 and ldap3 I can make the bind with the user and with the service account and I can even extract the users email address. But I cannot verify that he is from a certain…

sneekers_snak
- 53
- 1
- 6
3
votes
2 answers
How to process ldap3 entries to json or list for further data processing?
I need to get data from a server using LDAP. I'm using ldap3 and am getting all the attributes and responses that I need however, their stuck in the ldap.abstract.entry.entry class. I tried severall methods to get the data into a json or list form…

Christopher Zerbe
- 33
- 1
- 5
3
votes
3 answers
Authenticate with Flask-LDAP3-Login based on group membership
I'm new to Flask and I'm trying out Flask-LDAP3-Login.
I've followed the documentation here and i have it working which is great: https://flask-ldap3-login.readthedocs.io/en/latest/index.html
How would i go about authenticating a user based on…

br0cky
- 223
- 3
- 11
3
votes
1 answer
unable to get ldap server details python3
I am getting none as output for below code
from ldap3 import Server, Connection, ALL, NTLM
server = Server('servername', get_info=ALL)
conn = Connection(server, user="uname", password="pwd", authentication=NTLM)
print(server.info)

Amruth
- 77
- 2
- 7
3
votes
1 answer
Unable to modify 'cn' attribute via ldap3 module, Python 3.x
I'm trying to modify 'cn' attribute of a user in Active Directory domain but
it fails. Also I can't add add this attribute during the user creation process.
It shows this error:
{'result': 67, 'description': 'notAllowedOnRDN', 'dn': '', 'message':…

Anton Belov
- 83
- 1
- 12