Skip to content

Conversation

@cgwalters
Copy link
Member

On firstboot, we synthesize a machineConfig which represents
what we actually see on the node. We just fill this in with
what rpm-ostree says is osImageURL. However, FIPS is also
special in that it's handled by a special "FIPS boot" before what
we think of as firstboot.

It cleans up our later comparisons if we have the correct FIPS
state in here.

(In a layering future, I think what we'd do actually is just move
fips=1 into a kernel argument passed via MachineConfig, then
this code wouldn't need to special case it; it'd just be another
kernel argument)

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 8, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters

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 8, 2022
On firstboot, we synthesize a machineConfig which represents
what we *actually see* on the node.  We just fill this in with
what rpm-ostree says is `osImageURL`.  However, FIPS is also
special in that it's handled by a special "FIPS boot" before what
we think of as firstboot.

It cleans up our later comparisons if we have the correct FIPS
state in here.

(In a layering future, I think what we'd do actually is just move
 `fips=1` into a kernel argument passed via MachineConfig, then
  this code wouldn't need to special case it; it'd just be another
  kernel argument)
// Also inject the current fips state, which was handled before we run.
content, err := ioutil.ReadFile(fipsFile)
if err != nil {
return nil, fmt.Errorf("Error reading FIPS file at %s: %w", fipsFile, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

checkFIPS has

		if os.IsNotExist(err) {
			// we just exit cleanly if we're not even on linux
			glog.Infof("no %s on this system, skipping FIPS check", fipsFile)
			return nil
		}

I think it would make more sense if we moved the FIPS code to a getFIPS() function so we handle cases like that consistently. And then maybe instead of my PR just have

if desired.Spec.FIPS != getFIPS() {
  return fmt.Errorf(...)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree a factored out getFIPS() function would make sense, though I don't understand how we could reach that particular bit since the MCD only runs on Linux. (maybe somehow the unit tests reach it when run from MacOS e.g.?)

@mkenigs
Copy link
Contributor

mkenigs commented Apr 11, 2022

If mc from MachineConfigEncapsulatedPath has the wrong value of FIPS, do we want the call to update() to error?

@mkenigs
Copy link
Contributor

mkenigs commented Apr 11, 2022

lgtm - happy to make any of the changes I suggested in a followup PR

@cgwalters
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 12, 2022

@cgwalters: 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/test-infra repository. I understand the commands that are listed here.

@mkenigs
Copy link
Contributor

mkenigs commented Apr 14, 2022

@cgwalters this is lower priority than anything we want to demo, but I'd like to rework my PR on top of this one. Do you think you'll want to merge as is or make more changes here?

@cgwalters
Copy link
Member Author

Well I agree that getFIPS would be better, I just didn't get around to it. Probably makes sense to merge the two PRs, do you want to take this commit as a base and build on it, then close this PR?

@mkenigs
Copy link
Contributor

mkenigs commented Apr 14, 2022

I'd say merge this and then maybe I'll factor out getFIPS in my PR. Unless we're going to do a merge of master into layering, can you make this against layering and then we can cherry pick?

I am still curious about whether we want to error if MachineConfigEncapsulatedPath has the wrong value of FIPS. Is that even reachable?

@mkenigs
Copy link
Contributor

mkenigs commented Apr 14, 2022

Factored out getFIPS on my branch
bf0b4ec

@kikisdeliveryservice
Copy link
Contributor

adding a hold as this uses the deprecated errors package removed in:
#2868

/hold

@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 14, 2022
@mkenigs
Copy link
Contributor

mkenigs commented Apr 21, 2022

/hold cancel
#2868 merged
Do you want to merge this now @cgwalters ? And do you want this in layering or master?

@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 21, 2022
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2022
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 20, 2022
@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Sep 20, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 20, 2022

@openshift-bot: Closed this PR.

Details

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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/test-infra repository.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants