Skip to content

Conversation

@jsoriano
Copy link
Member

Initially implemented as part of #789, moved to a separate PR for clarity.

Add support for custom CAs for TLS in clients for Elasticsearch and Kibana.
Include helpers to create certificate pools that include a given CA certificate file.

Related to #654.

@jsoriano jsoriano requested a review from a team June 14, 2022 16:10
@jsoriano jsoriano self-assigned this Jun 14, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 14, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-06-20T12:03:58.944+0000

  • Duration: 32 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 740
Skipped 0
Total 740

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 14, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (31/31) 💚
Files 66.667% (74/111) 👍 2.121
Classes 61.538% (96/156) 👍 2.184
Methods 49.282% (309/627) 👍 1.694
Lines 33.162% (2781/8386) 👍 1.149
Conditionals 100.0% (0/0) 💚

Comment on lines 14 to 23
// PoolWithCACertificate returns a new pool that includes the CA certificate
// in the given path.
func PoolWithCACertificate(path string) (*x509.CertPool, error) {
pool := x509.NewCertPool()
err := addCACertificateToPool(pool, path)
if err != nil {
return nil, err
}
return pool, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

question Currently, it is just being used the function related to the system certs pool. Should this one be kept too? It's true that it could allow us to test just a subset of CAs in case it is needed easily.

Copy link
Member Author

Choose a reason for hiding this comment

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

In #789 I will also use it to check that the CA in the profile verifies the service certificates.

I can remove it by now, it may happen that we don't use it at the end, depending on the other PR 🙂

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

only few nit-picks, nothing blocking

}

// Address option sets the host to use to connect to Kibana.
func Address(address string) ClientOption {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that this function will be used in the original PR, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe drop a CONTRIBUTING.md with instructions to generate those :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Added as comment in the tests.

@jsoriano jsoriano requested review from mrodm and mtojek June 20, 2022 12:05
@jsoriano
Copy link
Member Author

Thanks for the reviews! Comments addressed, ready for another review.

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM

@jsoriano jsoriano merged commit 28e2fc6 into elastic:main Jun 20, 2022
@jsoriano jsoriano deleted the cacert-clients branch June 20, 2022 15:47
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