Skip to content

#12631 Add OpenSSL FIPS mode CI job using CentOS Stream 9 - #12585

Open
stratakis wants to merge 1 commit into
twisted:trunkfrom
stratakis:fips_CI
Open

stratakis wants to merge 1 commit into
twisted:trunkfrom
stratakis:fips_CI

Conversation

@stratakis

@stratakis stratakis commented Mar 6, 2026 •

Copy link
Copy Markdown

Scope and purpose

Fixes #12631

Related to #11866

This PR provides the basic blocks for testing with FIPS mode on C9S

Additionally I've added testing for Python 3.9 (the main system python in C9s) and Python3.14 which is newly added there.

@stratakis

Copy link
Copy Markdown
Author

The jobs will most possibly fails ofc as twisted is not yet compatible with FIPS mode.

@codspeed

codspeed Bot commented Mar 6, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 2.74%

⚡ 1 improved benchmark
✅ 35 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_http11_server_many_headers 1.3 ms 1.2 ms +2.74%

Comparing stratakis:fips_CI (6d3dcd9) with trunk (508c44f)

Open in CodSpeed

@stratakis

Copy link
Copy Markdown
Author

It looks that it works as intended. FIPS is found as active, and there are 14 failures and 506 errors from various md5 calls.

Run the test suite under FIPS-enabled OpenSSL on CentOS Stream 9
with Python 3.9 and 3.14. Tests that currently fail under FIPS are
excluded. With each subsequent fix remove entries from the exclusion
list.
@stratakis

Copy link
Copy Markdown
Author

@glyph changed the approach here to be exclusion based. There are a lot of tests that are skipped on the FIPS jobs, however many are cascading to other tests, so one fix, should cascade to others.

Also I've added CentOS Stream 9 here as a testing environment as this is the environment I'm working on. I can also add CentOS Stream 10, any other FIPS supporting environment or let it as is, to have a minimal environment at the beginning.

@adiroiban adiroiban changed the title #11866 Add OpenSSL FIPS mode CI job using CentOS Stream 9 #12631 Add OpenSSL FIPS mode CI job using CentOS Stream 9 Apr 26, 2026
@adiroiban

adiroiban commented Apr 26, 2026 •

Copy link
Copy Markdown
Member

@stratakis

Is this ready for review ?

I see that this is mentioned to be ralated #11866 ... but I think that we need a dedicated/separate issue for enabling FIPS mode.

I have created issue #12631 to discuss how we can support FIPS mode.

I guess that we also need to update the installation docs to inform what FIPS environment are supported and how to install that.

TOXENV: alldeps-nocov-posix
TRIAL_ARGS: '-j 4'
run: |
tox -- $(python${{ matrix.python-version }} -c "

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.

We need to add a comment with the links to all the issues that will target fixing these tests.

Like for example #11866

Once we work on that particular issue we can remove the tests from this exception list and remove the reference to the issue

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yup, I can do that, but maybe I should follow a more structured approach by identifying all the issues around compliance, required code changes and also figure out the duplicates. Should I start on this? Although I'm not very familiar with twisted processes and on the best way to approach this on having a higher level discussion.

# See https://github.com/twisted/twisted/pull/12585
fips-testing:
name: ${{ matrix.python-version }}-FIPS OpenSSL
runs-on: ubuntu-22.04

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.

Just asking.
Why not use Ubuntu 24.04 ?

My understanding is that OPENSSL_FORCE_FIPS_MODE is implemented in Ubuntu 24.04 and then we can run the tests without the need for a separate container.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The reasoning is that basically I work myself on RHEL/CentOS and Python's support of FIPS mode there, maintaining some downstream patches for years and also collaborated with upstreaming various parts on CPython. Plus I maintain some FIPS Python buildbots for upstream CPython (where I had to patch twisted for buildbot to work correctly).

Plus I don't know how FIPS works on ubuntu or how it's implemented, RHEL/CentOS is fully FIPS compliant when configured.

So it boils down to the use case that I have experience with.

steps:
- name: Install system dependencies
run: |
dnf install -y git python${{ matrix.dnf-pkg-suffix }}-pip python${{ matrix.dnf-pkg-suffix }}-devel gcc libffi-devel openssl-devel

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.

Just asking.

Why do we need to use OS Python version?

I guess that the answer is: because actions/setup-python does not support FIPS mode.

In this case, I think that we should at least create a GitHub Issue upstream and ask for this...
It might be rejected.... but we tried.

There is also the Python distribution from astral-sh/python-build-standalone ... I see some FIPS related work so maybe see if we can use that.

The goal is to see if we can get support for Twisted for FIPS, on a more generic Python distribution... not only CentOS.

But if CentOS is the only OS that provides FIPS mode for Python, this is fine... but at least we tried to get support for more platforms :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

FIPS mode is more of a compliance thing than strictly security, from vendors who are selling to specific jurisdictions. It's a nice thing to support but it really depends if the distributor has put the work. The upstream Python is not fully FIPS compliant last I checked (but hoping to get there at some point).

So in the end, from my POV, I see the RHEL/CentOS system pythons as the main FIPS enabled interpreters, the main CPython as halfway there and the rest just having bits and pieces (ofc I'm making assumptions here about other distributors, I could be very wrong).

@adiroiban

Copy link
Copy Markdown
Member

I left a comment on #12631 ... we need to see if we want to really support FIPS mode... or just ignore FIPS non-compliace errors.

Any option is ok... but we need to state this somewhere in the docs, so that end-users will know what to expect

We can implement FIPS ignore and work on FIPS compliance later.

@stratakis

Copy link
Copy Markdown
Author

@stratakis

Is this ready for review ?

I see that this is mentioned to be ralated #11866 ... but I think that we need a dedicated/separate issue for enabling FIPS mode.

I have created issue #12631 to discuss how we can support FIPS mode.

I can update the issue to reference that.

I guess that we also need to update the installation docs to inform what FIPS environment are supported and how to install that.

Hmm the docs should be part of a PR implementing fix compliance (or ignoring MD5), what do you think?

This branch has not been deployed

No deployments
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.

Add OpenSSL FIPS mode to our CI jobs

2 participants