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

Clarify documentation for TLS encryption setup #55739

Merged
merged 13 commits into from
Jan 29, 2020

Conversation

jportner
Copy link
Contributor

@jportner jportner commented Jan 23, 2020

[skip-ci]

Summary

With the addition of support for PKCS#12 keystores in Kibana 7.6+, the steps to configure TLS became even more convoluted than they were before.

The intent behind this PR is to make TLS configuration steps easier to understand, differentiate how to obtain the Kibana server certificate (via CSR) and the Elasticsearch server certificate (no CSR necessary), adhere to security best practices, and better align with the Elasticsearch documentation for TLS configuration.

I tried to avoid using the word "key store" and "trust store" as much as possible, because those are overloaded terms (and we also reference the Kibana keystore for secure settings).

Preview link: http://kibana_55739.docs-preview.app.elstc.co/diff

Closes #55112.

Normalize columns and remove unnecessary whitespace.
Copy link
Contributor Author

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Author's notes, round 1.

@jportner jportner requested a review from legrego January 23, 2020 19:37
@jportner jportner force-pushed the issue-55512-docs-clarify-tls branch 2 times, most recently from 4a5febf to 2a701e5 Compare January 24, 2020 05:41
@jportner jportner force-pushed the issue-55512-docs-clarify-tls branch from 2a701e5 to 7726841 Compare January 24, 2020 06:50
Copy link
Contributor Author

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Author's notes, round 1.1 (second time's the charm!)

I attempted to do several things:

  • Align with general guidance and format from Elasticsearch documentation
  • Standardize terminology across sections ("client certificate", "server certificate", "outbound", "inbound", etc.)
  • Reformat the guides that shows different options but makes it easier to follow the the recommended steps to set up Kibana in a production environment
  • Encourage the use of the kibana-keystore for storing passwords
  • Add/update references where appropriate

The setup guides do not attempt to show every possible permutation for configuration, they just show the recommended / most common scenario.

Copy link
Member

@legrego legrego 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 looking really good! I think you did a nice job explaining the different settings here. Just a few comments for you to consider

docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
docs/setup/settings.asciidoc Show resolved Hide resolved
@jportner jportner marked this pull request as ready for review January 24, 2020 16:07
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-docs (Team:Docs)

@jportner jportner added release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels Jan 24, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@jportner jportner requested a review from a team January 24, 2020 16:09
@gchaps gchaps self-requested a review January 24, 2020 16:10
docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
@lcawl
Copy link
Contributor

lcawl commented Jan 24, 2020

I think some of these instructions might need to be revisited now that we have the "elasticsearch-certutil http" command in 7.6. I had added a tip in #55357, but I suspect it'll also affect the lower-level instructions in this PR (e.g. where you're describing how to generate a PEM file from a PKCS#12 file).

@jportner
Copy link
Contributor Author

I think some of these instructions might need to be revisited now that we have the "elasticsearch-certutil http" command in 7.6. I had added a tip in #55357, but I suspect it'll also affect the lower-level instructions in this PR (e.g. where you're describing how to generate a PEM file from a PKCS#12 file).

Oh, I got mixed up and thought that was an outdated tip, as I tried to use that command and it didn't work. I didn't realize it was added in ES 7.6. I was using an older version of elasticsearch-certutil when writing these instructions. I'll revisit this, thanks and sorry for the confusion!

@jportner
Copy link
Contributor Author

I think some of these instructions might need to be revisited now that we have the "elasticsearch-certutil http" command in 7.6. I had added a tip in #55357, but I suspect it'll also affect the lower-level instructions in this PR (e.g. where you're describing how to generate a PEM file from a PKCS#12 file).

Oh, I got mixed up and thought that was an outdated tip, as I tried to use that command and it didn't work. I didn't realize it was added in ES 7.6. I was using an older version of elasticsearch-certutil when writing these instructions. I'll revisit this, thanks and sorry for the confusion!

