troubleshooting.asciidoc 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. [role="xpack"]
  2. [[security-troubleshooting]]
  3. == Troubleshooting security
  4. ++++
  5. <titleabbrev>Troubleshooting</titleabbrev>
  6. ++++
  7. Use the information in this section to troubleshoot common problems and find
  8. answers for frequently asked questions.
  9. * <<security-trb-settings>>
  10. * <<security-trb-roles>>
  11. * <<security-trb-extraargs>>
  12. * <<trouble-shoot-active-directory>>
  13. * <<trb-security-maccurl>>
  14. * <<trb-security-sslhandshake>>
  15. * <<trb-security-ssl>>
  16. * <<trb-security-kerberos>>
  17. * <<trb-security-saml>>
  18. * <<trb-security-internalserver>>
  19. * <<trb-security-setup>>
  20. * <<trb-security-path>>
  21. For issues that you cannot fix yourself … we’re here to help.
  22. If you are an existing Elastic customer with a support contract, please create
  23. a ticket in the
  24. https://support.elastic.co/customers/s/login/[Elastic Support portal].
  25. Or post in the https://discuss.elastic.co/[Elastic forum].
  26. [[security-trb-settings]]
  27. === Some settings are not returned via the nodes settings API
  28. *Symptoms:*
  29. * When you use the {ref}/cluster-nodes-info.html[nodes info API] to retrieve
  30. settings for a node, some information is missing.
  31. *Resolution:*
  32. This is intentional. Some of the settings are considered to be highly
  33. sensitive: all `ssl` settings, ldap `bind_dn`, and `bind_password`.
  34. For this reason, we filter these settings and do not expose them via
  35. the nodes info API rest endpoint. You can also define additional
  36. sensitive settings that should be hidden using the
  37. `xpack.security.hide_settings` setting. For example, this snippet
  38. hides the `url` settings of the `ldap1` realm and all settings of the
  39. `ad1` realm.
  40. [source, yaml]
  41. ------------------------------------------
  42. xpack.security.hide_settings: xpack.security.authc.realms.ldap1.url,
  43. xpack.security.authc.realms.ad1.*
  44. ------------------------------------------
  45. [[security-trb-roles]]
  46. === Authorization exceptions
  47. *Symptoms:*
  48. * I configured the appropriate roles and the users, but I still get an
  49. authorization exception.
  50. * I can authenticate to LDAP, but I still get an authorization exception.
  51. *Resolution:*
  52. . Verify that the role names associated with the users match the roles defined
  53. in the `roles.yml` file. You can use the `elasticsearch-users` tool to list all
  54. the users. Any unknown roles are marked with `*`.
  55. +
  56. --
  57. [source, shell]
  58. ------------------------------------------
  59. bin/elasticsearch-users list
  60. rdeniro : admin
  61. alpacino : power_user
  62. jacknich : monitoring,unknown_role* <1>
  63. ------------------------------------------
  64. <1> `unknown_role` was not found in `roles.yml`
  65. For more information about this command, see the
  66. {ref}/users-command.html[`elasticsearch-users` command].
  67. --
  68. . If you are authenticating to LDAP, a number of configuration options can cause
  69. this error.
  70. +
  71. --
  72. |======================
  73. |_group identification_ |
  74. Groups are located by either an LDAP search or by the "memberOf" attribute on
  75. the user. Also, If subtree search is turned off, it will search only one
  76. level deep. See the <<ldap-settings, LDAP Settings>> for all the options.
  77. There are many options here and sticking to the defaults will not work for all
  78. scenarios.
  79. | _group to role mapping_|
  80. Either the `role_mapping.yml` file or the location for this file could be
  81. misconfigured. For more information, see {ref}/security-files.html[Security files].
  82. |_role definition_|
  83. The role definition might be missing or invalid.
  84. |======================
  85. To help track down these possibilities, add the following lines to the end of
  86. the `log4j2.properties` configuration file in the `ES_PATH_CONF`:
  87. [source,properties]
  88. ----------------
  89. logger.authc.name = org.elasticsearch.xpack.security.authc
  90. logger.authc.level = DEBUG
  91. ----------------
  92. A successful authentication should produce debug statements that list groups and
  93. role mappings.
  94. --
  95. [[security-trb-extraargs]]
  96. === Users command fails due to extra arguments
  97. *Symptoms:*
  98. * The `elasticsearch-users` command fails with the following message:
  99. `ERROR: extra arguments [...] were provided`.
  100. *Resolution:*
  101. This error occurs when the `elasticsearch-users` tool is parsing the input and
  102. finds unexpected arguments. This can happen when there are special characters
  103. used in some of the arguments. For example, on Windows systems the `,` character
  104. is considered a parameter separator; in other words `-r role1,role2` is
  105. translated to `-r role1 role2` and the `elasticsearch-users` tool only
  106. recognizes `role1` as an expected parameter. The solution here is to quote the
  107. parameter: `-r "role1,role2"`.
  108. For more information about this command, see
  109. {ref}/users-command.html[`elasticsearch-users` command].
  110. [[trouble-shoot-active-directory]]
  111. === Users are frequently locked out of Active Directory
  112. *Symptoms:*
  113. * Certain users are being frequently locked out of Active Directory.
  114. *Resolution:*
  115. Check your realm configuration; realms are checked serially, one after another.
  116. If your Active Directory realm is being checked before other realms and there
  117. are usernames that appear in both Active Directory and another realm, a valid
  118. login for one realm might be causing failed login attempts in another realm.
  119. For example, if `UserA` exists in both Active Directory and a file realm, and
  120. the Active Directory realm is checked first and file is checked second, an
  121. attempt to authenticate as `UserA` in the file realm would first attempt to
  122. authenticate against Active Directory and fail, before successfully
  123. authenticating against the `file` realm. Because authentication is verified on
  124. each request, the Active Directory realm would be checked - and fail - on each
  125. request for `UserA` in the `file` realm. In this case, while the authentication
  126. request completed successfully, the account on Active Directory would have
  127. received several failed login attempts, and that account might become
  128. temporarily locked out. Plan the order of your realms accordingly.
  129. Also note that it is not typically necessary to define multiple Active Directory
  130. realms to handle domain controller failures. When using Microsoft DNS, the DNS
  131. entry for the domain should always point to an available domain controller.
  132. [[trb-security-maccurl]]
  133. === Certificate verification fails for curl on Mac
  134. *Symptoms:*
  135. * `curl` on the Mac returns a certificate verification error even when the
  136. `--cacert` option is used.
  137. *Resolution:*
  138. Apple's integration of `curl` with their keychain technology disables the
  139. `--cacert` option.
  140. See http://curl.haxx.se/mail/archive-2013-10/0036.html for more information.
  141. You can use another tool, such as `wget`, to test certificates. Alternately, you
  142. can add the certificate for the signing certificate authority MacOS system
  143. keychain, using a procedure similar to the one detailed at the
  144. http://support.apple.com/kb/PH14003[Apple knowledge base]. Be sure to add the
  145. signing CA's certificate and not the server's certificate.
  146. [[trb-security-sslhandshake]]
  147. === SSLHandshakeException causes connections to fail
  148. *Symptoms:*
  149. * A `SSLHandshakeException` causes a connection to a node to fail and indicates
  150. that there is a configuration issue. Some of the common exceptions are shown
  151. below with tips on how to resolve these issues.
  152. *Resolution:*
  153. `java.security.cert.CertificateException: No name matching node01.example.com found`::
  154. +
  155. --
  156. Indicates that a client connection was made to `node01.example.com` but the
  157. certificate returned did not contain the name `node01.example.com`. In most
  158. cases, the issue can be resolved by ensuring the name is specified during
  159. certificate creation. For more information, see <<ssl-tls>>. Another scenario is
  160. when the environment does not wish to use DNS names in certificates at all. In
  161. this scenario, all settings in `elasticsearch.yml` should only use IP addresses
  162. including the `network.publish_host` setting.
  163. --
  164. `java.security.cert.CertificateException: No subject alternative names present`::
  165. +
  166. --
  167. Indicates that a client connection was made to an IP address but the returned
  168. certificate did not contain any `SubjectAlternativeName` entries. IP addresses
  169. are only used for hostname verification if they are specified as a
  170. `SubjectAlternativeName` during certificate creation. If the intent was to use
  171. IP addresses for hostname verification, then the certificate will need to be
  172. regenerated with the appropriate IP address. See <<ssl-tls>>.
  173. --
  174. `javax.net.ssl.SSLHandshakeException: null cert chain` and `javax.net.ssl.SSLException: Received fatal alert: bad_certificate`::
  175. +
  176. --
  177. The `SSLHandshakeException` indicates that a self-signed certificate was
  178. returned by the client that is not trusted as it cannot be found in the
  179. `truststore` or `keystore`. This `SSLException` is seen on the client side of
  180. the connection.
  181. --
  182. `sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target` and `javax.net.ssl.SSLException: Received fatal alert: certificate_unknown`::
  183. +
  184. --
  185. This `SunCertPathBuilderException` indicates that a certificate was returned
  186. during the handshake that is not trusted. This message is seen on the client
  187. side of the connection. The `SSLException` is seen on the server side of the
  188. connection. The CA certificate that signed the returned certificate was not
  189. found in the `keystore` or `truststore` and needs to be added to trust this
  190. certificate.
  191. --
  192. `javax.net.ssl.SSLHandshakeException: Invalid ECDH ServerKeyExchange signature`::
  193. +
  194. --
  195. The `Invalid ECDH ServerKeyExchange signature` can indicate that a key and a corresponding certificate don't match and are
  196. causing the handshake to fail.
  197. Verify the contents of each of the files you are using for your configured certificate authorities, certificates and keys. In particular, check that the key and certificate belong to the same key pair.
  198. --
  199. [[trb-security-ssl]]
  200. === Common SSL/TLS exceptions
  201. *Symptoms:*
  202. * You might see some exceptions related to SSL/TLS in your logs. Some of the
  203. common exceptions are shown below with tips on how to resolve these issues. +
  204. *Resolution:*
  205. `WARN: received plaintext http traffic on a https channel, closing connection`::
  206. +
  207. --
  208. Indicates that there was an incoming plaintext http request. This typically
  209. occurs when an external applications attempts to make an unencrypted call to the
  210. REST interface. Please ensure that all applications are using `https` when
  211. calling the REST interface with SSL enabled.
  212. --
  213. `org.elasticsearch.common.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record:`::
  214. +
  215. --
  216. Indicates that there was incoming plaintext traffic on an SSL connection. This
  217. typically occurs when a node is not configured to use encrypted communication
  218. and tries to connect to nodes that are using encrypted communication. Please
  219. verify that all nodes are using the same setting for
  220. `xpack.security.transport.ssl.enabled`.
  221. For more information about this setting, see
  222. {ref}/security-settings.html[Security Settings in {es}].
  223. --
  224. `java.io.StreamCorruptedException: invalid internal transport message format, got`::
  225. +
  226. --
  227. Indicates an issue with data received on the transport interface in an unknown
  228. format. This can happen when a node with encrypted communication enabled
  229. connects to a node that has encrypted communication disabled. Please verify that
  230. all nodes are using the same setting for `xpack.security.transport.ssl.enabled`.
  231. For more information about this setting, see
  232. {ref}/security-settings.html[Security Settings in {es}].
  233. --
  234. `java.lang.IllegalArgumentException: empty text`::
  235. +
  236. --
  237. This exception is typically seen when a `https` request is made to a node that
  238. is not using `https`. If `https` is desired, please ensure the following setting
  239. is in `elasticsearch.yml`:
  240. [source,yaml]
  241. ----------------
  242. xpack.security.http.ssl.enabled: true
  243. ----------------
  244. For more information about this setting, see
  245. {ref}/security-settings.html[Security Settings in {es}].
  246. --
  247. `ERROR: unsupported ciphers [...] were requested but cannot be used in this JVM`::
  248. +
  249. --
  250. This error occurs when a SSL/TLS cipher suite is specified that cannot supported
  251. by the JVM that {es} is running in. Security tries to use the specified cipher
  252. suites that are supported by this JVM. This error can occur when using the
  253. Security defaults as some distributions of OpenJDK do not enable the PKCS11
  254. provider by default. In this case, we recommend consulting your JVM
  255. documentation for details on how to enable the PKCS11 provider.
  256. Another common source of this error is requesting cipher suites that use
  257. encrypting with a key length greater than 128 bits when running on an Oracle JDK.
  258. In this case, you must install the
  259. <<ciphers, JCE Unlimited Strength Jurisdiction Policy Files>>.
  260. --
  261. [[trb-security-kerberos]]
  262. === Common Kerberos exceptions
  263. *Symptoms:*
  264. * User authentication fails due to either GSS negotiation failure
  265. or a service login failure (either on the server or in the {es} http client).
  266. Some of the common exceptions are listed below with some tips to help resolve
  267. them.
  268. *Resolution:*
  269. `Failure unspecified at GSS-API level (Mechanism level: Checksum failed)`::
  270. +
  271. --
  272. When you see this error message on the HTTP client side, then it may be
  273. related to an incorrect password.
  274. When you see this error message in the {es} server logs, then it may be
  275. related to the {es} service keytab. The keytab file is present but it failed
  276. to log in as the user. Please check the keytab expiry. Also check whether the
  277. keytab contain up-to-date credentials; if not, replace them.
  278. You can use tools like `klist` or `ktab` to list principals inside
  279. the keytab and validate them. You can use `kinit` to see if you can acquire
  280. initial tickets using the keytab. Please check the tools and their documentation
  281. in your Kerberos environment.
  282. Kerberos depends on proper hostname resolution, so please check your DNS infrastructure.
  283. Incorrect DNS setup, DNS SRV records or configuration for KDC servers in `krb5.conf`
  284. can cause problems with hostname resolution.
  285. --
  286. `Failure unspecified at GSS-API level (Mechanism level: Request is a replay (34))`::
  287. `Failure unspecified at GSS-API level (Mechanism level: Clock skew too great (37))`::
  288. +
  289. --
  290. To prevent replay attacks, Kerberos V5 sets a maximum tolerance for computer
  291. clock synchronization and it is typically 5 minutes. Please check whether
  292. the time on the machines within the domain is in sync.
  293. --
  294. `gss_init_sec_context() failed: An unsupported mechanism was requested`::
  295. `No credential found for: 1.2.840.113554.1.2.2 usage: Accept`::
  296. +
  297. --
  298. You would usually see this error message on the client side when using `curl` to
  299. test {es} Kerberos setup. For example, these messages occur when you are using
  300. an old version of curl on the client and therefore Kerberos Spnego support is missing.
  301. The Kerberos realm in {es} only supports Spengo mechanism (Oid 1.3.6.1.5.5.2);
  302. it does not yet support Kerberos mechanism (Oid 1.2.840.113554.1.2.2).
  303. Make sure that:
  304. * You have installed curl version 7.49 or above as older versions of curl have
  305. known Kerberos bugs.
  306. * The curl installed on your machine has `GSS-API`, `Kerberos` and `SPNEGO`
  307. features listed when you invoke command `curl -V`. If not, you will need to
  308. compile `curl` version with this support.
  309. To download latest curl version visit https://curl.haxx.se/download.html
  310. --
  311. As Kerberos logs are often cryptic in nature and many things can go wrong
  312. as it depends on external services like DNS and NTP. You might
  313. have to enable additional debug logs to determine the root cause of the issue.
  314. {es} uses a JAAS (Java Authentication and Authorization Service) Kerberos login
  315. module to provide Kerberos support. To enable debug logs on {es} for the login
  316. module use following Kerberos realm setting:
  317. [source,yaml]
  318. ----------------
  319. xpack.security.authc.realms.<realm-name>.krb.debug: true
  320. ----------------
  321. For detailed information, see {ref}/security-settings.html#ref-kerberos-settings[Kerberos realm settings].
  322. Sometimes you may need to go deeper to understand the problem during SPNEGO
  323. GSS context negotiation or look at the Kerberos message exchange. To enable
  324. Kerberos/SPNEGO debug logging on JVM, add following JVM system properties:
  325. `-Dsun.security.krb5.debug=true`
  326. `-Dsun.security.spnego.debug=true`
  327. For more information about JVM system properties, see {ref}/jvm-options.html[configuring JVM options].
  328. [[trb-security-saml]]
  329. === Common SAML issues
  330. Some of the common SAML problems are shown below with tips on how to resolve
  331. these issues.
  332. . *Symptoms:*
  333. +
  334. --
  335. Authentication in {kib} fails and the following error is printed in the {es}
  336. logs:
  337. ....
  338. Cannot find any matching realm for [SamlPrepareAuthenticationRequest{realmName=saml1,
  339. assertionConsumerServiceURL=https://my.kibana.url/api/security/v1/saml}]
  340. ....
  341. *Resolution:*
  342. In order to initiate a SAML authentication, {kib} needs to know which SAML realm
  343. it should use from the ones that are configured in {es}. You can use the
  344. `xpack.security.authc.saml.reaml` setting to explicitly set the SAML realm name
  345. in {kib}. It must match the name of the SAML realm that is configured in {es}.
  346. If you get an error like the one above, it possibly means that the value of
  347. `xpack.security.authc.saml.reaml` in your {kib} configuration is wrong. Verify
  348. that it matches the name of the configured realm in {es}, which is the string
  349. after `xpack.security.authc.realms.saml.` in your {es} configuration.
  350. --
  351. . *Symptoms:*
  352. +
  353. --
  354. Authentication in {kib} fails and the following error is printed in the
  355. {es} logs:
  356. ....
  357. Authentication to realm saml1 failed - Provided SAML response is not valid for realm
  358. saml/saml1 (Caused by ElasticsearchSecurityException[Conditions
  359. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company....ple.com/]
  360. do not match required audience
  361. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com]])
  362. ....
  363. *Resolution:*
  364. We received a SAML response that is addressed to another SAML Service Provider.
  365. This usually means that the configured SAML Service Provider Entity ID in
  366. `elasticsearch.yml` (`sp.entity_id`) does not match what has been configured as
  367. the SAML Service Provider Entity ID in the SAML Identity Provider documentation.
  368. To resolve this issue, ensure that both the saml realm in {es} and the IdP are
  369. configured with the same string for the SAML Entity ID of the Service Provider.
  370. In the {es} log, just before the exception message (above), there will also be
  371. one or more `INFO` level messages of the form
  372. ....
  373. Audience restriction
  374. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com/]
  375. does not match required audience
  376. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com]
  377. (difference starts at character [#68] [/] vs [])
  378. ....
  379. This log message can assist in determining the difference between the value that
  380. was received from the IdP and the value at has been configured in {es}.
  381. The text in parentheses that describes the difference between the two audience
  382. identifiers will only be shown if the two strings are considered to be similar.
  383. TIP: These strings are compared as case-sensitive strings and not as
  384. canonicalized URLs even when the values are URL-like. Be mindful of trailing
  385. slashes, port numbers, etc.
  386. --
  387. . *Symptoms:*
  388. +
  389. --
  390. Authentication in {kib} fails and the following error is printed in the
  391. {es} logs:
  392. ....
  393. Cannot find metadata for entity [your:entity.id] in [metadata.xml]
  394. ....
  395. *Resolution:*
  396. We could not find the metadata for the SAML Entity ID `your:entity.id` in the
  397. configured metadata file (`metadata.xml`).
  398. .. Ensure that the `metadata.xml` file you are using is indeed the one provided
  399. by your SAML Identity Provider.
  400. .. Ensure that the `metadata.xml` file contains one <EntityDescriptor> element
  401. as follows: `<EntityDescriptor ID="0597c9aa-e69b-46e7-a1c6-636c7b8a8070" entityID="https://saml.example.com/f174199a-a96e-4201-88f1-0d57a610c522/" ...`
  402. where the value of the `entityID` attribute is the same as the value of the
  403. `idp.entity_id` that you have set in your SAML realm configuration in
  404. `elasticsearch.yml`.
  405. .. Note that these are also compared as case-sensitive strings and not as
  406. canonicalized URLs even when the values are URL-like.
  407. --
  408. . *Symptoms:*
  409. +
  410. --
  411. Authentication in {kib} fails and the following error is printed in the {es}
  412. logs:
  413. ....
  414. unable to authenticate user [<unauthenticated-saml-user>]
  415. for action [cluster:admin/xpack/security/saml/authenticate]
  416. ....
  417. *Resolution:*
  418. This error indicates that {es} failed to process the incoming SAML
  419. authentication message. Since the message can't be processed, {es} is not aware
  420. of who the to-be authenticated user is and the `<unauthenticated-saml-user>`
  421. placeholder is used instead. To diagnose the _actual_ problem, you must check
  422. the {es} logs for further details.
  423. --
  424. . *Symptoms:*
  425. +
  426. --
  427. Authentication in {kib} fails and the following error is printed in the
  428. {es} logs:
  429. ....
  430. Authentication to realm my-saml-realm failed -
  431. Provided SAML response is not valid for realm saml/my-saml-realm
  432. (Caused by ElasticsearchSecurityException[SAML Response is not a 'success' response:
  433. The SAML IdP did not grant the request. It indicated that the Elastic Stack side sent
  434. something invalid (urn:oasis:names:tc:SAML:2.0:status:Requester). Specific status code which might
  435. indicate what the issue is: [urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy]]
  436. )
  437. ....
  438. *Resolution:*
  439. This means that the SAML Identity Provider failed to authenticate the user and
  440. sent a SAML Response to the Service Provider ({stack}) indicating this failure.
  441. The message will convey whether the SAML Identity Provider thinks that the problem
  442. is with the Service Provider ({stack}) or with the Identity Provider itself and
  443. the specific status code that follows is extremely useful as it usually indicates
  444. the underlying issue. The list of specific error codes is defined in the
  445. https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf[SAML 2.0 Core specification - Section 3.2.2.2]
  446. and the most commonly encountered ones are:
  447. . `urn:oasis:names:tc:SAML:2.0:status:AuthnFailed`: The SAML Identity Provider failed to
  448. authenticate the user. There is not much to troubleshoot on the {stack} side for this status, the logs of
  449. the SAML Identity Provider will hopefully offer much more information.
  450. . `urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy`: The SAML Identity Provider cannot support
  451. releasing a NameID with the requested format. When creating SAML Authentication Requests, {es} sets
  452. the NameIDPolicy element of the Authentication request with the appropriate value. This is controlled
  453. by the {ref}/security-settings.html#ref-saml-settings[`nameid_format`] configuration parameter in
  454. `elasticsearch.yml`, which if not set defaults to `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
  455. This instructs the Identity Provider to return a NameID with that specific format in the SAML Response. If
  456. the SAML Identity Provider cannot grant that request, for example because it is configured to release a
  457. NameID format with `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` format instead, it returns this error
  458. indicating an invalid NameID policy. This issue can be resolved by adjusting `nameid_format` to match the format
  459. the SAML Identity Provider can return or by setting it to `urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified`
  460. so that the Identity Provider is allowed to return any format it wants.
  461. --
  462. . *Symptoms:*
  463. +
  464. --
  465. Authentication in {kib} fails and the following error is printed in the
  466. {es} logs:
  467. ....
  468. The XML Signature of this SAML message cannot be validated. Please verify that the saml
  469. realm uses the correct SAMLmetadata file/URL for this Identity Provider
  470. ....
  471. *Resolution:*
  472. This means that {es} failed to validate the digital signature of the SAML
  473. message that the Identity Provider sent. {es} uses the public key of the
  474. Identity Provider that is included in the SAML metadata, in order to validate
  475. the signature that the IdP has created using its corresponding private key.
  476. Failure to do so, can have a number of causes:
  477. .. As the error message indicates, the most common cause is that the wrong
  478. metadata file is used and as such the public key it contains doesn't correspond
  479. to the private key the Identity Provider uses.
  480. .. The configuration of the Identity Provider has changed or the key has been
  481. rotated and the metadata file that {es} is using has not been updated.
  482. .. The SAML Response has been altered in transit and the signature cannot be
  483. validated even though the correct key is used.
  484. NOTE: The private keys and public keys and self-signed X.509 certificates that
  485. are used in SAML for digital signatures as described above have no relation to
  486. the keys and certificates that are used for TLS either on the transport or the
  487. http layer. A failure such as the one described above has nothing to do with
  488. your `xpack.ssl` related configuration.
  489. --
  490. . *Symptoms:*
  491. +
  492. --
  493. Users are unable to login with a local username and password in {kib} because
  494. SAML is enabled.
  495. *Resolution:*
  496. If you want your users to be able to use local credentials to authenticate to
  497. {kib} in addition to using the SAML realm for Single Sign-On, you must enable
  498. the `basic` `authProvider` in {kib}. The process is documented in the
  499. <<saml-kibana-basic, SAML Guide>>
  500. --
  501. *Logging:*
  502. Very detailed trace logging can be enabled specifically for the SAML realm by
  503. setting the following transient setting:
  504. [source, shell]
  505. -----------------------------------------------
  506. PUT /_cluster/settings
  507. {
  508. "transient": {
  509. "logger.org.elasticsearch.xpack.security.authc.saml": "trace"
  510. }
  511. }
  512. -----------------------------------------------
  513. Alternatively, you can add the following lines to the end of the
  514. `log4j2.properties` configuration file in the `ES_PATH_CONF`:
  515. [source,properties]
  516. ----------------
  517. logger.saml.name = org.elasticsearch.xpack.security.authc.saml
  518. logger.saml.level = TRACE
  519. ----------------
  520. [[trb-security-internalserver]]
  521. === Internal Server Error in Kibana
  522. *Symptoms:*
  523. * In 5.1.1, an `UnhandledPromiseRejectionWarning` occurs and {kib} displays an
  524. Internal Server Error.
  525. //TBD: Is the same true for later releases?
  526. *Resolution:*
  527. If the Security plugin is enabled in {es} but disabled in {kib}, you must
  528. still set `elasticsearch.username` and `elasticsearch.password` in `kibana.yml`.
  529. Otherwise, {kib} cannot connect to {es}.
  530. [[trb-security-setup]]
  531. === Setup-passwords command fails due to connection failure
  532. The {ref}/setup-passwords.html[elasticsearch-setup-passwords command] sets
  533. passwords for the built-in users by sending user management API requests. If
  534. your cluster uses SSL/TLS for the HTTP (REST) interface, the command attempts to
  535. establish a connection with the HTTPS protocol. If the connection attempt fails,
  536. the command fails.
  537. *Symptoms:*
  538. . {es} is running HTTPS, but the command fails to detect it and returns the
  539. following errors:
  540. +
  541. --
  542. [source, shell]
  543. ------------------------------------------
  544. Cannot connect to elasticsearch node.
  545. java.net.SocketException: Unexpected end of file from server
  546. ...
  547. ERROR: Failed to connect to elasticsearch at
  548. http://127.0.0.1:9200/_security/_authenticate?pretty.
  549. Is the URL correct and elasticsearch running?
  550. ------------------------------------------
  551. --
  552. . SSL/TLS is configured, but trust cannot be established. The command returns
  553. the following errors:
  554. +
  555. --
  556. [source, shell]
  557. ------------------------------------------
  558. SSL connection to
  559. https://127.0.0.1:9200/_security/_authenticate?pretty
  560. failed: sun.security.validator.ValidatorException:
  561. PKIX path building failed:
  562. sun.security.provider.certpath.SunCertPathBuilderException:
  563. unable to find valid certification path to requested target
  564. Please check the elasticsearch SSL settings under
  565. xpack.security.http.ssl.
  566. ...
  567. ERROR: Failed to establish SSL connection to elasticsearch at
  568. https://127.0.0.1:9200/_security/_authenticate?pretty.
  569. ------------------------------------------
  570. --
  571. . The command fails because hostname verification fails, which results in the
  572. following errors:
  573. +
  574. --
  575. [source, shell]
  576. ------------------------------------------
  577. SSL connection to
  578. https://idp.localhost.test:9200/_security/_authenticate?pretty
  579. failed: java.security.cert.CertificateException:
  580. No subject alternative DNS name matching
  581. elasticsearch.example.com found.
  582. Please check the elasticsearch SSL settings under
  583. xpack.security.http.ssl.
  584. ...
  585. ERROR: Failed to establish SSL connection to elasticsearch at
  586. https://elasticsearch.example.com:9200/_security/_authenticate?pretty.
  587. ------------------------------------------
  588. --
  589. *Resolution:*
  590. . If your cluster uses TLS/SSL for the HTTP interface but the
  591. `elasticsearch-setup-passwords` command attempts to establish a non-secure
  592. connection, use the `--url` command option to explicitly specify an HTTPS URL.
  593. Alternatively, set the `xpack.security.http.ssl.enabled` setting to `true`.
  594. . If the command does not trust the {es} server, verify that you configured the
  595. `xpack.security.http.ssl.certificate_authorities` setting or the
  596. `xpack.security.http.ssl.truststore.path` setting.
  597. . If hostname verification fails, you can disable this verification by setting
  598. `xpack.security.http.ssl.verification_mode` to `certificate`.
  599. For more information about these settings, see
  600. {ref}/security-settings.html[Security Settings in {es}].
  601. [[trb-security-path]]
  602. === Failures due to relocation of the configuration files
  603. *Symptoms:*
  604. * Active Directory or LDAP realms might stop working after upgrading to {es} 6.3
  605. or later releases. In 6.4 or later releases, you might see messages in the {es}
  606. log that indicate a config file is in a deprecated location.
  607. *Resolution:*
  608. By default, in 6.2 and earlier releases, the security configuration files are
  609. located in the `ES_PATH_CONF/x-pack` directory, where `ES_PATH_CONF` is an
  610. environment variable that defines the location of the
  611. {ref}/settings.html#config-files-location[config directory].
  612. In 6.3 and later releases, the config directory no longer contains an `x-pack`
  613. directory. The files that were stored in this folder, such as the
  614. `log4j2.properties`, `role_mapping.yml`, `roles.yml`, `users`, and `users_roles`
  615. files, now exist directly in the config directory.
  616. IMPORTANT: If you upgraded to 6.3 or later releases, your old security
  617. configuration files still exist in an `x-pack` folder. That file path is
  618. deprecated, however, and you should move your files out of that folder.
  619. In 6.3 and later releases, settings such as `files.role_mapping` default to
  620. `ES_PATH_CONF/role_mapping.yml`. If you do not want to use the default locations,
  621. you must update the settings appropriately. See
  622. {ref}/security-settings.html[Security settings in {es}].