Skip to content

Conversation

@cyli
Copy link
Contributor

@cyli cyli commented Apr 5, 2018

This is implemented by:

  1. Changing the cluster ID to indicate whether FIPS is required. If so, the certificates all have the cluster ID in them, so when a node starts up, it looks at its cert, and matches the FIPS requirement against its own FIPS mode. If it's not running in FIPS mode, and it should, it shuts down.
  2. Changing the join token only if, and to indicate whether, FIPS is required. So when you try to join a node to a cluster, if the join token indicates that it's a FIPS cluster, the node will refuse to join.

This may conflict a little against #2586, since both propagate the FIPS boolean to the manager.

@codecov
Copy link

codecov bot commented Apr 5, 2018

Codecov Report

Merging #2594 into master will increase coverage by 0.12%.
The diff coverage is 93.2%.

@@            Coverage Diff             @@
##           master    #2594      +/-   ##
==========================================
+ Coverage    61.7%   61.82%   +0.12%     
==========================================
  Files         134      134              
  Lines       21788    21818      +30     
==========================================
+ Hits        13444    13489      +45     
+ Misses       6895     6880      -15     
  Partials     1449     1449

Copy link
Contributor

@anshulpundir anshulpundir left a comment

Choose a reason for hiding this comment

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

minor comments.


// FIPS specifies whether this cluster should be in FIPS mode. This changes
// the format of the join tokens, and nodes that are not FIPS-enabled should
// reject joining the cluster. Nodes that report themselves to be non-FIPs
Copy link
Contributor

Choose a reason for hiding this comment

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

FIPs -> FIPS

// certificate or root certificate request.
GetCertRetryInterval = 2 * time.Second

errInvalidJoinToken = errors.New("invalid join token")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Maybe a note on where this error should be used ?

ca/config.go Outdated
type ParsedJoinToken struct {
Version int
RootDigest digest.Digest
Secret string
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it makes sense to add a comment to clarify each field, but I'll let you decide.

ca/config.go Outdated

// GenerateJoinToken creates a new join token.
func GenerateJoinToken(rootCA *RootCA) string {
// GenerateJoinToken creates a new join token. If FIPS is enabled, the join token is of a new format.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is prob a dumb question, but can you please clarify what you mean by 'a new format' ?

ca/config.go Outdated
NodeCertificateStatusRequestTimeout time.Duration
// RetryInterval specifies how long to delay between retries, if non-zero.
RetryInterval time.Duration
// Organization is the the organization to use when creating a security config
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove one 'the'

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: say how this is used ?

return strings.HasPrefix(securityConfig.ClientTLSCreds.Organization(), "FIPS.")
}

func isMandatoryFIPSClusterJoinToken(joinToken string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a comment ?

node/node.go Outdated
ConnBroker: n.connBroker,
})
}
// If this is a new cluster, we want to name the cluster ID FIPS-something
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: FIPS-something => 'FIPS-something'

@dperny
Copy link
Collaborator

dperny commented May 4, 2018

LGTM, but needs a squash.

cyli and others added 2 commits May 4, 2018 14:01
…en a

cluster is first created, the FIPS value should be set and it should not
be changed through the lifetime of the cluster, because converting from
non-FIPS to FIPS should not be possible (to avoid compliance issues, even
if there were a migration process, we'd have to provide a validation tool
to ensure that the migration was complete across the cluster).

Signed-off-by: Ying Li <[email protected]>
… reflect

this property. So all TLS certs will have the cluster ID, which says whether
the cluster is FIPS, in the Org field.

If a node loads up its TLS cert, sees that that the cluster requires FIPS,
and FIPS mode is not enabled on that node, the node will shut down.  If a
non-FIPS node gets a join token that indicate that the cluster mandates
FIPS, it will refuse to join.

Signed-off-by: Ying Li <[email protected]>
@cyli cyli force-pushed the cluster-mandatory-fips branch from 4ec152c to 9943770 Compare May 4, 2018 21:15
@cyli
Copy link
Contributor Author

cyli commented May 4, 2018

Thanks @anshulpundir and @dperny - I think the comments are addressed, and I've squashed it to 2 commits (generated API changes and code changes)

@anshulpundir
Copy link
Contributor

LGTM

@cyli cyli merged commit bf83f94 into moby:master May 7, 2018
@cyli cyli mentioned this pull request May 7, 2018
vdemeester pushed a commit to thaJeztah/docker that referenced this pull request Jun 5, 2018
Changes included:

- moby/swarmkit#2594 [fips] Support a flag that indicates that the cluster requires mandatory FIPS mode on all nodes
- moby/swarmkit#2586 [fips] Propagate the FIPS boolean to the manager, raft storage layer, and raft DEK management

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@cyli cyli mentioned this pull request Jun 7, 2018
2 tasks
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.

3 participants