Skip to content

[3.11] gh-95231: Disable md5 & crypt modules if FIPS is enabled (GH-94742) #95999

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

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 15, 2022

If kernel fips is enabled, we get permission error upon doing
import crypt. So, if kernel fips is enabled, disable the
unallowed hashing methods.

Python 3.9.1 (default, May 10 2022, 11:36:26)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import crypt
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.9/crypt.py", line 117, in
_add_method('MD5', '1', 8, 34)
File "/usr/lib/python3.9/crypt.py", line 94, in _add_method
result = crypt('', salt)
File "/usr/lib/python3.9/crypt.py", line 82, in crypt
return _crypt.crypt(word, salt)
PermissionError: [Errno 1] Operation not permitted

Signed-off-by: Shreenidhi Shedi [email protected]
(cherry picked from commit 2fa03b1)

Co-authored-by: Shreenidhi Shedi [email protected]

…nGH-94742)

If kernel fips is enabled, we get permission error upon doing
`import crypt`. So, if kernel fips is enabled, disable the
unallowed hashing methods.

Python 3.9.1 (default, May 10 2022, 11:36:26)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/crypt.py", line 117, in <module>
    _add_method('MD5', '1', 8, 34)
  File "/usr/lib/python3.9/crypt.py", line 94, in _add_method
    result = crypt('', salt)
  File "/usr/lib/python3.9/crypt.py", line 82, in crypt
    return _crypt.crypt(word, salt)
PermissionError: [Errno 1] Operation not permitted

Signed-off-by: Shreenidhi Shedi <[email protected]>
(cherry picked from commit 2fa03b1)

Co-authored-by: Shreenidhi Shedi <[email protected]>
@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@tiran tiran requested a review from pablogsal August 15, 2022 14:49
@tiran
Copy link
Member

tiran commented Aug 15, 2022

@pablogsal Do you want the fix in 3.11.0 or should we wait until 3.11.1? Or keep it 3.12-only?

@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@pablogsal
Copy link
Member

@pablogsal Do you want the fix in 3.11.0 or should we wait until 3.11.1? Or keep it 3.12-only?

I think this is ok for 3.11.0 👍

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 this pull request may close these issues.

5 participants