Skip to content

crypt module fails to import in FIPS mode #95231

Closed

Description

@sshedi

Bug report

If kernel fips is enabled, we get permission error upon doing import crypt.

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

Your environment

VMware Photon OS 4.0
x86_64 machine
Python-3.9.1
Kernel fips is enabled

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Jul 25, 2022
  2. sshedi commented on Jul 25, 2022

    @sshedi
    ContributorAuthor

    Tried to fix it here: #94742

  3. changed the title [-]`import crypto` fails in kernel fips enabled machines[/-] [+]crypt module fails to import in FIPS mode[/+] on Jul 25, 2022
  4. tiran commented on Jul 25, 2022

    @tiran
    Member

    I have updated ticket to use the correct module name crypt instead of crypto.

  5. added
    stdlibStandard Library Python modules in the Lib/ directory
    triagedThe issue has been accepted as valid by a triager.
    on Jul 25, 2022
  6. added
    3.11only security fixes
    3.12only security fixes
    on Jul 25, 2022
  7. added 4 commits that reference this issue on Aug 15, 2022
  8. erlend-aasland commented on Aug 15, 2022

    @erlend-aasland
    Contributor
  9. added a commit that references this issue on Aug 30, 2022
  10. ArcticSnowman commented on Nov 18, 2022

    @ArcticSnowman

    @erlend-aasland Given this is a security issue, surely this change should be added to 3.7 to 3.9?

  11. erlend-aasland commented on Nov 22, 2022

    @erlend-aasland
    Contributor

    @erlend-aasland Given this is a security issue, surely this change should be added to 3.7 to 3.9?

    I don't think so. IMO, it is not a security issue; it is just a matter of failing gracefully instead of raising a (possibly) confusing exception.

  12. mixmind commented on May 3, 2024

    @mixmind

    Hi everyone, any chance of backport it to 3.9 too??

  13. erlend-aasland commented on May 3, 2024

    @erlend-aasland
    Contributor

    Hi everyone, any chance of backport it to 3.9 too??

    Unfortunately not; see #95231 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of life3.11only security fixes3.12only security fixesstdlibStandard Library Python modules in the Lib/ directorytriagedThe issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions