Skip to content

OCPSTRAT-3113: Set DEFAULT:PQ crypto-policies to RHEL9 base image#230

Open
sdodson wants to merge 1 commit intoopenshift:masterfrom
sdodson:pq-crypto-policies
Open

OCPSTRAT-3113: Set DEFAULT:PQ crypto-policies to RHEL9 base image#230
sdodson wants to merge 1 commit intoopenshift:masterfrom
sdodson:pq-crypto-policies

Conversation

@sdodson
Copy link
Copy Markdown
Member

@sdodson sdodson commented Apr 10, 2026

Summary

  • Convert base/Dockerfile.rhel9 to multi-stage build to add post-quantum cryptography support
  • Builder stage installs crypto-policies and configures DEFAULT:PQ policy
  • Final stage copies /etc/crypto-policies/ configuration from builder
  • Enables post-quantum cryptography for future-proofing against quantum computing threats

Technical Details

The DEFAULT:PQ policy is additive - it adds post-quantum algorithms while maintaining existing algorithms for backward compatibility.

Test plan

  • Build the image successfully: docker build -f base/Dockerfile.rhel9 .
  • Verify crypto-policies configuration: docker run --rm <image> update-crypto-policies --show (should output: DEFAULT:PQ)
  • Verify policy files exist: docker run --rm <image> ls -la /etc/crypto-policies/
  • Test downstream images build successfully (egress router, dns-proxy, http-proxy, ipfailover)

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Walkthrough

Added a multi-stage build in base/Dockerfile.rhel9: a builder stage installs crypto-policies-scripts, runs update-crypto-policies --set DEFAULT:PQ to enable the post-quantum policy, cleans dnf caches, and copies /etc/crypto-policies/ into the final runtime image.

Changes

