Skip to content

[WIP] Make FIPS activation runtime-conditional on fips=1 kernel param#908

Open
sparrc wants to merge 1 commit into
bottlerocket-os:developfrom
sparrc:sparrc-runtime-fips-v2
Open

[WIP] Make FIPS activation runtime-conditional on fips=1 kernel param#908
sparrc wants to merge 1 commit into
bottlerocket-os:developfrom
sparrc:sparrc-runtime-fips-v2

Conversation

@sparrc
Copy link
Copy Markdown

@sparrc sparrc commented Apr 14, 2026

The overall purpose of this change is to include most FIPS logic in all BR variants, and to standardize on all of the systemd services only being activated with ConditionKernelCommandLine=fips=1, as some already are:

This gets closer to the "standard" BR AMI being able to be used in FIPS environments, only needing a runtime switch to activate FIPS mode like the following userdata:

[settings.boot] 
reboot-to-reconcile = true 
[settings.boot.kernel-parameters] 
fips = ["1"]

Description of changes:

Move FIPS-related systemd units and drop-ins from the release-fips subpackage into the base release package so they ship in all variants. These units already use ConditionKernelCommandLine=fips=1 or depend on fipscheck.target, so they are no-ops on non-FIPS boots.

Replace the unconditional Environment=GODEBUG=fips140=on drop-in with an EnvironmentFile=-/run/fips-go.env approach: a new service copies the env file into /run only when fips=1 is set. Similarly, replace the tmpfiles-based /etc/system-fips creation with a conditional service.

The bootconfig snippet and FIPS binary overlay mounts remain in the fips subpackage since they require build-time binary selection.

Assisted-by: Cline:anthropic.claude-opus-4-6-v1

Testing done:

WIP

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Move FIPS-related systemd units and drop-ins from the release-fips
subpackage into the base release package so they ship in all variants.
These units already use ConditionKernelCommandLine=fips=1 or depend on
fipscheck.target, so they are no-ops on non-FIPS boots.

Replace the unconditional Environment=GODEBUG=fips140=on drop-in with
an EnvironmentFile=-/run/fips-go.env approach: a new service copies the
env file into /run only when fips=1 is set. Similarly, replace the
tmpfiles-based /etc/system-fips creation with a conditional service.

The bootconfig snippet and FIPS binary overlay mounts remain in the fips
subpackage since they require build-time binary selection.

Assisted-by: Cline:anthropic.claude-opus-4-6-v1
Signed-off-by: Cameron Sparr <sparrc@users.noreply.github.com>
@@ -0,0 +1,13 @@
[Unit]
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.

can you add a comment on why do we need this /etc/system-fips marker file?

like the one include in here

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.

2 participants