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

Fix a handful of auto encrypt issues #8211

Merged
merged 5 commits into from
Jul 2, 2020
Merged

Conversation

mkeeler
Copy link
Member

@mkeeler mkeeler commented Jun 30, 2020

  • Ensure that the original auto encrypt CSR contains the DNS and IP SANs from the configuration
  • Initialize State of the agent leaf cert cache fetch result to prevent always issuing a second certificate signing RPC to the servers
  • Move the connect CA signing rate limiter to the Server so that it can be shared with auto-encrypt and the main certificate signing RPC endpoints.
  • Overwrite the agent leaf certificate trust domain on the servers. This ensures that the first certificate sent back is "correct" and has the correct trust domain instead of the dummy one.
  • Fixed a bug where Consul would segfault if no client TLS certificate was available when initiating a connection.

@mkeeler mkeeler requested a review from a team June 30, 2020 13:55
@mkeeler mkeeler force-pushed the bugfix/auto-encrypt-various branch from 87d08cf to 8ab34e5 Compare June 30, 2020 13:57
The initial auto encrypt CSR wasn’t containing the user supplied IP and DNS SANs. This fixes that. Also We were configuring a default :: IP SAN. This should be ::1 instead and was fixed.
This fixes a bug where auto_encrypt was operating without utilizing a common rate limiter.
@mkeeler mkeeler force-pushed the bugfix/auto-encrypt-various branch from 8ab34e5 to 2ddcba0 Compare June 30, 2020 13:59
@mkeeler mkeeler marked this pull request as ready for review June 30, 2020 17:54
Also fix a bug where Consul could segfault if TLS was enabled but no client certificate was provided. How no one has reported this as a problem I am not sure.
@mkeeler mkeeler force-pushed the bugfix/auto-encrypt-various branch from 137efbd to 6e7acfa Compare June 30, 2020 19:23
Copy link
Contributor

@crhino crhino left a comment

Choose a reason for hiding this comment

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

LGTM! Played around with auto_encrypt a bit locally after going over the code with you, and everything worked as expected. Nice finds all around. 👍

Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

LGTM, left a comment.

@@ -480,6 +428,30 @@ func (s *ConnectCA) Sign(
return fmt.Errorf("SPIFFE ID in CSR from a different trust domain: %s, "+
"we are %s", serviceID.Host, signingID.Host())
}
} else {
Copy link
Member

Choose a reason for hiding this comment

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

This could also live in the AutoEncrypt.Sign endpoint, then we wouldn't have to check the cert type. And it would only fix it for the first time when we are starting an agent.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should enforce the trustdomain for agent certs too, after it was fixed once.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason why it cannot go there easily is that we would have to move out all the CSR and URI parsing too.

Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

LGTM

@mkeeler mkeeler merged commit f8e8f48 into master Jul 2, 2020
@mkeeler mkeeler deleted the bugfix/auto-encrypt-various branch July 2, 2020 13:49
@hashicorp-ci
Copy link
Contributor

🍒✅ Cherry pick of commit f8e8f48 onto release/1.8.x succeeded!

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.

4 participants