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 insecure property for NutanixDatacenterConfig #4171

Merged
merged 4 commits into from
Nov 29, 2022

Conversation

thunderboltsid
Copy link
Contributor

@thunderboltsid thunderboltsid commented Nov 21, 2022

To accommodate for the scenario where the user has not replaced the default Certificate that ships with Prism Central, we allow the user to skip TLS verification. Insecure is the optional property to skip TLS verification.

Nutanix Prism Central installation by default ships with a self-signed certificate that will fail TLS verification because of two reasons:

  1. The certificate is not issued by a publicly trusted CA
  2. The certificate does not have the IP SANs for the Prism Central endpoint

As such, in order for these services to establish a connection with Prism Central, client has three options:

  1. Use Legitimate certificates: Replace the default certificate that comes with Prism Central with a certificate signed by a publicly trusted Certificate Authority e.g. Let’s Encrypt.
  2. Use valid Self-Signed certificates: Replace the default certificate that comes with Prism central with a self-signed certificate that has the IP address/domain populated in the Subject Alternative Names section of the certificate. The Root CA Certificate is provided as an additional trust bundle to add to the certificate pool used to establish the connection. This is signaled using the additionalTrustBundle flag.
  3. Skip TLS Verification: The TLS Verification step needs to be skipped when establishing the connection. The benefit of this approach is that it does not require the default certificate to be replaced.

We intend on supporting all three options until Prism Central starts shipping with valid self-signed certificates.
The recommended order from a customer guidance perspective should be:

  1. Use a Legitimate certificate
  2. Use a valid self-signed certificate and provide the CA cert through the trust bundle
  3. Skip TLS verification

From an application evaluation perspective, the order will be:

  1. If a legitimate certificate is present, nothing needs to be done
  2. If an additionalTrustBundle flag is present, the RootCA cert should be added to the client cert pool when establishing a TLS connection.
  3. If an insecure flag is present and set to true, TLS verification should be skipped regardless of what other properties are set.

How was this tested?
Created a EKS-A cluster on a Nutanix setup (@vnephologist lab) with self-signed certificates using the insecure flag set to true.

@eks-distro-bot
Copy link
Collaborator

Hi @thunderboltsid. Thanks for your PR.

I'm waiting for a aws member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eks-distro-bot eks-distro-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 21, 2022
@codecov
Copy link

codecov bot commented Nov 21, 2022

Codecov Report

Merging #4171 (5002a55) into main (5a6d9da) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #4171   +/-   ##
=======================================
  Coverage   68.27%   68.28%           
=======================================
  Files         404      404           
  Lines       32656    32664    +8     
=======================================
+ Hits        22295    22303    +8     
  Misses       8926     8926           
  Partials     1435     1435           
Impacted Files Coverage Δ
pkg/api/v1alpha1/nutanixdatacenterconfig_types.go 100.00% <ø> (ø)
internal/pkg/api/nutanix.go 82.40% <100.00%> (+0.58%) ⬆️
pkg/dependencies/factory.go 71.94% <100.00%> (+0.03%) ⬆️
pkg/providers/nutanix/template.go 88.80% <100.00%> (ø)
pkg/providers/nutanix/validator.go 97.84% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@thunderboltsid thunderboltsid force-pushed the nutanix-insecure branch 2 times, most recently from e62ca41 to 2bd3ea0 Compare November 21, 2022 17:21
Copy link
Contributor

@deepakm-ntnx deepakm-ntnx left a comment

Choose a reason for hiding this comment

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

pls check my comments before merging

pkg/api/v1alpha1/nutanixdatacenterconfig_types.go Outdated Show resolved Hide resolved
pkg/providers/nutanix/validator.go Outdated Show resolved Hide resolved
@eks-distro-bot
Copy link
Collaborator

@deepakm-ntnx: changing LGTM is restricted to collaborators

In response to this:

pls check my comments before merging

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepakm-ntnx
Copy link
Contributor

