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

feat(appmesh): allow configuring mutual TLS #15101

Merged
merged 14 commits into from Jun 23, 2021
Merged

feat(appmesh): allow configuring mutual TLS #15101

merged 14 commits into from Jun 23, 2021

Conversation

Seiya6329
Copy link
Contributor

@Seiya6329 Seiya6329 commented Jun 11, 2021

This is the last part of the series to implement mTLS feature.
For the breakdown on series, please refer to this comment.

Collaborators

@alexbrjo and @dfezzie. Thank you!

REV

  • Adding SDS certificate source to TlsCertificate and TlsValidationTrust.
  • Adding subjectAlternativeNames property to TlsValidation.
  • Adding mutualTlsCertificate property to ClientPolicyTlsOptions
  • Adding mutualTlsValidation property to ListenerTlsOptions
  • Updating README to include mTLS implementation example.
  • Updating TlsValidationTrustConfig to have single property

Design Note:

  • Client certificates in a TLS Client Policy and server validation in a listener TLS configuration can only be sourced from SDS or File certificate. ACM certificate is currently not supported (reference doc)
    • Compile-error is implemented to block assigning ACM certificate.
  • TlsValidationTrustConfig is updated to have single property to reduce the repetitions since all four properties share same shape.
  • SubjectAlternativeNames is modeled as an abstract class to include the factory method. In future if more match patterns are added, use or() method to extend.

Closes #12733.

BREAKING CHANGE: static methods from TlsValidationTrust have been changed to accept positional arguments

  • appmesh: static methods from TlsCertificate have been changed to accept positional arguments
  • appmesh: the type TlsListener has been renamed to ListenerTlsOptions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Jun 11, 2021

@mergify
Copy link
Contributor

mergify bot commented Jun 11, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@Seiya6329 Seiya6329 changed the title feat(appmesh) : implementing mutual TLS feature feat(appmesh): implementing mutual TLS feature Jun 13, 2021
@Seiya6329 Seiya6329 force-pushed the mTLS branch 2 times, most recently from a104a0d to 5f0795c Compare June 13, 2021 07:26
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

I have to say, I have some trouble following the justification for many of the changes in this PR.

@Seiya6329 I've left you a few comments, and a lot of questions. Would appreciate some clarification 🙂.

packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/virtual-node-listener.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-gateway.ts Outdated Show resolved Hide resolved
@Seiya6329 Seiya6329 requested a review from skinny85 June 16, 2021 17:20
@mergify mergify bot dismissed skinny85’s stale review June 16, 2021 17:28

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the answers to my questions @Seiya6329! They were super helpful. I now have a good vision of the goals of this PR, and how it should look.

Let me know what you think of my proposed changes!

packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/private/utils.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-client-policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-client-policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
@Seiya6329
Copy link
Contributor Author

REV#3:

  • Replacing to use compile-time error to restrict ACM certificate source to be selected for mTLS
  • Changing the name for:
    • TlsListener => ListenerTls
    • TlsClientPolicy => ClientPolicyTls
  • Updating TlsCertificate and TlsValidationTrust's factory methods to use positional argument instead of props
  • Updating README to reflect changes.

Copy link
Contributor

@dfezzie dfezzie left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Just a nit about a comment and I agree with the SAN match change.

packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
@Seiya6329
Copy link
Contributor Author

Seiya6329 commented Jun 21, 2021

REV4:

  • Changing the SubjectAlternativeNames to an abstract class with the factory method
  • Renaming few objects
    • ClientPolicyTls => `ClientPolicyTlsOptions
    • 'ListernerTls=>ListenerTlsOptions`
    • MutualTLS... => MutualTls...
    • SubjectiveAlternativeNames => SubjectAlternativeNames
  • Updating the @default for subjectAlternativeNames property

@Seiya6329 Seiya6329 requested a review from skinny85 June 21, 2021 21:27
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

This is really looking great! Some comments, mainly related to naming.

Also, make sure to edit the description of the PR to include all of the breaking changes that are made as part of this PR, like you did in #14856 (comment).

packages/@aws-cdk/aws-appmesh/lib/shared-interfaces.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/listener-tls-options.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/private/utils.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
@Seiya6329
Copy link
Contributor Author

Thanks @skinny85 for pointing out about the breaking change! I totally overlooked at it since my original plan was not to introduce any of them.

@skinny85 skinny85 added effort/small Small work item – less than a day of effort p1 labels Jun 22, 2021
@mergify mergify bot dismissed skinny85’s stale review June 22, 2021 21:13

Pull request has been modified.

@Seiya6329
Copy link
Contributor Author

Seiya6329 commented Jun 22, 2021

REV5:

  • Renaming
    • classes from MutualTlsAuthEligible... => MutualTls...
    • property from mutualTlsAuth... -> mutualTls...
    • the interface
    • unused error check
    • the method
    • static method in the SubjectAlternativeNames
  • Updating README to use up-to-date property names

@Seiya6329 Seiya6329 requested a review from skinny85 June 22, 2021 21:52
@Seiya6329
Copy link
Contributor Author

REV6

  • Changing the matchingExactly() to accept rest parameter
  • Reverting back tlsClientPolicy name

@Seiya6329
Copy link
Contributor Author

@skinny85 - I think I was able to address all the pending feedback and updated the main comment. Thanks for working along with me on this!

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

The code looks perfect @Seiya6329! Fix the few remaining ReadMe issues, and we'll merge this in.

packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
@Seiya6329
Copy link
Contributor Author

REV7:

  • Fixing the property names in README

@Seiya6329 Seiya6329 requested a review from skinny85 June 23, 2021 19:12
skinny85
skinny85 previously approved these changes Jun 23, 2021
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks great!

@mergify mergify bot dismissed skinny85’s stale review June 23, 2021 20:02

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@skinny85 skinny85 changed the title feat(appmesh): implementing mutual TLS feature feat(appmesh): allow configuring mutual TLS Jun 23, 2021
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: b14f72e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit e47a01f into aws:master Jun 23, 2021
@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
This is the last part of the series to implement mTLS feature.
For the breakdown on series, please refer to [this comment](aws#14782 (comment)).

#### Collaborators
@alexbrjo and @dfezzie. Thank you!

#### REV
 - Adding SDS certificate source to `TlsCertificate` and `TlsValidationTrust`.
 - Adding `subjectAlternativeNames` property to `TlsValidation`.
 - Adding `mutualTlsCertificate` property to `ClientPolicyTlsOptions`
 - Adding `mutualTlsValidation` property to `ListenerTlsOptions`
 - Updating `README` to include mTLS implementation example.
 - Updating `TlsValidationTrustConfig` to have single property

#### Design Note:
 - Client certificates in a TLS Client Policy and server validation in a listener TLS configuration can only be sourced from `SDS` or `File` certificate. ACM certificate is currently not supported ([reference doc](https://docs.aws.amazon.com/app-mesh/latest/userguide/mutual-tls.html))
   - Compile-error is implemented to block assigning ACM certificate.
- `TlsValidationTrustConfig` is updated to have single property to reduce the repetitions since all four properties share same shape.
- `SubjectAlternativeNames` is modeled as an abstract class to include the factory method. In future if more match patterns are added, use `or()` method to extend.

Closes aws#12733.

BREAKING CHANGE: static methods from `TlsValidationTrust` have been changed to accept positional arguments
- **appmesh**: static methods from `TlsCertificate` have been changed to accept positional arguments
- **appmesh**: the type `TlsListener` has been renamed to `ListenerTlsOptions`

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appmesh Related to AWS App Mesh effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(appmesh): Implement Mutual TLS feature
5 participants