-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flags to support CA generation for Connect #9585
Conversation
Constraints []string | ||
Domain string | ||
Name string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New struct to make it less confusing when passing options to GenerateCA
.
if opts.ClusterID != "" { | ||
spiffeID := connect.SpiffeIDSigning{ClusterID: opts.ClusterID, Domain: opts.Domain} | ||
uris = []*url.URL{spiffeID.URI()} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bunch of defaults, that are being used instead of the null values of CAOpts
} | ||
|
||
return buf.String(), nil | ||
return buf.String(), pk, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also return the encoded private key, since it no longer mandatory to pass in.
tlsutil/generate.go
Outdated
template.PermittedDNSDomainsCritical = true | ||
template.PermittedDNSDomains = constraints | ||
template.PermittedDNSDomains = opts.Constraints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should constraints here be named something like DNSNames
or similar? Seems like that would be more descriptive of how the opt is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted for PermittedDNSDomains
because why not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/318212. |
🍒✅ Cherry pick of commit 444cdeb onto |
🍒✅ Cherry pick of commit 444cdeb onto |
There is one caveat: you have to know your clusterID in order to be able to generate a proper Connect CA. There is at least one way to get that: extract it from an existing Consul Connect CA from the very same cluster.