just for completeness, noting that this was added thru https://github.com/aws/eks-anywhere/pull/2229/files#diff-f06dc4da7f8574dbb4b599dc7e0fe78fd2c6698991b7659dd23a730d43ba5435R29 but was removed later thru https://github.com/aws/eks-anywhere/pull/3116/files#diff-f06dc4da7f8574dbb4b599dc7e0fe78fd2c6698991b7659dd23a730d43ba5435 due to concerns from EKS-A Team but since this is a supported way in other providers as well, adding it back to be consistent

@thunderboltsid
Copy link
Contributor Author

thunderboltsid commented Nov 22, 2022

just for completeness, noting that this was added thru https://github.com/aws/eks-anywhere/pull/2229/files#diff-f06dc4da7f8574dbb4b599dc7e0fe78fd2c6698991b7659dd23a730d43ba5435R29 but was removed later thru https://github.com/aws/eks-anywhere/pull/3116/files#diff-f06dc4da7f8574dbb4b599dc7e0fe78fd2c6698991b7659dd23a730d43ba5435 due to concerns from EKS-A Team but since this is a supported way in other providers as well, adding it back to be consistent

This was not raised by EKS-A team as a concern but was removed for following better engineering practices by us. However, following the discussion with our product team, and relaying feedback from @abhinavmpandey08 to support both insecure as well as additional trust bundle, we intend on providing support for skipping TLS verification as outlined in the PR description.

@thunderboltsid thunderboltsid force-pushed the nutanix-insecure branch 2 times, most recently from 2edac19 to 2caaafb Compare November 22, 2022 07:38
@thunderboltsid
Copy link
Contributor Author

/assign @abhay-krishna @pokearu

@pokearu
Copy link
Member

pokearu commented Nov 22, 2022

/ok-to-test

@@ -26,6 +26,14 @@ type NutanixDatacenterConfigSpec struct {
// AdditionalTrustBundle is the optional PEM-encoded certificate bundle for users that
// configured their Prism Central with certificates from non-publicly trusted CAs
AdditionalTrustBundle string `json:"additionalTrustBundle,omitempty"`

// Insecure is the optional flag to skip TLS verification. Nutanix Prism Central installation by default ships
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we break these comment lines consistently with the other comment lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

@chrisdoherty4 updated the comments. thanks

Copy link
Contributor

@chrisdoherty4 chrisdoherty4 left a comment

Choose a reason for hiding this comment

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

lgtm with a small comment. Try to limit/have a consistent line length for the reasons outlined in https://github.com/aws/eks-anywhere/blob/main/docs/developer/best-practice.md#line-length.

Insecure is the optional property to skip TLS verification. Nutanix Prism installs by default ship
with a self-signed certificate that will fail TLS verification because of two reasons:
1. The certificate is not issued by a public CA
2. The certificate does not have the IP SANs for the Prism Central endpoint

To accommodate for the scenario where the user has not changed the default Certificate that
ships with Prism Central, we allow the user to skip TLS verification. This is not recommended for
production use as skipping TLS verification opens up the user to potential MITM attacks.
Copy link
Member

@abhinavmpandey08 abhinavmpandey08 left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavmpandey08

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot merged commit bba5709 into aws:main Nov 29, 2022
deepakm-ntnx added a commit to nutanix-cloud-native/aws-eks-anywhere that referenced this pull request Nov 30, 2022
d8660091 pushed a commit to d8660091/eks-anywhere that referenced this pull request Dec 2, 2022
* Add `insecure` property for NutanixDatacenterConfig

Insecure is the optional property to skip TLS verification. Nutanix Prism installs by default ship
with a self-signed certificate that will fail TLS verification because of two reasons:
1. The certificate is not issued by a public CA
2. The certificate does not have the IP SANs for the Prism Central endpoint

To accommodate for the scenario where the user has not changed the default Certificate that
ships with Prism Central, we allow the user to skip TLS verification. This is not recommended for
production use as skipping TLS verification opens up the user to potential MITM attacks.

* Updated the insecure property description based on review feedback

* Add a unit test for validating insecure property

* updated comment to fit the standard length

Co-authored-by: deepakm-ntnx <deepak.muley@nutanix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/providers/nutanix lgtm ok-to-test size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants