You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tools/rotate-password.py fails on Python 3.13 (crypt removed) #311
Python 3.13 removed the crypt module from the standard library (PEP 594, What's New in 3.13). tools/rotate-password.py imports it on line 20, so on a 3.13 host the script stops before reading the password.
Running the file from a copy of the current tree in Docker with no network, with a two-line shadow file and the password on stdin:
python:3.12-slim DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
root:$6$...:20753:0:99999:7:::
user:*:1:0:99999:7:::
python:3.13-slim ModuleNotFoundError: No module named 'crypt'
There is no drop-in replacement in the standard library, so the fix needs a choice. Two options I can see:
Call openssl passwd -6 -stdin, which produces the same $6$ SHA-512-crypt format that crypt.mksalt() picks by default. On python:3.12-slim a hash made this way passed crypt.crypt(password, hash) == hash, so glibc accepts it.
Depend on crypt-r, a copy of the removed module, and change only the import. I have not installed it here.
I have not tried either option against a real BMC image, only the script itself with a sample shadow file. Happy to send a PR for whichever you prefer.
Activity