configuring-stack-security.asciidoc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/certs/http_ca.crt -u elastic https://localhost:9200
  54. ----
  55. // NOTCONSOLE
  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. include::{es-ref-dir}/setup/install/connect-clients.asciidoc[leveloffset=-1]
  76. [discrete]
  77. === What's next?
  78. Congratulations! You've successfully started the {stack} with security enabled.
  79. {es} and {kib} are secured with TLS on the HTTP layer, and internode
  80. communication is encrypted. If you want to enable HTTPS for web traffic, you
  81. can <<encrypt-kibana-browser,encrypt traffic between your browser and {kib}>>.
  82. [discrete]
  83. [[stack-security-certificates]]
  84. === Security certificates and keys
  85. When you start {es} for the first time, the following certificates and keys are
  86. generated in the `config/certs` directory,
  87. which are used to connect a {kib} instance to your secured {es} cluster and
  88. to encrypt internode communication. The files are listed here for reference.
  89. `http_ca.crt`::
  90. The CA certificate that is used to sign the certificates for the HTTP layer of
  91. this {es} cluster.
  92. `http.p12`::
  93. Keystore that contains the key and certificate for the HTTP layer for this node.
  94. `transport.p12`::
  95. Keystore that contains the key and certificate for the transport layer for all
  96. the nodes in your cluster.
  97. 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
  98. {kib} `/data` directory. This file establishes trust between {kib} and the {es}
  99. Certificate Authority (CA) for the HTTP layer.