Cohort / File(s) Summary
Crypto-policies Configuration
base/Dockerfile.rhel9
Added a builder stage that installs crypto-policies-scripts, runs update-crypto-policies --set DEFAULT:PQ, cleans DNF caches, and copies /etc/crypto-policies/ from the builder into the final runtime image.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from jupierce and rootfs April 10, 2026 19:29
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 10, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sdodson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@base/Dockerfile.rhel9`:
- Around line 11-12: The crypto-policies copy (the COPY --from=builder
/etc/crypto-policies/ /etc/crypto-policies/ step) is placed before later dnf
package transactions which can rebuild policy state; move that COPY so it occurs
after all package installation and dnf transaction steps to ensure the final
DEFAULT:PQ policy is deterministic and not overwritten by subsequent package
operations. Locate the COPY in base/Dockerfile.rhel9 and reorder it to follow
the block that performs dnf installs/transactions (the package installation
commands) so the copied /etc/crypto-policies/ is the last change to that path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b3e24d5-04d8-4563-a315-087010e8d4db

📥 Commits

Reviewing files that changed from the base of the PR and between edb8b1e and fe502ea.

📒 Files selected for processing (1)
  • base/Dockerfile.rhel9

Comment thread base/Dockerfile.rhel9
@sdodson sdodson marked this pull request as draft April 10, 2026 19:48
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 10, 2026
Convert base/Dockerfile.rhel9 to multi-stage build to configure
crypto-policies with DEFAULT:PQ policy. This adds post-quantum
cryptography support for future-proofing against quantum threats.

The builder stage installs crypto-policies and runs update-crypto-policies
--set DEFAULT:PQ, then the final stage copies /etc/crypto-policies/ from
the builder to include the configured policies in the base image.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@sdodson sdodson force-pushed the pq-crypto-policies branch from fe502ea to fd63ad8 Compare April 10, 2026 19:57
@sdodson
Copy link
Copy Markdown
Member Author

sdodson commented Apr 10, 2026

/test images

@sdodson sdodson changed the title Add post-quantum crypto-policies to RHEL9 base image Set DEFAULT:PQ crypto-policies to RHEL9 base image Apr 11, 2026
@sdodson sdodson changed the title Set DEFAULT:PQ crypto-policies to RHEL9 base image /retitle OCPSTRAT-3113: Set DEFAULT:PQ crypto-policies to RHEL9 base image Apr 11, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 11, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 11, 2026

@sdodson: This pull request references OCPSTRAT-3113 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the initiative to target only the "4.22.0" version, but multiple target versions were set.

Details

In response to this:

Summary

  • Convert base/Dockerfile.rhel9 to multi-stage build to add post-quantum cryptography support
  • Builder stage installs crypto-policies and configures DEFAULT:PQ policy
  • Final stage copies /etc/crypto-policies/ configuration from builder
  • Enables post-quantum cryptography for future-proofing against quantum computing threats

Technical Details

The DEFAULT:PQ policy is additive - it adds post-quantum algorithms while maintaining existing algorithms for backward compatibility.

Test plan

  • Build the image successfully: docker build -f base/Dockerfile.rhel9 .
  • Verify crypto-policies configuration: docker run --rm <image> update-crypto-policies --show (should output: DEFAULT:PQ)
  • Verify policy files exist: docker run --rm <image> ls -la /etc/crypto-policies/
  • Test downstream images build successfully (egress router, dns-proxy, http-proxy, ipfailover)

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sdodson sdodson changed the title /retitle OCPSTRAT-3113: Set DEFAULT:PQ crypto-policies to RHEL9 base image OCPSTRAT-3113: Set DEFAULT:PQ crypto-policies to RHEL9 base image Apr 11, 2026
@sdodson sdodson marked this pull request as ready for review April 11, 2026 17:52
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 11, 2026
@openshift-ci openshift-ci Bot requested a review from csrwng April 11, 2026 17:52
@sdodson
Copy link
Copy Markdown
Member Author

sdodson commented Apr 11, 2026

/hold
This should go in after branching

@openshift-ci openshift-ci Bot requested a review from sjenning April 11, 2026 17:52
@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 11, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
base/Dockerfile.rhel9 (1)

11-12: Add a build-time guard to prevent silent crypto-policy regressions.

Consider asserting the copied policy in the final stage so future base/package changes can’t silently drift away from DEFAULT:PQ.

Suggested diff
 # Copy crypto-policies configuration from builder stage
 COPY --from=builder /etc/crypto-policies/ /etc/crypto-policies/
+
+# Fail build if policy is not what we expect
+RUN test "$(cat /etc/crypto-policies/config)" = "DEFAULT:PQ"

As per coding guidelines, "-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@base/Dockerfile.rhel9` around lines 11 - 12, Add a build-time assertion in
the final Docker stage to verify the copied crypto-policies did not regress from
the expected DEFAULT:PQ; after the existing COPY --from=builder
/etc/crypto-policies/ /etc/crypto-policies/ add a RUN that inspects the relevant
policy file under /etc/crypto-policies/ (e.g., the config or DEFAULT file) and
fails the build if it does not contain "DEFAULT:PQ" so any future base/package
changes break the build rather than silently drifting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@base/Dockerfile.rhel9`:
- Around line 11-12: Add a build-time assertion in the final Docker stage to
verify the copied crypto-policies did not regress from the expected DEFAULT:PQ;
after the existing COPY --from=builder /etc/crypto-policies/
/etc/crypto-policies/ add a RUN that inspects the relevant policy file under
/etc/crypto-policies/ (e.g., the config or DEFAULT file) and fails the build if
it does not contain "DEFAULT:PQ" so any future base/package changes break the
build rather than silently drifting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f003135e-d91b-4ab9-872d-b73bfed4adae

📥 Commits

Reviewing files that changed from the base of the PR and between fe502ea and fd63ad8.

📒 Files selected for processing (1)
  • base/Dockerfile.rhel9

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 11, 2026

@sdodson: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 23, 2026

@sdodson: This pull request references OCPSTRAT-3113 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the initiative to target only the "5.0.0" version, but multiple target versions were set.

Details

In response to this:

Summary

  • Convert base/Dockerfile.rhel9 to multi-stage build to add post-quantum cryptography support
  • Builder stage installs crypto-policies and configures DEFAULT:PQ policy
  • Final stage copies /etc/crypto-policies/ configuration from builder
  • Enables post-quantum cryptography for future-proofing against quantum computing threats

Technical Details

The DEFAULT:PQ policy is additive - it adds post-quantum algorithms while maintaining existing algorithms for backward compatibility.

Test plan

  • Build the image successfully: docker build -f base/Dockerfile.rhel9 .
  • Verify crypto-policies configuration: docker run --rm <image> update-crypto-policies --show (should output: DEFAULT:PQ)
  • Verify policy files exist: docker run --rm <image> ls -la /etc/crypto-policies/
  • Test downstream images build successfully (egress router, dns-proxy, http-proxy, ipfailover)

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sdodson
Copy link
Copy Markdown
Member Author

sdodson commented Apr 23, 2026

/hold cancel
/cc @candita
PTAL as the team most affected by this change

@openshift-ci openshift-ci Bot requested a review from candita April 23, 2026 14:42
@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2026
@sdodson
Copy link
Copy Markdown
Member Author

sdodson commented Apr 23, 2026

/verified by @sdodson
I've confirmed that the image uses the profiles intended, I have no confirmed that everything downstream of this works as expected.

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 23, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sdodson: This PR has been marked as verified by @sdodson.

Details

In response to this:

/verified by @sdodson
I've confirmed that the image uses the profiles intended, I have no confirmed that everything downstream of this works as expected.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Comment thread base/Dockerfile.rhel9
update-crypto-policies --set DEFAULT:PQ && \
dnf clean all && rm -rf /var/cache/*

# Final stage: Base RHEL9 image with PQ crypto-policies
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not quite as good as building in CI, but I built locally, router with the PQ policy and it didn't die on start:

podman run --platform linux/amd64 --rm --entrypoint /usr/sbin/haproxy localhost/router:test-pq -c -f /var/lib/haproxy/conf/haproxy.config                               │
                                                                                                                                                                                  
Configuration file has no error but will not start (no listener) => exit(2)

I'll check coredns and CIO, CDO too

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was running CIO's e2e on a dev cluster with the PQ build router, I saw:

=== NAME  TestAll/parallel/TestTLSSecurityProfile
    operator_test.go:1916: ingresscontroller status has unexpected security profile spec.
        expected:
        ciphers:
        - ECDHE-ECDSA-AES128-GCM-SHA256
        - ECDHE-ECDSA-AES256-GCM-SHA384
        - ECDHE-ECDSA-CHACHA20-POLY1305
        - ECDHE-RSA-AES128-GCM-SHA256
        - ECDHE-RSA-AES256-GCM-SHA384
        - ECDHE-RSA-CHACHA20-POLY1305
        - TLS_AES_128_GCM_SHA256
        - TLS_AES_256_GCM_SHA384
        - TLS_CHACHA20_POLY1305_SHA256
        mintlsversion: VersionTLS12

        got:
        ciphers:
        - DHE-RSA-AES128-GCM-SHA256
        - DHE-RSA-AES256-GCM-SHA384
        - ECDHE-ECDSA-AES128-GCM-SHA256
        - ECDHE-ECDSA-AES256-GCM-SHA384
        - ECDHE-ECDSA-CHACHA20-POLY1305
        - ECDHE-RSA-AES128-GCM-SHA256
        - ECDHE-RSA-AES256-GCM-SHA384
        - ECDHE-RSA-CHACHA20-POLY1305
        - TLS_AES_128_GCM_SHA256
        - TLS_AES_256_GCM_SHA384
        - TLS_CHACHA20_POLY1305_SHA256
        mintlsversion: VersionTLS12

so we have at least one e2e test to fix with this...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Results for coredns and running cluster-dns-operator e2e: we can build with PQ image and e2e tests all run, except for one non-TLS related flake. I think we don't hard code a cipher suite test in the same way so this won't be a problem

Comment thread base/Dockerfile.rhel9
FROM registry.ci.openshift.org/ocp/4.22:base-rhel9 AS builder

RUN dnf install -y --nodocs crypto-policies-scripts && \
update-crypto-policies --set DEFAULT:PQ && \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So for RHEL 9 crypto-policies, the DEFAULT:PQ policy and FIPS mode are currently mutually exclusive, right? So are binaries built with this image shunted away from FIPS enabled cluster usage somehow?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't believe they are mutually exclusive in implementation only in audit policy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Okay so reading here: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening#post_quantum_cryptography

I think I understand that PQ is a subpolicy and in FIPS cluster, we'd likely see double (hybrid) encryption where the PQ crypto is wrapped by the compliant crypto, for now.

Comment thread base/Dockerfile.rhel9
@@ -1,5 +1,16 @@
# Builder stage: Configure crypto-policies with post-quantum support
FROM registry.ci.openshift.org/ocp/4.22:base-rhel9 AS builder
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.

Will this affect 4.22 images? I thought this was planned for 5.0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, that will only affect the inputs to the build, not the output. ART just hasn't done the image synchronization stuff that they normally do, I assume they'll update this in the near future. Since 4.22 and 5.0 both use UBI9 as the base this shouldn't affect any outcomes.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants