-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[Kerberos] Add documentation for Kerberos realm #32662
Changes from 7 commits
b08ca5b
b0c93a7
98012d4
bfd23a1
d257531
b40799a
447dde2
5417703
8386a98
514d043
3141d55
2625ac3
4d90102
2c9df46
3aa5f71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1056,6 +1056,34 @@ Specifies the supported protocols for TLS/SSL. | |
Specifies the | ||
cipher suites that should be supported. | ||
|
||
[float] | ||
[[ref-kerberos-settings]] | ||
===== Kerberos realm settings | ||
|
||
For a Kerberos realm, the `type` must be set to `kerberos`. In addition to the | ||
<<ref-realm-settings,settings that are valid for all realms>>, you can specify | ||
the following settings: | ||
|
||
`keytab.path`:: Specifies the path to the Kerberos keytab file that contains the | ||
service principal used by this {es} node. It expects the keytab file to be present in `ES_PATH_CONF` | ||
and have read permissions. Required. | ||
|
||
`remove_realm_name`:: Set to `true` to remove the realm part of principal names. | ||
Principal names in Kerberos have the form `user/instance@REALM`. If this option | ||
is `true`, the realm part (`@REALM`) is removed before setting the `username` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this goes into the code too much. I would just say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the unwanted information. Thanks. |
||
field in `User`. The shortened `username` value can then used during role mapping. | ||
Defaults to `false`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean you can't use role mappings unless that realm part is removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is a option to decide whether to keep the |
||
|
||
`krb.debug`:: Set to `true` to enable debug logs for the Java login module that | ||
provides support for Kerberos authentication. Defaults to `false`. | ||
|
||
`cache.ttl`:: The time-to-live for cached user entries. A user is cached for | ||
this period of time. Specify the time period using the standard {es} | ||
<<time-units,time units>>. Defaults to `20m`. | ||
|
||
`cache.max_users`:: The maximum number of user entries that can live in the | ||
cache at any given time. Defaults to 100,000. | ||
|
||
[float] | ||
[[load-balancing]] | ||
===== Load balancing and failover | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
[role="xpack"] | ||
[[configuring-kerberos-realm]] | ||
=== Configuring a Kerberos realm | ||
|
||
Kerberos is used to protect services and uses a ticket-based authentication | ||
protocol to authenticate users. | ||
You can configure {es} to use the Kerberos V5 authentication protocol, which is | ||
an industry standard protocol, to authenticate users. | ||
In this scenario, clients must present Kerberos tickets for authentication. | ||
|
||
In Kerberos, users authenticate with an authentication service and later | ||
with a ticket granting service to generate a TGT (ticket-granting ticket). | ||
This ticket is then presented to the service for authentication. | ||
Refer to your Kerberos installation documentation for more information about | ||
obtaining TGT. {es} clients must first obtain a TGT then initiate the process of | ||
authenticating with {es}. | ||
|
||
For a summary of Kerberos terminology, see {stack-ov}/kerberos-realm.html[Kerberos authentication]. | ||
|
||
==== Before you begin | ||
|
||
. Deploy Kerberos. | ||
+ | ||
-- | ||
You must have the Kerberos infrastructure set up in your environment. | ||
|
||
NOTE: Kerberos requires a lot of external services to function properly, such as | ||
time synchronization between all machines and working forward and reverse DNS | ||
mappings in your domain. Refer to your Kerberos documentation for more details. | ||
|
||
These instructions do not cover setting up and configuring your Kerberos | ||
deployment. Where examples are provided, they pertain to an MIT Kerberos V5 | ||
deployment. For more information, see | ||
http://web.mit.edu/kerberos/www/index.html[MIT Kerberos documentation] | ||
-- | ||
|
||
. Configure Java GSS. | ||
+ | ||
-- | ||
|
||
{es} uses Java GSS framework support for Kerberos authentication. | ||
To support Kerberos authentication, {es} needs the following files: | ||
|
||
* `krb5.conf`, a Kerberos configuration file | ||
* A `keytab` file that contains credentials for the {es} service principal | ||
|
||
The configuration requirements depend on your Kerberos setup. Refer to your | ||
Kerberos documentation to configure the `krb5.conf` file. | ||
|
||
For more information on Java GSS, see | ||
https://docs.oracle.com/javase/10/security/kerberos-requirements1.htm[Java GSS Kerberos requirements] | ||
-- | ||
|
||
==== Create a Kerberos realm | ||
|
||
To configure a Kerberos realm in {es}: | ||
|
||
. Enable SSL/TLS for HTTP. | ||
+ | ||
-- | ||
|
||
If your {es} cluster is operating in production mode, then you must | ||
configure the HTTP interface to use SSL/TLS before you can enable | ||
Kerberos authentication. | ||
|
||
For more information, see | ||
{ref}/configuring-tls.html#tls-http[Encrypting HTTP Client Communications]. | ||
|
||
-- | ||
|
||
. Configure the JVM to find the Kerberos configuration file. | ||
+ | ||
-- | ||
{es} uses Java GSS and JAAS Krb5LoginModule to support Kerberos authentication | ||
using a Simple and Protected GSSAPI Negotiation Mechanism (SPNEGO) mechanism. | ||
The Kerberos configuration file (`krb5.conf`) provides information such as the | ||
default realm, the Key Distribution Center (KDC), and other configuration details | ||
required for Kerberos authentication. When the JVM needs some configuration | ||
properties, it tries to find those values by locating and loading this file. The | ||
JVM system property to configure the file path is `java.security.krb5.conf`. To | ||
configure JVM system properties see {ref}/jvm-options.html[configuring jvm options]. | ||
If this system property is not specified, Java tries to locate the file based on | ||
the conventions. | ||
|
||
TIP: It is recommended that this system property be configured for {es}. | ||
The method for setting this property depends on your Kerberos infrastructure. | ||
Refer to your Kerberos documentation for more details. | ||
|
||
For more information, see http://web.mit.edu/kerberos/krb5-latest/doc/admin/conf_files/krb5_conf.html[krb5.conf] | ||
|
||
-- | ||
|
||
. Create a keytab for the service node. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is unclear what is meant by "the service node" here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it to |
||
+ | ||
-- | ||
A keytab is a file that stores pairs of principals and encryption keys. {es} | ||
uses the key from the keytab to decrypt the tickets presented by the user. You | ||
must create a keytab for {es} by using the tools provided by your Kerberos | ||
implementation. For example, some tools that create keytabs are `ktpass.exe` on | ||
Windows and `kadmin` for MIT Kerberos. | ||
-- | ||
|
||
. Put the keytab file in the `ES_PATH_CONF`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per earlier comment, can we put it in a different path if keytab.path is set appropriately? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, we cannot put keytab in different path as we need permissions to access the file. Thank you. |
||
+ | ||
-- | ||
Make sure that this keytab file has read permissions. This file contains | ||
credentials, therefore you must take appropriate measures to protect it. | ||
|
||
IMPORTANT: On every {es} node, there must be a keytab file for the HTTP | ||
principal. The keytab files are unique for each node since they include the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the first time we've referred to an "HTTP principal". Can this be clarified? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarified further, Thank you. |
||
hostname. Usually it will be of format `HTTP/es.domain.local@ES.DOMAIN.LOCAL`. | ||
An {es} node can act as any principal a client requests as long as that | ||
principal and its credentials are found in the configured keytab. | ||
|
||
-- | ||
|
||
. Create a Kerberos realm. | ||
+ | ||
-- | ||
|
||
To enable Kerberos authentication in {es}, you must add a Kerberos realm in the | ||
realm chain. | ||
|
||
NOTE: You can configure only one Kerberos realm on {es} nodes. | ||
|
||
To configure a Kerberos realm, there are few mandatory realm settings and | ||
other optional settings that you need to configure in the `elasticsearch.yml` | ||
configuration file. Add a realm of type `kerberos` under the | ||
`xpack.security.authc.realms` namespace. | ||
|
||
The most common configuration for a Kerberos realm is as follows: | ||
|
||
[source, yaml] | ||
------------------------------------------------------------ | ||
xpack.security.authc.realms.kerb1: | ||
type: kerberos | ||
order: 3 | ||
keytab.path: es.keytab | ||
remove_realm_name: false | ||
------------------------------------------------------------ | ||
|
||
The `username` is extracted from the ticket presented by user and usually has | ||
the format `username@REALM`. This `username` can then be used for mapping | ||
roles to the user. There is a realm setting `remove_realm_name` which when | ||
set to `true` removes the realm part (`@REALM`) and the resulting `username` can | ||
then be used for role mapping. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per previous comment, this seems to imply that you can't use role mappings successfully unless you set remove_realm_name to true. Is that right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, as explained above changed the wording as suggested by Jay. Thank you. |
||
|
||
For detailed information of available realm settings, | ||
see {ref}/security-settings.html#ref-kerberos-settings[Kerberos realm settings]. | ||
|
||
-- | ||
|
||
. Restart {es} | ||
|
||
. Map Kerberos users to roles. | ||
+ | ||
-- | ||
|
||
The `kerberos` realm enables you to map Kerberos users to roles. You can | ||
configure these role mappings by using the | ||
{ref}/security-api-role-mapping.html[role-mapping API] or a file stored on each | ||
node. You identify users by their `username` field. | ||
|
||
The following example uses the role mapping API to map `user@REALM` to the roles | ||
`monitoring` and `user`: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
POST _xpack/security/role_mapping/kerbrolemapping | ||
{ | ||
"roles" : [ "monitoring_user" ], | ||
"enabled": true, | ||
"rules" : { | ||
"field" : { "username" : "user@REALM" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
// CONSOLE | ||
|
||
For more information, see {stack-ov}/mapping-roles.html[Mapping users and groups to roles]. | ||
-- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that the keytab file must be in the ES_PATH_CONF, or is that just the default location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it must be in the ES_PATH_CONF else elasticsearch will not have file permissions to access it unless we go. This is as per default installation. We can modify java security policy and give a different location but I am not sure if we mention that anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we say something similar for other files such as certificates? I think we should just be consistent with what we say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, at places we say to put certificates in es configuration directory and have updated this to be consistent with what we say. Thank you.