cgwire / zou

Zou is the Kitsu API. It allows you to store and manage your production data
https://zou.cg-wire.com
GNU Affero General Public License v3.0
170 stars 104 forks source link

Error login with LDAP #874

Closed dinhthang1987 closed 2 weeks ago

dinhthang1987 commented 1 month ago

Context

Studio name: SPX Zou version: 0.19.59 Zou installation type: self-hosted

Describe the bug When I try to log in with LDAP config. Then, I can not log in

Additional context `[2024-10-18 03:40:41,256] ERROR in resources: unsupported hash type MD4 Traceback (most recent call last): File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/utils/ntlm.py", line 500, in ntowf_v2 from Crypto.Hash import MD4 # try with the Crypto library if present ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'Crypto'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/zou/zouenv/lib/python3.12/site-packages/zou/app/blueprints/auth/resources.py", line 182, in post user = auth_service.check_auth( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/zou/app/services/auth_service.py", line 86, in check_auth ldap_auth_strategy(person, password, app) File "/opt/zou/zouenv/lib/python3.12/site-packages/zou/app/services/auth_service.py", line 193, in ldap_auth_strategy conn.bind() File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/core/connection.py", line 628, in bind response = self.do_ntlm_bind(controls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/core/connection.py", line 1394, in do_ntlm_bind request = bind_operation(self.version, 'SICILY_RESPONSE_NTLM', ntlm_client, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/operation/bind.py", line 81, in bind_operation server_creds = name.create_authenticate_message() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/utils/ntlm.py", line 379, in create_authenticate_message nt_challenge_response = self.compute_nt_response() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/utils/ntlm.py", line 485, in compute_nt_response response_key_nt = self.ntowf_v2() ^^^^^^^^^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/utils/ntlm.py", line 503, in ntowf_v2 raise e # raise original exception ^^^^^^^ File "/opt/zou/zouenv/lib/python3.12/site-packages/ldap3/utils/ntlm.py", line 497, in ntowf_v2 password_digest = hashlib.new('MD4', self._password.encode('utf-16-le')).digest() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/hashlib.py", line 166, in __hash_new return get_builtin_constructor(name)(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/hashlib.py", line 123, in get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type MD4`

dinhthang1987 commented 1 month ago

I resolved by : pip install pycryptodome

frankrousseau commented 2 weeks ago

Great thank you for the update and I'm glad that it now works.