configuring-stack-security.asciidoc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. [[configuring-stack-security]]
  2. == Start the Elastic Stack with security enabled
  3. beta::[This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.]
  4. When you start {es} for the first time, the following security configuration
  5. occurs automatically:
  6. * <<stack-security-certificates,Certificates and keys>> for TLS are
  7. generated for the transport and HTTP layers.
  8. * The TLS configuration settings are written to `elasticsearch.yml`.
  9. * A password is generated for the `elastic` user.
  10. * An enrollment token is generated for {kib}.
  11. You can then start {kib} and enter the enrollment token, which is valid for 30
  12. minutes. This token automatically applies the security settings from your {es}
  13. cluster, authenticates to {es} with the built-in `kibana` service account, and writes the
  14. security configuration to `kibana.yml`.
  15. [discrete]
  16. === Prerequisites
  17. * https://www.elastic.co/downloads/elasticsearch#preview-release[Download] and
  18. unpack the `elasticsearch 8.0.0-beta` package distribution for your
  19. environment.
  20. * https://www.elastic.co/downloads/kibana#preview-release[Download] and unpack
  21. the `kibana 8.0.0-beta` package distribution for your environment.
  22. [discrete]
  23. [[stack-start-with-security]]
  24. === Start {es} and enroll {kib} with security enabled
  25. . From the installation directory, start {es}. A password is generated for the
  26. `elastic` user and output to the terminal, plus an enrollment token for
  27. enrolling {kib}.
  28. +
  29. [source,shell]
  30. ----
  31. bin/elasticsearch
  32. ----
  33. +
  34. TIP: You might need to scroll back a bit in the terminal to view the password
  35. and enrollment token.
  36. . Copy the generated password and enrollment token and save them in a secure
  37. location. These values are shown only when you start {es} for the first time.
  38. +
  39. NOTE: If you need to reset the password for the `elastic` user or other
  40. built-in users, run the <<reset-password,`elasticsearch-reset-password`>> tool.
  41. This tool is available in the {es} `/bin` directory.
  42. . (Optional) Open a new terminal and verify that you can connect to your {es}
  43. cluster by making an authenticated call. Enter the password for the `elastic`
  44. user when prompted:
  45. +
  46. [source,shell]
  47. ----
  48. curl --cacert config/tls_auto_config_<timestamp>/http_ca.crt \
  49. -u elastic https://localhost:9200 <1>
  50. ----
  51. // NOTCONSOLE
  52. <1> Ensure that you use `https` in your call, or the request will fail.
  53. +
  54. `--cacert`::
  55. Path to the generated `http_ca.crt` certificate for the HTTP layer.
  56. . From the directory where you installed {kib}, start {kib}.
  57. +
  58. [source,shell]
  59. ----
  60. bin/kibana
  61. ----
  62. +
  63. This command generates a unique link to enroll your {kib} instance with {es}.
  64. .. In your terminal, click the generated link to open {kib} in your browser.
  65. .. In your browser, paste the enrollment token that you copied and click the
  66. button to connect your {kib} instance with {es}.
  67. .. Log in to {kib} as the `elastic` user with the password that was generated
  68. when you started {es}.
  69. [discrete]
  70. [[stack-enroll-nodes]]
  71. === Enroll additional nodes in your cluster
  72. :slash: /
  73. include::enroll-nodes.asciidoc[]
  74. [discrete]
  75. === What's next?
  76. Congratulations! You've successfully started the {stack} with security enabled.
  77. {es} and {kib} are secured with TLS on the HTTP layer, and internode
  78. communication is encrypted. If you want to enable HTTPS for web traffic, you
  79. can <<encrypt-kibana-browser,encrypt traffic between your browser and {kib}>>.
  80. [discrete]
  81. [[stack-security-certificates]]
  82. === Security certificates and keys
  83. When you start {es} for the first time, the following certificates and keys are
  84. generated in the `config/tls_auto_config_<timestamp>` directory,
  85. which are used to connect a {kib} instance to your secured {es} cluster and
  86. to encrypt internode communication. The files are listed here for reference.
  87. `http_ca.crt`::
  88. The CA certificate that is used to sign the certificates for the HTTP layer of
  89. this {es} cluster.
  90. `http_keystore_local_node.p12`::
  91. Keystore that contains the key and certificate for the HTTP layer for this node.
  92. `transport_keystore_all_nodes.p12`::
  93. Keystore that contains the key and certificate for the transport layer for all
  94. the nodes in your cluster.
  95. Additionally, when you use the enrollment token to connect {kib} to a secured {es} cluster, a security certificate is retrieved from {es} and stored in the
  96. {kib} `/data` directory. This file establishes trust between {kib} and the {es}
  97. Certificate Authority (CA) for the HTTP layer.