Skip to content
Draft
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
4 changes: 4 additions & 0 deletions internal/rest/resources/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ func clusterPost(s types.State, r *http.Request) types.Response {
return fmt.Errorf("Joining server certificate SAN does not contain join token name")
}

if req.Name != record.Name {

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.

#204 added the ability to account for member name changes after creating the token.

In this PR, this commit added the check you see a few lines above. If the SAN field of the cert provided by the joiner does not contain the name of the join token record, it errors out.

So my question is why do you require this extra check, if the one above should already error out? When the new member creates its server.crt, it uses its own name.
Do you maybe modify the members server.crt prior to performing the join?

return fmt.Errorf("Joining cluster member name %q does not match token name %q", req.Name, record.Name)
}

_, err = cluster.CreateCoreClusterMember(ctx, tx, dbClusterMember)
if err != nil {
return err
Expand Down