Okay @lcawl, I've taken a look at it, and here are my thoughts:

  • The elasticsearch-certutil http command is completely interactive, it doesn't take any command-line arguments
  • The prompts are geared towards generating CSRs or certificates for Elasticsearch nodes, and some descriptions and options don't make sense when generating a CSR for Kibana ("per node", listing IP addresses, etc.)
  • None of the Elasticsearch TLS documentation appears to use this command (yet)

I think it's another valid way of doing things, but I like how we currently have it written because it's clear-cut with command-line arguments and gives you exactly what you need. If you use the interactive prompt there's more room for error. I think either rewriting this guide with elasticsearch-certutil http, or mentioning that as another option, would muddy the waters unnecessarily.

With that in mind, how do you think we should proceed? Are you OK with leaving this out?

@lcawl
Copy link
Contributor

lcawl commented Jan 24, 2020

  • None of the Elasticsearch TLS documentation appears to use this command (yet)

My PR for that is under review here, if that helps: elastic/elasticsearch#51241

@jportner
Copy link
Contributor Author

My PR for that is under review here, if that helps: elastic/elasticsearch#51241

Ah, yes that does help, thanks.
I didn't realize you were making changes to the "Generating node certificates" section, that makes more sense now.

I don't think the Kibana docs section for "Encrypting traffic between the browser and Kibana" needs any changes, based on that, but I do think that "Encrypting traffic between Kibana and Elasticsearch" needs changes. Let me rework that and let you take another look.

Comment on lines 116 to 133
. Obtain the certificate authority (CA) certificate chain for {es}.
+
--
{kib} needs the appropriate CA certificate chain to properly establish trust when connecting to {es}.

If you followed the {es} documentation for {ref}/configuring-tls.html#node-certificates[generating node certificates], then you likely have
a PKCS#12 file for each your {es} nodes. You can extract the CA certificate chain from one of these files. For example:
.. If you followed the {es} documentation for {ref}/configuring-tls.html#node-certificates[generating node certificates] and used the
`elasticsearch-certutil http` command, check the `kibana` directory in its output. Depending on what options you chose, the output may
include the CA certificate chain in PEM format.

.. Otherwise, you likely have a PKCS#12 file for each your {es} nodes. You can extract the CA certificate chain from one of these files. For
example:
+
--
[source,sh]
--------------------------------------------------------------------------------
openssl pkcs12 -in elastic-certificates.p12 -cacerts -nokeys -out elasticsearch-ca.crt
openssl pkcs12 -in elastic-certificates.p12 -cacerts -nokeys -out elasticsearch-ca.pem
--------------------------------------------------------------------------------

This will produce a PEM-formatted file named `elasticsearch-ca.crt` that contains all CA certificates from the PKCS#12 file.
This will produce a PEM-formatted file named `elasticsearch-ca.pem` that contains all CA certificates from the PKCS#12 file.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this step to account for the new Elasticsearch documentation that will suggest using the elasticsearch-certutil http command. That command creates a ZIP file with a "kibana" directory, which may contain the CA cert (if the user did not choose to generate a CSR).

I also changed "elasticsearch-ca.crt to elasticsearch-ca.pem, since that's the same filename that the elasticsearch-certutil http command would produce.

Copy link
Contributor

@lcawl lcawl left a comment

Choose a reason for hiding this comment

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

The documentation LGTM

Copy link
Contributor

@watson watson left a comment

Choose a reason for hiding this comment

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

Just some tiny formatting nits. Feel free to ignore 😁

docs/setup/settings.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
docs/user/security/securing-communications/index.asciidoc Outdated Show resolved Hide resolved
Co-Authored-By: Thomas Watson <w@tson.dk>
Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

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

LGTM - great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported release_note:skip Skip the PR/issue when compiling release notes Team:Docs Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v7.6.0 v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify TLS encryption setup
7 participants