-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 5 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,223 @@ | ||
[role="xpack"] | ||
[[configuring-kerberos-realm]] | ||
=== Configuring a Kerberos realm | ||
|
||
Kerberos is used to protect services and uses ticket based authentication | ||
protocol to authenticate users. | ||
You can configure {security} to support Kerberos V5 authentication, | ||
an industry standard protocol to authenticate users in {es}. | ||
This requires clients to present Kerberos tickets for authentication. | ||
|
||
In Kerberos, user authenticates with authentication service and later | ||
with 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 to | ||
know more on obtaining TGT. {es} clients would need to first obtain | ||
TGT and then initiate the process of authenticating with {es}. | ||
|
||
==== Terminology | ||
|
||
Few terms before setting up Kerberos realm for {es}: | ||
|
||
_kdc_:: | ||
Key Distribution Center. A service that issues Kerberos tickets. | ||
|
||
_principal_:: | ||
A Kerberos _principal_ is a unique identity to which Kerberos can assign | ||
tickets. It can be used to identify a user or a service provided by a | ||
server. | ||
Kerberos V5 principal names are of format `primary/instance@REALM`, where | ||
|
||
`primary` is user name. | ||
|
||
`instance` is optional string that qualifies the primary and is separated | ||
by `/` from primary. For a user usually it is not used and in case host | ||
it is fully qualified domain name of the host. | ||
|
||
`REALM` is Kerberos realm. Usually domain name in upper case. | ||
An example of a typical user principal is `[email protected]` and for | ||
a typical service principal is `HTTP/[email protected]`. | ||
|
||
_realm_:: | ||
They define administrative boundary within which authentication server | ||
has authority to authenticate users and services. | ||
|
||
_keytab_:: | ||
A file that stores pairs of _principal_ and its encryption key. | ||
|
||
IMPORTANT: Anyone with read permissions to this file can use the | ||
credentials in the network to access other services so it is important | ||
to protect it with proper file permissions. | ||
|
||
_krb5.conf_:: | ||
A file containing Kerberos configuration information like default realm | ||
name, location of Key distribution centers (KDC), realms information, | ||
mappings from domain names to Kerberos realms, default configurations for | ||
realm session key encryption types etc. | ||
|
||
_ticket granting ticket (TGT)_:: | ||
TGT is an authentication ticket generated by the Kerberos authentication | ||
server containing encrypted authenticator. | ||
|
||
==== Requirements | ||
|
||
. Kerberos Deployment | ||
+ | ||
-- | ||
You must have Kerberos infrastructure setup in your environment. | ||
|
||
NOTE: Kerberos requires a lot of external services to function properly | ||
like time synchronization between all machines, a working forward and | ||
reverse DNS mappings in your domain. Please refer to your Kerberos | ||
documentation for more details. | ||
|
||
Setting up and configuration of Kerberos deployment is out of scope for | ||
this document. This document uses MIT Kerberos V5 as reference | ||
implementation. | ||
|
||
For more information, | ||
|
||
See http://web.mit.edu/kerberos/www/index.html[MIT Kerberos documentation] | ||
-- | ||
|
||
. Java GSS Requirements | ||
+ | ||
-- | ||
|
||
{es} uses Java GSS framework support for Kerberos authentication. | ||
To support Kerberos authentication {es} needs following: | ||
|
||
- _krb5.conf_ Kerberos configuration file | ||
|
||
- _keytab_ keytab containing credentials for {es} service principal | ||
|
||
The configuration requirements depend on your Kerberos setup and you | ||
need to refer to your Kerberos documentation to configure _krb5.conf_. | ||
|
||
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 | ||
|
||
Following are the steps to enable Kerberos realm: | ||
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. Maybe 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. Lisa addressed this in her commit. Thank you. |
||
|
||
. Enable SSL/TLS for HTTP | ||
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. is this really a requirement? 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. Not entirely as in it can function without enabling TLS. Some clients like Apache HTTP client do not complete the mutual authentication step to verify server. We can remove this if we do not want to have this as a hard requirement. We do not explicitly enforce this. Please suggest. Thank you. 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. If we do not enforce it, then we should remove it. |
||
+ | ||
-- | ||
|
||
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 JVM with Kerberos configuration file | ||
+ | ||
-- | ||
|
||
`krb5.conf` is the Kerberos configuration file. {es} uses Java GSS and | ||
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. s/is the/is the name of 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. Lisa addressed this in her commit. Thank you. |
||
JAAS Krb5LoginModule to support Kerberos authentication using Spnego | ||
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. the JAAS Krb5LoginModule. s/Spnego/the SPNEGO 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. Lisa addressed this in her commit. Thank you. |
||
mechanism. This configuration file provides information like default realm, | ||
KDC and other configurations required for Kerberos authentication. | ||
When JVM needs some configuration properties it tries to find those values | ||
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. s/When JVM/When the JVM 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. Done, Thank you. |
||
by locating and loading this file. JVM system property to configure 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. s/JVM/The JVM 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, Thank you. |
||
file path is `java.security.krb5.conf` and to configure JVM system properties | ||
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. s/and to configure JVM system properties/; see {ref}/jvm-options.html[configuring jvm options] for details on configuring this system property 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. Done, Thank you. |
||
see {ref}/jvm-options.html[configuring jvm options]. If this system property | ||
is not specified then java tries to locate the file based on the conventions. | ||
It is recommended that this system property be configured for {es}. | ||
Depending on your Kerberos infrastructure you will need to configure | ||
appropriate settings. 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 Keytab for service node | ||
+ | ||
-- | ||
|
||
{es} uses secret key from the configured keytab to decrypt the tickets | ||
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. s/key/keys 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. Done, Thank you. |
||
presented by the user. You will need to create keytab for {es} using tools | ||
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. s/keytab/a keytab file 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. Done, Thank you. |
||
provided by your Kerberos implementation. For example, `ktpass.exe` on | ||
Windows or `kadmin` for MIT Kerberos are some tools that can be used | ||
for creation of keytabs. Place this keytab file in the `ES_PATH_CONF`. | ||
Make sure that this keytab file has read permissions. As this file contains | ||
credentials appropriate measures must be taken to protect it. | ||
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. Can we clarify further the principal names to use for Elasticsearch? I saw in the code that we allow logging in for principal 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. Sure, I will update this to add that information. Thank you. |
||
|
||
IMPORTANT: On every {es} node, there must be a keytab file for HTTP | ||
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. s/HTTP/the HTTP 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. Done, Thank you. |
||
principal. The keytab files are unique for each node as they include the | ||
hostname. Usually it will be of format `HTTP/[email protected]` | ||
{es} node can act as any principal a client requests as long as that | ||
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. s/node/nodes 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. Done, thank you. |
||
principal and its credentials are found in the configured keytab. | ||
|
||
-- | ||
|
||
. Create realm | ||
+ | ||
-- | ||
|
||
Kerberos authentication is enabled by configuring a Kerberos realm | ||
within the authentication chain for {es}. | ||
|
||
NOTE: You can only have one Kerberos realm configured on a {es} node. | ||
|
||
To configure Kerberos realm, there are few mandatory realm settings and | ||
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. s/Kerberos/a Kerberos. s/there are/there are a 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. Addressed, Thank you. |
||
other optional settings that you need to configure in `elasticsearch.yml` | ||
configuration file. Add realm configuration of type `kerberos` under | ||
the `xpack.security.authc.realms` namespace. | ||
|
||
Most common configuration for Kerberos realm is as follows: | ||
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. s/Most/A 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. Done, Thank you. |
||
|
||
[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 | ||
is of 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 resultant | ||
`username` can then be used for role mapping. | ||
|
||
For detailed information of available realm settings, | ||
see {ref}/security-settings.html#ref-kerberos-settings[Kerberos realm settings]. | ||
|
||
-- | ||
|
||
. Restart {es} | ||
|
||
. Map roles to Kerberos user | ||
+ | ||
-- | ||
|
||
The `kerberos` realm enables you to map Kerberos users to the roles. | ||
This role mapping can be configured via the | ||
{ref}/security-api-role-mapping.html[role-mapping API] or by using a file | ||
stored on each node. You identify user by its `username` field. | ||
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. s/identify user/identify a user 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. Lisa addressed this in her commit, Thank you. |
||
|
||
The following example maps `user@REALM` to roles `monitoring`, `user`. | ||
|
||
Configured via the role-mapping API: | ||
[source,js] | ||
-------------------------------------------------- | ||
POST _xpack/security/role_mapping/kerbrolemapping | ||
{ | ||
"roles" : [ "monitoring_user" ], | ||
"enabled": true, | ||
"rules" : { | ||
"field" : { "username" : "user@REALM" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
// CONSOLE | ||
|
||
-- | ||
|
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.