2017-11-09 17:28:56 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[[configuring-security]]
|
2018-05-01 17:11:38 -04:00
|
|
|
== Configuring security in {es}
|
2017-11-09 17:28:56 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Configuring Security</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
{security} enables you to easily secure a cluster. With {security}, you can
|
|
|
|
password-protect your data as well as implement more advanced security measures
|
|
|
|
such as encrypting communications, role-based access control, IP filtering, and
|
|
|
|
auditing. For more information, see
|
|
|
|
{xpack-ref}/xpack-security.html[Securing the Elastic Stack].
|
2017-11-10 12:33:56 -05:00
|
|
|
|
2018-04-06 14:48:03 -04:00
|
|
|
To use {security} in {es}:
|
|
|
|
|
|
|
|
. Verify that you are using a license that includes the {security} feature.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
If you want to try all of the {xpack} features, you can start a 30-day trial. At
|
|
|
|
the end of the trial period, you can purchase a subscription to keep using the
|
|
|
|
full functionality of the {xpack} components. For more information, see
|
|
|
|
https://www.elastic.co/subscriptions and
|
|
|
|
{xpack-ref}/license-management.html[License Management].
|
|
|
|
--
|
|
|
|
|
|
|
|
. Verify that the `xpack.security.enabled` setting is `true` on each node in
|
|
|
|
your cluster. If you are using a trial license, the default value is `false`.
|
|
|
|
For more information, see {ref}/security-settings.html[Security Settings in {es}].
|
|
|
|
|
|
|
|
. Configure Transport Layer Security (TLS/SSL) for internode-communication.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
NOTE: This requirement applies to clusters with more than one node and to
|
|
|
|
clusters with a single node that listens on an external interface. Single-node
|
|
|
|
clusters that use a loopback interface do not have this requirement. For more
|
|
|
|
information, see
|
|
|
|
{xpack-ref}/encrypting-communications.html[Encrypting Communications].
|
|
|
|
|
|
|
|
--
|
|
|
|
.. <<node-certificates,Generate node certificates for each of your {es} nodes>>.
|
|
|
|
|
|
|
|
.. <<tls-transport, Enable TLS on each {es} node>>.
|
|
|
|
|
|
|
|
. If it is not already running, start {es}.
|
|
|
|
|
|
|
|
. Set the passwords for all built-in users.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
{security} provides
|
|
|
|
{xpack-ref}/setting-up-authentication.html#built-in-users[built-in users] to
|
2018-04-11 11:21:15 -04:00
|
|
|
help you get up and running. The +elasticsearch-setup-passwords+ command is the
|
|
|
|
simplest method to set the built-in users' passwords for the first time.
|
2018-04-06 14:48:03 -04:00
|
|
|
|
|
|
|
For example, you can run the command in an "interactive" mode, which prompts you
|
|
|
|
to enter new passwords for the `elastic`, `kibana`, `beats_system`, and
|
|
|
|
`logstash_system` users:
|
|
|
|
|
|
|
|
[source,shell]
|
|
|
|
--------------------------------------------------
|
2018-04-11 11:21:15 -04:00
|
|
|
bin/elasticsearch-setup-passwords interactive
|
2018-04-06 14:48:03 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
For more information about the command options, see <<setup-passwords>>.
|
|
|
|
|
2018-04-11 11:21:15 -04:00
|
|
|
IMPORTANT: The `elasticsearch-setup-passwords` command uses a transient bootstrap
|
|
|
|
password that is no longer valid after the command runs successfully. You cannot
|
|
|
|
run the `elasticsearch-setup-passwords` command a second time. Instead, you can
|
|
|
|
update passwords from the **Management > Users** UI in {kib} or use the security
|
|
|
|
user API.
|
2018-04-06 14:48:03 -04:00
|
|
|
|
|
|
|
--
|
|
|
|
|
2018-05-01 12:15:13 -04:00
|
|
|
. Choose which types of realms you want to use to authenticate users.
|
|
|
|
** <<configuring-ad-realm,Configure an Active Directory realm>>.
|
2018-05-01 17:11:38 -04:00
|
|
|
** <<configuring-file-realm,Configure a file realm>>.
|
2018-05-02 13:56:31 -04:00
|
|
|
** <<configuring-native-realm,Configure a native realm>>.
|
2018-05-01 16:47:24 -04:00
|
|
|
** <<configuring-pki-realm,Configure a PKI realm>>.
|
2018-05-01 12:15:13 -04:00
|
|
|
|
2018-04-16 13:37:45 -04:00
|
|
|
. Set up roles and users to control access to {es}.
|
|
|
|
For example, to grant _John Doe_ full access to all indices that match
|
|
|
|
the pattern `events*` and enable him to create visualizations and dashboards
|
|
|
|
for those indices in {kib}, you could create an `events_admin` role and
|
|
|
|
and assign the role to a new `johndoe` user.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
[source,shell]
|
|
|
|
----------------------------------------------------------
|
|
|
|
curl -XPOST -u elastic 'localhost:9200/_xpack/security/role/events_admin' -H "Content-Type: application/json" -d '{
|
|
|
|
"indices" : [
|
|
|
|
{
|
|
|
|
"names" : [ "events*" ],
|
|
|
|
"privileges" : [ "all" ]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"names" : [ ".kibana*" ],
|
|
|
|
"privileges" : [ "manage", "read", "index" ]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}'
|
|
|
|
|
|
|
|
curl -XPOST -u elastic 'localhost:9200/_xpack/security/user/johndoe' -H "Content-Type: application/json" -d '{
|
|
|
|
"password" : "userpassword",
|
|
|
|
"full_name" : "John Doe",
|
|
|
|
"email" : "john.doe@anony.mous",
|
|
|
|
"roles" : [ "events_admin" ]
|
|
|
|
}'
|
|
|
|
----------------------------------------------------------
|
|
|
|
// NOTCONSOLE
|
|
|
|
--
|
|
|
|
|
|
|
|
[[enable-auditing]]
|
|
|
|
. Enable auditing to keep track of attempted and successful interactions with
|
|
|
|
your {es} cluster:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
.. Add the following setting to `elasticsearch.yml` on all nodes in your cluster:
|
|
|
|
+
|
|
|
|
[source,yaml]
|
|
|
|
----------------------------
|
|
|
|
xpack.security.audit.enabled: true
|
|
|
|
----------------------------
|
|
|
|
+
|
|
|
|
For more information, see {xpack-ref}/auditing.html[Auditing Security Events]
|
|
|
|
and <<auditing-settings>>.
|
|
|
|
|
|
|
|
.. Restart {es}.
|
|
|
|
|
|
|
|
By default, events are logged to a dedicated `elasticsearch-access.log` file in
|
|
|
|
`ES_HOME/logs`. You can also store the events in an {es} index for
|
|
|
|
easier analysis and control what events are logged.
|
|
|
|
--
|
|
|
|
|
2018-01-12 14:35:16 -05:00
|
|
|
include::securing-communications/securing-elasticsearch.asciidoc[]
|
2017-11-10 12:33:56 -05:00
|
|
|
include::securing-communications/configuring-tls-docker.asciidoc[]
|
2018-01-12 14:35:16 -05:00
|
|
|
include::securing-communications/enabling-cipher-suites.asciidoc[]
|
|
|
|
include::securing-communications/separating-node-client-traffic.asciidoc[]
|
2018-05-01 12:15:13 -04:00
|
|
|
include::authentication/configuring-active-directory-realm.asciidoc[]
|
2018-05-01 17:11:38 -04:00
|
|
|
include::authentication/configuring-file-realm.asciidoc[]
|
2018-05-02 13:56:31 -04:00
|
|
|
include::authentication/configuring-native-realm.asciidoc[]
|
2018-05-01 16:47:24 -04:00
|
|
|
include::authentication/configuring-pki-realm.asciidoc[]
|
2018-01-12 14:35:16 -05:00
|
|
|
include::{xes-repo-dir}/settings/security-settings.asciidoc[]
|
2018-01-18 12:18:24 -05:00
|
|
|
include::{xes-repo-dir}/settings/audit-settings.asciidoc[]
|