pythonpython-ldap

python-ldap stronger authentication


I'm trying to make a search in our AD with python-ldap.

When I try to make the:

connect.simple_bind_s('ldap_login', 'ldap_password')

I am getting the error:

ldap.STRONG_AUTH_REQUIRED: {'msgtype': 97, 'msgid': 1, 'result': 8, 'desc': 'Strong(er) authentication required', 'ctrls': [], 'info': '00002028: LdapErr: DSID-0C090276, comment: The server requires binds to turn on integrity checking if SSL\TLS are not already active on the connection, data 0, v2580'}

I am searching since a day and can't find anything serious about this.

I would be very thankfull if anyone could tell me how to authenticate with a stronger authentication. I found something with certificates but this also was only a question and had no answer since ever.

So yeah a little example or a link to a documentation were it's shown how to do this would be great.

Thx


Solution

  • I'm using ldap3 for AD.

    from ldap3 import Server, Connection, SUBTREE, ALL
    def auth(user_id, password):
            try:
                server = Server('domain.name', get_info = None)
                conn = Connection(server, client_strategy = 'ASYNC', user = user_id,
                                  password = password,
                                  check_names = False,
                                  raise_exceptions = False)
    
                status = conn.bind()
                conn.unbind()
            except:
                status = False
            return status