Skip to content

[fips] Remove the GOFIPS env var check#2562

Merged
cyli merged 4 commits intomoby:masterfrom
cyli:fips-not-envvar
Apr 30, 2018
Merged

[fips] Remove the GOFIPS env var check#2562
cyli merged 4 commits intomoby:masterfrom
cyli:fips-not-envvar

Conversation

@cyli
Copy link
Contributor

@cyli cyli commented Mar 16, 2018

#2246 added FIPS support by checking the environment variable GOFIPS. This has several drawbacks:

  1. The tests set the GOFIPS env var, and unset them. When tests run in parallel, this can cause flakiness, which we've seen some of in CI
  2. We won't be able to test to make sure we reject mixed clusters if we require FIPS compliance (see FIPS support design #2544)

Better if we can inject a boolean for FIPSness.

This changes everywhere that used to use keyutils specifically to check for FIPSness now has to take a keyutils.Formatter object which provides the same interface as keyutils used to, and this changes everywhere that called encryption.Defaults to pass whether FIPS is required.

Note that this does not pass the FIPS bool through from node to the raft storage - there's more work that needs to be done there, and this PR is really big already, so I'll do it in a separate PR.

@cyli cyli mentioned this pull request Mar 16, 2018
2 tasks
@cyli cyli force-pushed the fips-not-envvar branch from 556f192 to d27214f Compare March 16, 2018 06:05
@codecov
Copy link

codecov bot commented Mar 16, 2018

Codecov Report

Merging #2562 into master will increase coverage by 0.19%.
The diff coverage is 95.74%.

@@            Coverage Diff             @@
##           master    #2562      +/-   ##
==========================================
+ Coverage   61.58%   61.77%   +0.19%     
==========================================
  Files         134      134              
  Lines       21763    21770       +7     
==========================================
+ Hits        13403    13449      +46     
+ Misses       6918     6873      -45     
- Partials     1442     1448       +6

@cyli cyli changed the title [WIP] Remove the GOFIPS env var check [WIP] Remove the GOFIPS env var check (needs #2552) Mar 16, 2018
@dperny
Copy link
Collaborator

dperny commented Mar 19, 2018

FIPSness

FIPSity, IMHO.

Is the idea here that the FIPS configuration variable on the node object will be passed in from the caller (in the downstream case, from the docker engine)?

@cyli
Copy link
Contributor Author

cyli commented Mar 19, 2018

FIPSity

Oh nice, I didn't think of that one.

Is the idea here that the FIPS configuration variable on the node object will be passed in from the caller (in the downstream case, from the docker engine)?

@dperny Yep, so it's only checked in one place, rather than us checking it separately from the docker engine.

@dperny
Copy link
Collaborator

dperny commented Mar 19, 2018

Does it not work to store in/read this setting out of the raft store because we need to know if we're FIPS or not before we try reading the raft store?

@cyli
Copy link
Contributor Author

cyli commented Mar 19, 2018

Does it not work to store in/read this setting out of the raft store because we need to know if we're FIPS or not before we try reading the raft store?

The FIPS setting in the raft store specifies whether the cluster requires mandatory FIPS. It's possible to disable FIPS mode for a single node - we want to enforce that a node that is part of a cluster that requires FIPS will not start up swarm components unless the engine is in FIPS-enabled mode. (So users won't be able to get a mixed cluster by accident, if the whole cluster is set to FIPS).

We could read the cluster setting, check it against our own, and then shut down. But that only works for managers - the workers don't have access to a raft store. I was previously thinking the dispatcher could just reject the agents who self-report as non-FIPS, but it seems better to shut down early if possible with a nice error message. This also will also mean we don't have to change dispatcher session behavior.

But also, we need the manager node to take a configuration value because currently that is how we determine whether the cluster requires mandatory FIPS - is if the first swarm node is FIPS or not.

@cyli cyli force-pushed the fips-not-envvar branch 2 times, most recently from 9d8ba87 to 9bd36e9 Compare March 28, 2018 00:21
@cyli cyli changed the title [WIP] Remove the GOFIPS env var check (needs #2552) Remove the GOFIPS env var check when dealing with TLS keys (part 1) Mar 28, 2018
@cyli cyli force-pushed the fips-not-envvar branch from 9bd36e9 to 6bbc242 Compare March 28, 2018 17:31
@cyli cyli changed the title Remove the GOFIPS env var check when dealing with TLS keys (part 1) Remove the GOFIPS env var check Mar 28, 2018
@cyli cyli force-pushed the fips-not-envvar branch 3 times, most recently from 570d3c1 to b2da71c Compare March 30, 2018 00:00
@dperny
Copy link
Collaborator

dperny commented Apr 4, 2018

LGTM.

cyli added 4 commits April 10, 2018 12:14
…g requires FIPS:

(1) require that users of the keyutil package instead use a key formatter object,
    which could either be the default non-FIPS utility or the FIPS utility.
(2) require that users that request encryption defaults specify whether FIPS compliance
    is needed

Signed-off-by: Ying Li <ying.li@docker.com>
…or the root CA

because we no longer support encrypting the root CA key, and PKCS8 vs PKCS1 only
matters for fips if we encrypt.  We want to keep the root key PKCS1 so that mixed
version clusters will continue to work.

Signed-off-by: Ying Li <ying.li@docker.com>
…o encrypt and

decrypt keys. It can be set using a setter function.

Signed-off-by: Ying Li <ying.li@docker.com>
KeyReadWriter used in the node object.

Signed-off-by: Ying Li <ying.li@docker.com>
@cyli cyli force-pushed the fips-not-envvar branch from b2da71c to 43f607a Compare April 10, 2018 19:15
@cyli cyli changed the title Remove the GOFIPS env var check [fips] Remove the GOFIPS env var check Apr 24, 2018
Copy link
Contributor

@nishanttotla nishanttotla left a comment

Choose a reason for hiding this comment

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

Sorry for the delay on this review, but LGTM.

I don't have any particular comments. The code structure looks good, and the only question I had was already addressed in the discussion above.

@cyli
Copy link
Contributor Author

cyli commented Apr 30, 2018

Thanks so much @nishanttotla! I will merge and rebase the others.

@cyli cyli merged commit d86f838 into moby:master Apr 30, 2018
@cyli cyli deleted the fips-not-envvar branch April 30, 2018 19:47
@cyli cyli mentioned this pull request May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants