Skip to content

ModuleNotFoundError: No module named 'crypt' #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ondrejj opened this issue Jun 16, 2024 · 3 comments · Fixed by #45 or #47
Closed

ModuleNotFoundError: No module named 'crypt' #44

ondrejj opened this issue Jun 16, 2024 · 3 comments · Fixed by #45 or #47

Comments

@ondrejj
Copy link

ondrejj commented Jun 16, 2024

Hello. In python 3.13, crypt module has been removeed. In python 3.12 it's deprecated.

Traceback (most recent call last):                                              
  File "/builddir/build/BUILD/python-repoze-who-3.0.0-build/repoze.who-3.0.0/rep
oze/who/plugins/tests/test_htpasswd.py", line 116, in test_crypt_check          
    from crypt import crypt                                                     
ModuleNotFoundError: No module named 'crypt'
@mauritsvanrees
Copy link
Member

@ondrejj I made a PR to fix this:
#45

I thought I had write access to this repo, but apparently not, so I did it on a fork.

@tseaver tseaver reopened this Jun 21, 2024
@tseaver
Copy link
Member

tseaver commented Jun 21, 2024

We need to actually replace the use of crypt, at least as an option, and suggest that option in the example middleware config.

@tseaver
Copy link
Member

tseaver commented Jun 21, 2024

Per this Apache 2.4 docs, we should likely be adding support for passwords encrypted using brcrypt's Blowfish algorithm. Candidates:

bcrypt seems to work, e.g.:

$ htpasswd -nbB myName myPassword
myName:$2y$05$yJ9mSHNyzoKAgMEW3sxvau4iXu1h94b37HXwPD.ceGhst1ZirWp2y
>>> import bcrypt
>>> pw = b"myPassword"
>>> hashed = b"$2y$05$yJ9mSHNyzoKAgMEW3sxvau4iXu1h94b37HXwPD.ceGhst1ZirWp2y"
>>> bcrypt.checkpw(pw, hashed)
True

tseaver added a commit that referenced this issue Jul 31, 2024
Point users to 'bcrypt.checkpw' as a better alternative.

Closes #44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants