Skip to content
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 SpiffeID for Consul server agents #14485

Conversation

freddygv
Copy link
Contributor

@freddygv freddygv commented Sep 2, 2022

Description

By adding a SpiffeID for server agents, servers can now request a leaf
certificate from the Connect CA.

This new Spiffe ID has a key property: servers are identified by their
datacenter name and trust domain. All servers that share these
attributes will share a ServerURI.

The aim is to use these certificates to verify the server name of ANY
server in a Consul datacenter.

Testing & Reproduction steps

  • Unit tests for Spiffe ID validation and parsing
  • Test with test server to validate certificate signing flow

Links

https://go.hashi.co/csl-204-server-cert

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

@github-actions github-actions bot added the theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies label Sep 2, 2022
By adding a SpiffeID for server agents, servers can now request a leaf
certificate from the Connect CA.

This new Spiffe ID has a key property: servers are identified by their
datacenter name and trust domain. All servers that share these
attributes will share a ServerURI.

The aim is to use these certificates to verify the server name of ANY
server in a Consul datacenter.
@freddygv freddygv force-pushed the NET-818-add-an-internally-managed-server-certificate-for-consul-servers branch from 99dbd14 to f95a6d2 Compare September 3, 2022 00:03
@freddygv freddygv added the pr/no-changelog PR does not need a corresponding .changelog entry label Sep 6, 2022
@freddygv freddygv marked this pull request as ready for review September 6, 2022 13:26
@freddygv freddygv requested review from a team and dhiaayachi and removed request for a team September 6, 2022 13:27
agent/connect/uri_signing_test.go Outdated Show resolved Hide resolved
Comment on lines +227 to +230
// ServerURI is the URI value of a cert issued for a server agent.
// The same URI is shared by all servers in a Consul datacenter.
ServerURI string `json:",omitempty"`

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why IssuedCert isn't exported from the API package? Looks like it's returned from at least one endpoint /v1/agent/connect/ca/leaf/test?token=<token>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DanStough It is in the api package, but for some reason it has a different name there. I assume it was for clarity? 9638466

Cert type:

type LeafCert struct {

Endpoint client:
func (a *Agent) ConnectCALeaf(serviceID string, q *QueryOptions) (*LeafCert, *QueryMeta, error) {

We don't need to expose ServerURI via that type because users can't request leaf certs for Consul servers.

@freddygv freddygv merged commit f4dfd42 into main Sep 6, 2022
@freddygv freddygv deleted the NET-818-add-an-internally-managed-server-certificate-for-consul-servers branch September 6, 2022 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-changelog PR does not need a corresponding .changelog entry theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants