ldap

python-ldap creating a group returns "already exists" (in an empty OU and non existent sAMAccountName)

python-ldap creating a group returns "already exists" (in an empty OU and non existent sAMAccountName) Question: I set my ldap vars: ldap_server = "ldaps://server:636" ldap_username = "sec-admin@server" ldap_pw = "<pw>" dn = ‘OU=ou1,OU=ou2,OU=ou3,OU=ou4,DC=dc1,DC=dc2,DC=dc3,DC=com’ and successfully connect to the server: import sys import ldap import ldap.modlist as modlist try: ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) l = ldap.initialize(ldap_server) l.set_option(ldap.OPT_REFERRALS, 0) …

Total answers: 1

How to safely authenticate a user using LDAP?

How to safely authenticate a user using LDAP? Question: For context: I am developing a web application where users need to authenticate to view internal documents. I neither need any detailed info on users nor special permission management, two states are sufficient: Either a session belongs to an authenticated user (→ documents can be accessed) …

Total answers: 1

ldap3 extend.microsoft.modify_password keeps returning false

ldap3 extend.microsoft.modify_password keeps returning false Question: I’m trying to modify an user account password in but it doesn’t work, I’ve tried it directly in AD and it does work. I’m using ldap3 to do it, here’s the steps I do. First I do the app operation like this from ldap3 import Server, Connection, ALL s …

Total answers: 2

Can returned attributes be forced into lowercase

Can returned attributes be forced into lowercase Question: Changes on our LDAP Server have changed the case of the attributes returned from search. For example, "mailroutingaddress" is now "mailRoutingAddress". The searches themselves are case insensitive, but the python code processing the returned ldap object is attempting to reference attributes in all lower case and failing. …

Total answers: 2

This script gives all the users data (eg. given output) but I want to fetch specific user's uid, uidnumber, mail, employeenumber. How do I do that?

This script gives all the users data (eg. given output) but I want to fetch specific user's uid, uidnumber, mail, employeenumber. How do I do that? Question: What I should I do to get users uid number, mail, employeenumber? from ldap3 import Server, Connection # clear connection my_server = ‘XXX’ my_user = ‘uid=idmsa,ou=People,ou=auth,o=csun’ my_password = …

Total answers: 2

LDAP Filter Syntax

LDAP Filter Syntax Question: I am using python library ldap3 to send requests to the servers to query user objects that are not disabled and have a display name or email that contains the user input: query = "(&(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(|(displayName={0}*)(mail={0}*))".format(value) I followed what I think the documentation says about forming LDAP filters, but I am getting …

Total answers: 2

Authenticate with Flask-LDAP3-Login based on group membership

Authenticate with Flask-LDAP3-Login based on group membership Question: 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 whether they are a member of a specific group? I see the docs mention …

Total answers: 3

LDAP search with username as variable

LDAP search with username as variable Question: I am using the Python-LDAP module and trying to make a query on the logged in user. The username will be passed into the query. When I simply type the username in as a string my results come out correctly. But if I try to pass the (username) …

Total answers: 4

How should I escape ldap special characters?

How should I escape ldap special characters? Question: I’m using python-ldap to query Active Directory I have this DN CN=Whalen, Sean,OU=Users,OU=Users and Groups,DC=example,DC=net That works fine as a base in a query, but if I try to use it in a search filter like this (&(objectClass=group)(memberof:1.2.840.113556.1.4.1941:=CN=Whalen, Sean,OU=Users,OU=Users and Groups,DC=example,DC=net)) I get a Bad search filter …

Total answers: 2