Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rule enable_fips_mode for RHEL 10 #12916

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# disruption = medium
{{{ ansible_instantiate_variables("var_system_crypto_policy") }}}

{{% if product != "rhel10" %}}
- name: "{{{ rule_title }}} - Check to See the Current Status of FIPS Mode"
ansible.builtin.command: /usr/bin/fips-mode-setup --check
register: is_fips_enabled
Expand All @@ -15,6 +16,7 @@
ansible.builtin.command: /usr/bin/fips-mode-setup --enable
when:
- is_fips_enabled.stdout.find('FIPS mode is enabled.') == -1
{{% endif %}}

- name: "{{{ rule_title }}} - Configure Crypto Policy"
ansible.builtin.lineinfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ if {{{ bash_bootc_build() }}}; then
cat > /usr/lib/bootc/kargs.d/01-fips.toml << EOF
kargs = ["fips=1"]
EOF
{{% if product != "rhel10" %}}
else
fips-mode-setup --enable
{{% endif %}}
fi

stderr_of_call=$(update-crypto-policies $crypto_policies_no_reload --set ${var_system_crypto_policy} 2>&1 > /dev/null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@ documentation_complete: true
title: Enable FIPS Mode

description: |-
{{% if product != "rhcos4" %}}
{{% if product == "rhcos4" %}}
OpenShift has an installation-time flag that can enable FIPS mode
for the cluster. The flag <pre>fips: true</pre> must be enabled
at install time in the <pre>install-config.yaml</pre> file. If
this rule fails on an installed cluster, then this is a permanent
finding and cannot be fixed.
{{% elif product == "rhel10" %}}
Copy link
Member

Choose a reason for hiding this comment

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

Could we do something like 'rhel' in product and product not in ["rhel8", "rhel9"] so we don't have to come back in RHEL 11?

Add the <tt>fips=1</tt> option to the kernel command line during the system installation.
During the software selection stage, do not install any third-party software.
After the installation, the system starts in FIPS mode automatically.
<br />
After the system starts, check that FIPS mode is enabled:
<pre>cat /proc/sys/crypto/fips_enabled
1</pre>
<br />
{{% else %}}
To enable FIPS mode, run the following command:
<pre>fips-mode-setup --enable</pre>
<br />
Expand All @@ -15,19 +30,15 @@ description: |-
<li>Setting the system crypto policy in <tt>/etc/crypto-policies/config</tt> to <tt>{{{ xccdf_value("var_system_crypto_policy") }}}</tt></li>
<li>Loading the Dracut <tt>fips</tt> module</li>
</ul>
{{% endif %}}

<br />
{{% if bootable_containers_supported == "true" %}}
<br /><br />
To enable FIPS mode at bootable container build time configure <tt>fips=1</tt> kernel argument
in <tt>/usr/lib/bootc/kargs.d/01-fips.toml</tt>:
<pre>kargs = ["fips=1"]</pre>
Then set the cryptographic policy to <tt>{{{ xccdf_value("var_system_crypto_policy") }}}</tt>:
<pre>update-crypto-policies --no-reload --set {{{ xccdf_value("var_system_crypto_policy") }}}</pre>
{{% else %}}
OpenShift has an installation-time flag that can enable FIPS mode
for the cluster. The flag <pre>fips: true</pre> must be enabled
at install time in the <pre>install-config.yaml</pre> file. If
this rule fails on an installed cluster, then this is a permanent
finding and cannot be fixed.
{{% endif %}}

rationale: |-
Expand Down Expand Up @@ -58,35 +69,50 @@ ocil_clause: 'FIPS mode is not enabled'

ocil: |-
To verify that FIPS mode is enabled properly, run the following command:
{{% if product == "rhel10" %}}
<pre>cat /proc/sys/crypto/fips_enabled</pre>
The output should contain the following:
<pre>1</pre>
{{% else %}}
<pre>fips-mode-setup --check</pre>
The output should contain the following:
<pre>FIPS mode is enabled.</pre>
{{% endif %}}
To verify that the cryptographic policy has been configured correctly, run the
following command:
<pre>$ update-crypto-policies --show</pre>
The output should return <pre>{{{ xccdf_value("var_system_crypto_policy") }}}</pre>.

warnings:
{{% if product == "rhel10" %}}
- general: |-
Only enabling FIPS mode during the RHEL installation ensures that the system generates all keys with FIPS-approved algorithms and continuous monitoring tests in place.
{{% else %}}
- general: |-
The system needs to be rebooted for these changes to take effect.
{{% endif %}}
- regulatory: |-
This rule DOES NOT CHECK if the components of the operating system are FIPS certified.
You can find the list of FIPS certified modules at {{{ weblink(link="https://csrc.nist.gov/projects/cryptographic-module-validation-program/validated-modules/search") }}}.
This rule checks if the system is running in FIPS mode. See the rule description for more information about what it means.

fixtext: |-
Configure {{{ full_name }}} to run in FIPS mode.

{{% if product == "rhel10" %}}
Add the fips=1 option to the kernel command line during the system installation.
{{% else %}}
Run the following commands:

$ sudo fips-mode-setup --enable
$ sudo update-crypto-policies --set {{{ xccdf_value("var_system_crypto_policy") }}}

The system needs to be rebooted for these changes to take effect.

{{% endif %}}
{{% if bootable_containers_supported == "true" %}}
To enable FIPS mode at bootable container build time, add the following commands in Containerfile:

RUN echo 'kargs = ["fips=1"]' > /usr/lib/bootc/kargs.d/01-fips.toml
RUN update-crypto-policies --no-reload --set {{{ xccdf_value("var_system_crypto_policy") }}}
{{% endif %}}

srg_requirement: '{{{ full_name }}} must implement NIST FIPS-validated cryptography for the following: to provision digital signatures, to generate cryptographic hashes, and to protect data requiring data-at-rest protections in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards.'
Loading