Questions tagged [ldap3]
164 questions
3
votes
2 answers
How to prevent LDAP-injection in ldap3 for python3
I'm writing some python3 code using the ldap3 library and I'm trying to prevent LDAP-injection. The OWASP injection-prevention cheat sheet recommends using a safe/parameterized API(among other things). However, I can't find a safe API or safe method…

John Devitt
- 690
- 2
- 8
- 22
3
votes
1 answer
Authenticate through AD/LDAP
I don't know much about AD and LDAP, but trying to implement the most trivial LDAP/AD login function in Python. Lo luck so far though I tested several different modules. The most promising one might be ldap3:
>>> import ldap3
>>> server =…

Jonas Byström
- 25,316
- 23
- 100
- 147
3
votes
2 answers
authentication django app with ldap3
I have problem with authentication users in my django app. I am using Python 3.5 and Django 1.10.
I wrote simple bind configuration to check if user is realy user from database:
username = request.POST['username']
password =…

Grzegorz Redlicki
- 269
- 1
- 6
- 15
3
votes
1 answer
How to create a new objectClass in LDAP3?
I'm trying to add entries into a 'policy' container I've created like so:
ldap_connection.add('OU=Policy, DC=BERT, DC=LOCAL', 'organizationalUnit'))
and can't find any good documentation on how to create a new objectClass to accommodate these…

Stefan
- 51
- 1
- 4
3
votes
1 answer
Changing userPassword in OpenLDAP using ldap3 library
I can't seem to change a users password using the ldap3 python module against an OpenLDAP server. A similar question has been asked before but that's specific to Active Directory.
What I've tried:
from ldap3.extend.standard.modifyPassword import…

Josh Smeaton
- 47,939
- 24
- 129
- 164
2
votes
2 answers
How to use Python ldap3 Kerberos authentication on Linux without editing any config files?
How can I log into an LDAP server with a Kerberos username and password without making any changes to the configuration of the computer that the Python script is running on? The ldap3 documentation assumes that Kerberos has already been set up by…

Alex Henrie
- 744
- 1
- 6
- 17
2
votes
1 answer
Getting invalidCredentials for connection.bind in LDAP3
I'm trying to write python code which will use LDAP module to validate LDAP connection:
import configuration
from ldap3 import Server, Connection, SIMPLE, SYNC, ALL
server = Server(configuration.LDAP_SERVER, port=XXXX, get_info=ALL)
c =…

A. Man
- 337
- 3
- 14
2
votes
1 answer
How to Manage GroupPoliciy using ldap3 library in python?
I have trouble to manage the AD Server group policy with the ldap3 library.
For example, I'm adding New-GPLink policy. I have tried to add an attribute [New-GPLink:[LinkEnabled]] but getting an error.
Please suggest me below points with ldap3:…

Ankit Goswami
- 31
- 3
2
votes
0 answers
Mocking a LDAP Server in Python (ldap3)
I am currently trying to mock the LDAP server we are using in the company. For connections to it in our web app we use python ldap3, so I decided to use the mocking feature of ldap3 (which is documented here:…

Gergan Zhekov
- 944
- 1
- 8
- 27
2
votes
1 answer
Unable to reset AD User password using python
I am working on project which requires me to reset AD User password. But I have not found useful resources so far in the web.
I am using ldap3 to reset AD User password but it's not working.
I have visited these links to get some idea to implement…

vbhosale
- 76
- 7
2
votes
1 answer
Python ldap3 create group
I am new to python and the ldap3 module. However I want to create a AD group in a specific OU. How can this be done?
# import class and constants
from ldap3 import Server, Connection, ALL
# define the server
s = Server('servername', get_info=ALL) …

user3270211
- 915
- 4
- 20
- 42
2
votes
0 answers
Mocking with ldap3: TypeError: 'NotImplementedType' object is not callable
I'm trying to run the example for mocking with ldap3 from the documentation:
$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ldap3…

loris
- 450
- 8
- 20
2
votes
1 answer
python 3.7 and ldap3 reading group membership
I am using Python 3.7 and ldap3. I can make a connection and retrieve a list of the groups in which I am interested. I am having trouble getting group members though.
server = Server('ldaps.ad.company.com', use_ssl=True, get_info=ALL)
with…

7 Reeds
- 2,419
- 3
- 32
- 64
2
votes
1 answer
Allow AD users to change their own passwords using Python ldap3
I am using Python ldap3[1] to build an API that allows users to change their Microsoft Active Directory passwords using their current credentials.
This is what my API is doing:
1- Create LDAP connect and bind to LDAP server:
tls_config =…

RonaDona
- 912
- 6
- 13
- 30
2
votes
0 answers
Python LDAP3 Search in multiple search_base at once
I have a code like this:
from ldap3 import Server, Connection
uri = 'ldaps://ca1.ad.xxx.com:123'
bind_user = 'CN=svc_bind_user,OU=Service Accounts,DC=subdomain1,DC=ad,DC=xxx,DC=com'
bind_password = 'svc_bind_p4$$'
server = Server(uri)
conn =…

Zac
- 175
- 1
- 3
- 9