Skip to content

python-common/cryptotools: stop using the removed X509Req API - #69446

Merged
batrick merged 1 commit into
ceph:mainfrom
tchaikov:wip-cryptotools-x509req
Jun 15, 2026
Merged

batrick merged 1 commit into
ceph:mainfrom
tchaikov:wip-cryptotools-x509req

Conversation

@tchaikov

@tchaikov tchaikov commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

pyOpenSSL deprecated OpenSSL.crypto.X509Req in 24.2.0 (2024-07-20) and removed it in 26.3.0 (2026-06-12). as we don't pin pyopenssl, CI picked up the new release, and create_self_signed_cert() started failing with:

  AttributeError: module 'OpenSSL.crypto' has no attribute 'X509Req'

this took down run-tox-mgr, run-tox-mgr-dashboard-py3 and the mypy check.

we only used X509Req to build a subject name and then copied it into the X509 cert. so drop it, and set the subject on the cert directly. the resulting cert stays the same: subject from dname, issuer set to the same subject, self-signed.

Fixes: https://tracker.ceph.com/issues/77391

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@tchaikov
tchaikov requested a review from a team as a code owner June 13, 2026 02:02
@tchaikov
tchaikov requested a review from phlogistonjohn June 13, 2026 02:03
pyOpenSSL deprecated OpenSSL.crypto.X509Req in 24.2.0 (2024-07-20) and
removed it in 26.3.0 (2026-06-12). as we don't pin pyopenssl, CI picked
up the new release, and create_self_signed_cert() started failing with:

  AttributeError: module 'OpenSSL.crypto' has no attribute 'X509Req'

this took down run-tox-mgr, run-tox-mgr-dashboard-py3 and the mypy check.

we only used X509Req to build a subject name and then copied it into the
X509 cert. so drop it, and set the subject on the cert directly. the
resulting cert stays the same: subject from dname, issuer set to the same
subject, self-signed.

Fixes: https://tracker.ceph.com/issues/77391
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov force-pushed the wip-cryptotools-x509req branch from c023663 to 1dda56b Compare June 13, 2026 02:06
@tchaikov

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@tchaikov

Copy link
Copy Markdown
Contributor Author

this is a minimal fix. i also have a follow-up change which migrates pyOpenSSL to cryptography, as there are more warnings from pyOpenSSL:

tests/test_tls.py::TLSchecks::test_specific_dname
  /ceph/src/python-common/ceph/cryptotools/internal.py:40: DeprecationWarning: PKey.generate_key is deprecated. You should use the key generation APIs in cryptography instead.
    pkey.generate_key(crypto.TYPE_RSA, 2048)

tests/test_tls.py::TLSchecks::test_defaults
tests/test_tls.py::TLSchecks::test_invalid_key
tests/test_tls.py::TLSchecks::test_mismatched_tls
tests/test_tls.py::TLSchecks::test_specific_dname
  /ceph/src/python-common/ceph/cryptotools/internal.py:41: DeprecationWarning: dump_privatekey is deprecated. You should use the APIs in cryptography.
    return crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey).decode()

see https://jenkins.ceph.com/job/ceph-pull-requests/185291/console

@tchaikov

Copy link
Copy Markdown
Contributor Author

@phlogistonjohn hi John, could you help review this change? the make check started failing recently, and i believe this change should address it.

@phlogistonjohn phlogistonjohn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Wish I had seen this sooner. :-)

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tchaikov to the rescue!

@batrick
batrick merged commit cf5b149 into ceph:main Jun 15, 2026
17 of 21 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log cf5b149eecfc0a1d2038d667b37d2133ac741c97^..cf5b149eecfc0a1d2038d667b37d2133ac741c97

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/27573531693

@tchaikov
tchaikov deleted the wip-cryptotools-x509req branch June 15, 2026 23:04
@tchaikov

Copy link
Copy Markdown
Contributor Author

this is a minimal fix. i also have a follow-up change which migrates pyOpenSSL to cryptography, as there are more warnings from pyOpenSSL:

tests/test_tls.py::TLSchecks::test_specific_dname
  /ceph/src/python-common/ceph/cryptotools/internal.py:40: DeprecationWarning: PKey.generate_key is deprecated. You should use the key generation APIs in cryptography instead.
    pkey.generate_key(crypto.TYPE_RSA, 2048)

tests/test_tls.py::TLSchecks::test_defaults
tests/test_tls.py::TLSchecks::test_invalid_key
tests/test_tls.py::TLSchecks::test_mismatched_tls
tests/test_tls.py::TLSchecks::test_specific_dname
  /ceph/src/python-common/ceph/cryptotools/internal.py:41: DeprecationWarning: dump_privatekey is deprecated. You should use the APIs in cryptography.
    return crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey).decode()

see https://jenkins.ceph.com/job/ceph-pull-requests/185291/console

created #69510

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants