Skip to content

iredadmin RuntimeError: cryptography module missing #300

@zod076

Description

@zod076

REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER:

  • iRedMail version (check /etc/iredmail-release): 1.7.4
  • Deployed with iRedMail Easy or the downloadable installer? Installer
  • Linux/BSD distribution name and version: FreeBSD 14.3-RELEASE-p7 amd64
  • Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
  • Web server (Apache or Nginx): Nginx
  • Manage mail accounts with iRedAdmin-Pro? No
  • [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

When accessing https://domain.com/iredadmin, it reports that the Python module crytography is missing even though it is installed and available. It also sends the log to Postmaster. Here's the log:-

Subject: bug: <class 'RuntimeError'>: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods (/)

Traceback (most recent call last):
  File "/usr/local/www/iRedAdmin-2.6/web/application.py", line 275, in process
    return p(lambda: process(processors))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/www/iRedAdmin-2.6/web/session.py", line 96, in _processor
    self._cleanup()
  File "/usr/local/www/iRedAdmin-2.6/web/session.py", line 197, in _cleanup
    self.store.cleanup(timeout)
  File "/usr/local/www/iRedAdmin-2.6/web/session.py", line 373, in cleanup
    self.db.delete(self.table, where="$last_allowed_time > atime", vars=locals())
  File "/usr/local/www/iRedAdmin-2.6/web/db.py", line 1154, in delete
    db_cursor = self._db_cursor()
                ^^^^^^^^^^^^^^^^^
  File "/usr/local/www/iRedAdmin-2.6/web/db.py", line 723, in _db_cursor
    return self.ctx.db.cursor()
           ^^^^^^^^
  File "/usr/local/www/iRedAdmin-2.6/web/db.py", line 661, in _getctx
    self._load_context(self._ctx)
  File "/usr/local/www/iRedAdmin-2.6/web/db.py", line 673, in _load_context
    ctx.db = self._connect(self.keywords)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/www/iRedAdmin-2.6/web/db.py", line 701, in _connect
    return self.db_module.connect(**keywords)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pymysql/connections.py", line 353, in __init__
    self.connect()
  File "/usr/local/lib/python3.11/site-packages/pymysql/connections.py", line 633, in connect
    self._request_authentication()
  File "/usr/local/lib/python3.11/site-packages/pymysql/connections.py", line 932, in _request_authentication
    auth_packet = _auth.caching_sha2_password_auth(self, auth_packet)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pymysql/_auth.py", line 265, in caching_sha2_password_auth
    data = sha2_rsa_encrypt(conn.password, conn.salt, conn.server_public_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pymysql/_auth.py", line 143, in sha2_rsa_encrypt
    raise RuntimeError(
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

Checks to determine if the module is installed..

[root@overlord /usr/local/www/iredadmin]# pkg info py311-cryptography | head -1
py311-cryptography-44.0.3_3,1

[root@overlord /usr/local/www/iredadmin]# pip show cryptography
Name: cryptography
Version: 44.0.3
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page: 
Author: 
Author-email: The Python Cryptographic Authority and individual contributors <cryptography-dev@python.org>
License: Apache-2.0 OR BSD-3-Clause
Location: /usr/local/lib/python3.11/site-packages
Requires: cffi
Required-by: acme, aioquic, certbot, josepy, pyOpenSSL, service-identity

[root@overlord /usr/local/www/iredadmin]# ls -ld /usr/local/lib/python3.11/site-packages/cryptography*
drwxr-xr-x  5 root wheel 512 Jan  5 01:31 /usr/local/lib/python3.11/site-packages/cryptography
drwxr-xr-x  3 root wheel 512 Jan  5 01:31 /usr/local/lib/python3.11/site-packages/cryptography-44.0.3.dist-info

Right now it displays internal server error message when visiting /iredadmin

Update:
iRedMail is running in a FreeBSD jail. Right now the error message went away and it displays the iredadmin login screen. This always happens when I access it just after the jail starts up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions