configuring-stack-security.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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]
  40. ====
  41. If you need to reset the password for the `elastic` user or other
  42. built-in users, run the <<reset-password,`elasticsearch-reset-password`>> tool.
  43. To generate new enrollment tokens for {kib} or {es} nodes, run the
  44. <<create-enrollment-token,`elasticsearch-create-enrollment-token`>> tool.
  45. These tools are available in the {es} `bin` directory.
  46. ====
  47. . (Optional) Open a new terminal and verify that you can connect to your {es}
  48. cluster by making an authenticated call. Enter the password for the `elastic`
  49. user when prompted:
  50. +
  51. [source,shell]
  52. ----
  53. curl --cacert config/tls_auto_config_<timestamp>/http_ca.crt \
  54. -u elastic https://localhost:9200
  55. ----
  56. // NOTCONSOLE
  57. +
  58. `<timestamp>`:: The timestamp of when the auto-configuration process created
  59. the security files directory in your Docker container.
  60. . From the directory where you installed {kib}, start {kib}.
  61. +
  62. [source,shell]
  63. ----
  64. bin/kibana
  65. ----
  66. +
  67. This command generates a unique link to enroll your {kib} instance with {es}.
  68. .. In your terminal, click the generated link to open {kib} in your browser.
  69. .. In your browser, paste the enrollment token that you copied and click the
  70. button to connect your {kib} instance with {es}.
  71. .. Log in to {kib} as the `elastic` user with the password that was generated
  72. when you started {es}.
  73. [discrete]
  74. [[stack-enroll-nodes]]
  75. === Enroll additional nodes in your cluster
  76. :slash: /
  77. include::enroll-nodes.asciidoc[]
  78. [discrete]
  79. include::{es-ref-dir}/setup/install/connect-clients.asciidoc[leveloffset=-1]
  80. [discrete]
  81. === What's next?
  82. Congratulations! You've successfully started the {stack} with security enabled.
  83. {es} and {kib} are secured with TLS on the HTTP layer, and internode
  84. communication is encrypted. If you want to enable HTTPS for web traffic, you
  85. can <<encrypt-kibana-browser,encrypt traffic between your browser and {kib}>>.
  86. [discrete]
  87. [[stack-security-certificates]]
  88. === Security certificates and keys
  89. When you start {es} for the first time, the following certificates and keys are
  90. generated in the `config/tls_auto_config_<timestamp>` directory,
  91. which are used to connect a {kib} instance to your secured {es} cluster and
  92. to encrypt internode communication. The files are listed here for reference.
  93. `http_ca.crt`::
  94. The CA certificate that is used to sign the certificates for the HTTP layer of
  95. this {es} cluster.
  96. `http_keystore_local_node.p12`::
  97. Keystore that contains the key and certificate for the HTTP layer for this node.
  98. `transport_keystore_all_nodes.p12`::
  99. Keystore that contains the key and certificate for the transport layer for all
  100. the nodes in your cluster.
  101. 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
  102. {kib} `/data` directory. This file establishes trust between {kib} and the {es}
  103. Certificate Authority (CA) for the HTTP layer.