Skip to content

mgr/dashboard: set MOTD fails on FIPS enabled systems - #70216

Merged
aaSharma14 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78233-main
Jul 21, 2026
Merged

aaSharma14 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78233-main

Conversation

@aaSharma14

@aaSharma14 aaSharma14 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: On FIPS-compliant systems, the OpenSSL provider rejects hashlib.md5() calls that lack the usedforsecurity=False flag, because MD5 is not an approved algorithm for security-sensitive use. This causes the MOTD set command — and the /api/motd create endpoint — to raise a ValueError and crash whenever a new MOTD is saved.

Fix: Pass usedforsecurity=False to hashlib.md5(). This tells the FIPS provider that MD5 is being used only as a non-cryptographic checksum (to detect whether a user has already dismissed a specific MOTD message), which is a legitimate use-case that FIPS allows.

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

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.

@github-project-automation github-project-automation Bot moved this from New to Reviewer approved in Ceph-Dashboard Jul 15, 2026

@afreen23 afreen23 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.

Fix is correct in principle but the implementation adds unnecessary complexity. See inline comments.

@github-project-automation github-project-automation Bot moved this from Reviewer approved to Review in progress in Ceph-Dashboard Jul 15, 2026
@aaSharma14
aaSharma14 force-pushed the fix-78233-main branch 3 times, most recently from f62aa0e to c805e41 Compare July 16, 2026 09:21
@aaSharma14
aaSharma14 requested a review from afreen23 July 16, 2026 09:22

@afreen23 afreen23 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.

Previous feedback addressed. Couple nits inline — fix if you're touching the file anyway.

@github-project-automation github-project-automation Bot moved this from Review in progress to Reviewer approved in Ceph-Dashboard Jul 16, 2026
@aaSharma14
aaSharma14 force-pushed the fix-78233-main branch 2 times, most recently from 3a6d3f8 to 14deacc Compare July 17, 2026 08:01

@afreen23 afreen23 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.

Fix is correct — usedforsecurity=False is the right approach for non-cryptographic MD5 on FIPS systems.

Two things before merge:

  1. No unit test. There's no test_motd.py in src/pybind/mgr/dashboard/tests/. Please add one that calls _set_motd to cover this path and prevent regressions.
  2. ceph dashboard tests is failing on Jenkins — please check the CI output.

@github-project-automation github-project-automation Bot moved this from Reviewer approved to Review in progress in Ceph-Dashboard Jul 17, 2026
@aaSharma14

Copy link
Copy Markdown
Contributor Author

jenkins test dashboard

@afreen23 afreen23 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 — unit test added, dashboard CI passing.

Comment on lines +63 to +64
# pylint: disable=unexpected-keyword-arg
md5 = hashlib.md5(message.encode(), usedforsecurity=False).hexdigest()

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.

nit: move the pylint disable inline so it only suppresses this one statement

Suggested change
# pylint: disable=unexpected-keyword-arg
md5 = hashlib.md5(message.encode(), usedforsecurity=False).hexdigest()
md5 = hashlib.md5(message.encode(), usedforsecurity=False).hexdigest() # pylint: disable=unexpected-keyword-arg

@github-project-automation github-project-automation Bot moved this from Review in progress to Reviewer approved in Ceph-Dashboard Jul 21, 2026
Root cause: On FIPS-compliant systems, the OpenSSL provider rejects hashlib.md5() calls that lack the usedforsecurity=False flag, because MD5 is not an approved algorithm for security-sensitive use. This causes the MOTD set command — and the /api/motd create endpoint — to raise a ValueError and crash whenever a new MOTD is saved.

Fix: Pass usedforsecurity=False to hashlib.md5(). This tells the FIPS provider that MD5 is being used only as a non-cryptographic checksum (to detect whether a user has already dismissed a specific MOTD message), which is a legitimate use-case that FIPS allows.

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

Signed-off-by: Aashish Sharma <[email protected]>
@aaSharma14
aaSharma14 merged commit 125bb22 into ceph:main Jul 21, 2026
6 checks passed
@aaSharma14
aaSharma14 deleted the fix-78233-main branch July 21, 2026 09:33
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in Ceph-Dashboard Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants