Univention Bugzilla – Bug 50575
Python3: we need python3-smbpasswd
Last modified: 2021-05-25 16:03:22 CEST
There is no python3-smbpasswd package in debian yet. https://packages.debian.org/de/source/sid/python-smbpasswd The bug report for the deprecation of python 2 is: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938176 python-smbpasswd is only used by python-univention-directory-manager: management/univention-directory-manager-modules/modules/univention/admin/password.py:import smbpasswd management/univention-directory-manager-modules/modules/univention/admin/password.py: nt = smbpasswd.nthash(password) management/univention-directory-manager-modules/modules/univention/admin/password.py: lm = smbpasswd.lmhash(password)
Maybe we can replace this by python-samba methods? >>> from samba import credentials >>> creds = credentials.Credentials() >>> creds.set_password("S3CreT") True >>> creds.get_nt_hash() '\x84_z\xc5\x0b\xcc\xdb\xb4\x91\xa2WQGx%C' No luck for LM hash though.
Created attachment 10241 [details] patch
The package is build in the python3-scope. Patches are: python-smbpasswd/4.4-0-0-ucs/1.0.1-1.3-python3/0001-remove-trailing-whitespace.patch python-smbpasswd/4.4-0-0-ucs/1.0.1-1.3-python3/0002-Migrate-to-Python-3-compatibility.patch python-smbpasswd/4.4-0-0-ucs/1.0.1-1.3-python3/0003-Add-python3-smbpasswd-package.patch
Applied the patches for UCS 5.0: r18965 | Bug #50575: Add patches Package: python-smbpasswd Version: 1.0.1-1.3A~5.0.0.202006041505
OK: diff -ur python-smbpasswd/5.0-0-0-ucs/1.0.1-1.3 python-smbpasswd/4.4-0-0-ucs/1.0.1-1.3-python3 OK: # SELECT * FROM binpkg WHERE major=5 AND site='apt' AND srcpkg='python-smbpasswd'; binpkg | binver | arch | srcpkg | srcver | major | minor | patch | scope | site | maintained | id --------------------------+-------------------------------+-------+------------------+-------------------------------+-------+-------+-------+-------+------+------------+---------- python-smbpasswd-dbgsym | 1.0.1-1.3A~5.0.0.202006041505 | amd64 | python-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | 5 | 0 | 0 | | apt | | 17755223 python-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | amd64 | python-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | 5 | 0 | 0 | | apt | | 17755224 python3-smbpasswd-dbgsym | 1.0.1-1.3A~5.0.0.202006041505 | amd64 | python-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | 5 | 0 | 0 | | apt | | 17755225 python3-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | amd64 | python-smbpasswd | 1.0.1-1.3A~5.0.0.202006041505 | 5 | 0 | 0 | | apt | | 17755226 (4 Zeilen) OK: python -m univention.repong.dchdiff -l 1 amd64/python3-smbpasswd_1.0.1-1.3A~5.0.0.202006041505_amd64.deb OK: apt install -t apt python3-smbpasswd python3 -c 'import smbpasswd;print(smbpasswd.nthash("S3CreT"), smbpasswd.lmhash("S3CreT"))' python2 -c 'import smbpasswd;print(smbpasswd.nthash("S3CreT"), smbpasswd.lmhash("S3CreT"))'
We could instead also migrate the code to python{,3}-passlib: >>> import smbpasswd >>> smbpasswd.nthash('foobar') 'BAAC3929FABC9E6DCD32421BA94A84D4' >>> smbpasswd.lmhash('foobar') 'D85774CF671A9947AAD3B435B51404EE' >>> passlib.hash.nthash.hash('foobar').upper() 'BAAC3929FABC9E6DCD32421BA94A84D4' >>> passlib.hash.lmhash.hash('foobar').upper() 'D85774CF671A9947AAD3B435B51404EE'
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".