myOmikron / mailcow-ldap-sync

26 stars 2 forks source link

Not syncing with ldap/Windows AD Server #19

Open Fernien opened 1 year ago

Fernien commented 1 year ago

I filled the config.json but when i try to do the sync i run into an error. This is the config (Some parts censored)

{
  "ldap": {
    "uri": "ldap://server01.example.local",
    "allow_self_signed": true,
    "bind_dn": "CN=Administrator,CN=Users,DC=example,DC=local",
    "bind_pw": "SecretPassWith!",
    "user_search_base": "CN=Users,DC=example,DC=local",
    "user_search_filter": "",
    "user_mapping": {
      "mail": "mail",
      "firstname": "givenName",
      "lastname": "sn",
      "password": "userPassword",
      "quota": "MailQuota",
      "active": "yes",
      "tls_enforce_in": "true",
      "tls_enforce_out": "true"
    }
  },
  "mailcow_host": "mail.example.de",
  "mailcow_api_key": "XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX"
}

and this is the error message:

python3 main.py
/root/mailcow-ldap-sync/mailcow_ldap_sync/main.py:361: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  Base = declarative_base()
Traceback (most recent call last):
  File "/root/mailcow-ldap-sync/mailcow_ldap_sync/main.py", line 381, in <module>
    main(
  File "/root/mailcow-ldap-sync/mailcow_ldap_sync/main.py", line 40, in main
    results = ldap_conn.search_s(
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 631, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 625, in search_ext_s
    return self.result(msgid,all=1,timeout=timeout)[1]
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 535, in result
    resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 539, in result2
    resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout)
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 543, in result3
    resp_type, resp_data, resp_msgid, decoded_resp_ctrls, retoid, retval = self.result4(
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 553, in result4
    ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
  File "/usr/local/lib/python3.9/dist-packages/ldap/ldapobject.py", line 128, in _ldap_call
    result = func(*args,**kwargs)
ldap.PROTOCOL_ERROR: {'result': 2, 'desc': 'Protocol error', 'ctrls': []}

LDAPs returns same error.

myOmikron commented 1 year ago

I sadly don't have access to a Windows AD for testing :/

I'm glad to accept pull requests / help in this regard

hokum13 commented 1 year ago

"user_search_filter": "(objectClass=User)",