-
Notifications
You must be signed in to change notification settings - Fork 114
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
AWS ACM Private CA support #256
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
skiptomyliu
reviewed
Jan 29, 2020
skiptomyliu
reviewed
Jan 29, 2020
6207c2f
to
6135852
Compare
skiptomyliu
reviewed
Feb 11, 2020
skiptomyliu
reviewed
Feb 11, 2020
c884cae
to
884d5cc
Compare
ebfa2ee
to
3a6e2c4
Compare
skiptomyliu
reviewed
Feb 21, 2020
skiptomyliu
reviewed
Feb 21, 2020
skiptomyliu
reviewed
Feb 21, 2020
Looks good, just a few minor comments. |
skiptomyliu
previously approved these changes
Feb 22, 2020
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.
Don't wanna block. Minor follow up changes we can make later.
skiptomyliu
approved these changes
Feb 25, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds support for using ACM Private CA to provide an authenticated shim for issuing certificates for clients. Four endpoints are included,
GET /v1/certificates/<ca>/<cn>
,POST /v1/certificates/<ca>
,GET /v1/cas
andGET /v1/cas/<ca>
. The GET certificate endpoint takes a certificate authority name (ca), and a common name argument (cn), generates a private key, CSR, and certificate for the given cn and returns a certificate, private_key and certificate_chain. The POST certificate endpoint takes a<ca>
argument and acsr
in the data body, and returns a certificate, and certificate chain issued for the CSR. Both endpoints accept a san argument (a URL param for GET, and a key/value in the POST body), which can be added as an extension. Both endpoints also accept avalidity
argument, which specify the number of days the certificate will be valid for. There's a setting to limit the max validity. The GET cas endpoint lists all configured CAs, and returns a certificate, certificate chain and a dictionary of tags for each CA. The GET ca endpoint returns certificate, certificate chain and a dictionary of tags for the specified ca.This implementation support multiple CAs, defined in the
ACM_PRIVATE_CAS
setting, which is a comma delimited list of friendly names for the CAs. Settings for each CA are pulled from environment variables, postfixed with the friendly CA name, in all uppercase. e.g.ACM_PRIVATE_CAS='testca'; ACM_PRIVATE_CA_ARN_TESTCA='arn:...'
This implementation is just a pass-through, so each call will result in a certificate being generated, even if it's for the same CN with the same validity period. The idempotency token used in the ACM call is only effective for avoiding re-issuing certs within a short-period of time for the exact same CSR.
A simple cost-savings cache is included for the
GET /v1/certificates/<ca>/<cn>
endpoint, which will cache the csr/key/certificate in-memory, per-process. Locking is used between threads in the process to ensure that if a thread is issuing a certificate, other threads attempting to issue the same certificate will wait until the initial certificate issued, then will return the certificate from the cache.