troubleshooting.asciidoc 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  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 <<cluster-nodes-info,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. <<users-command,`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. For all the options, see <<ref-ldap-settings>>.
  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 <<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. <<users-command,`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 <<encrypt-internode-communication>>. 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 <<encrypt-internode-communication>>.
  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. <<security-settings>>.
  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. <<security-settings>>.
  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. <<security-settings>>.
  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.kerberos.<realm-name>.krb.debug: true
  320. ----------------
  321. For detailed information, see <<ref-kerberos-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 <<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/saml/callback}]
  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.providers.saml.<provider-name>.realm` setting to explicitly
  345. set the SAML realm name in {kib}. It must match the name of the SAML realm that is
  346. configured in {es}.
  347. If you get an error like the one above, it possibly means that the value of
  348. `xpack.security.authc.providers.saml.<provider-name>.realm` in your {kib}
  349. configuration is wrong. Verify that it matches the name of the configured realm
  350. in {es}, which is the string after `xpack.security.authc.realms.saml.` in your
  351. {es} configuration.
  352. --
  353. . *Symptoms:*
  354. +
  355. --
  356. Authentication in {kib} fails and the following error is printed in the
  357. {es} logs:
  358. ....
  359. Authentication to realm saml1 failed - Provided SAML response is not valid for realm
  360. saml/saml1 (Caused by ElasticsearchSecurityException[Conditions
  361. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company....ple.com/]
  362. do not match required audience
  363. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com]])
  364. ....
  365. *Resolution:*
  366. We received a SAML response that is addressed to another SAML Service Provider.
  367. This usually means that the configured SAML Service Provider Entity ID in
  368. `elasticsearch.yml` (`sp.entity_id`) does not match what has been configured as
  369. the SAML Service Provider Entity ID in the SAML Identity Provider documentation.
  370. To resolve this issue, ensure that both the saml realm in {es} and the IdP are
  371. configured with the same string for the SAML Entity ID of the Service Provider.
  372. In the {es} log, just before the exception message (above), there will also be
  373. one or more `INFO` level messages of the form
  374. ....
  375. Audience restriction
  376. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com/]
  377. does not match required audience
  378. [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com]
  379. (difference starts at character [#68] [/] vs [])
  380. ....
  381. This log message can assist in determining the difference between the value that
  382. was received from the IdP and the value at has been configured in {es}.
  383. The text in parentheses that describes the difference between the two audience
  384. identifiers will only be shown if the two strings are considered to be similar.
  385. TIP: These strings are compared as case-sensitive strings and not as
  386. canonicalized URLs even when the values are URL-like. Be mindful of trailing
  387. slashes, port numbers, etc.
  388. --
  389. . *Symptoms:*
  390. +
  391. --
  392. Authentication in {kib} fails and the following error is printed in the
  393. {es} logs:
  394. ....
  395. Cannot find metadata for entity [your:entity.id] in [metadata.xml]
  396. ....
  397. *Resolution:*
  398. We could not find the metadata for the SAML Entity ID `your:entity.id` in the
  399. configured metadata file (`metadata.xml`).
  400. .. Ensure that the `metadata.xml` file you are using is indeed the one provided
  401. by your SAML Identity Provider.
  402. .. Ensure that the `metadata.xml` file contains one <EntityDescriptor> element
  403. as follows: `<EntityDescriptor ID="0597c9aa-e69b-46e7-a1c6-636c7b8a8070" entityID="https://saml.example.com/f174199a-a96e-4201-88f1-0d57a610c522/" ...`
  404. where the value of the `entityID` attribute is the same as the value of the
  405. `idp.entity_id` that you have set in your SAML realm configuration in
  406. `elasticsearch.yml`.
  407. .. Note that these are also compared as case-sensitive strings and not as
  408. canonicalized URLs even when the values are URL-like.
  409. --
  410. . *Symptoms:*
  411. +
  412. --
  413. Authentication in {kib} fails and the following error is printed in the {es}
  414. logs:
  415. ....
  416. unable to authenticate user [<unauthenticated-saml-user>]
  417. for action [cluster:admin/xpack/security/saml/authenticate]
  418. ....
  419. *Resolution:*
  420. This error indicates that {es} failed to process the incoming SAML
  421. authentication message. Since the message can't be processed, {es} is not aware
  422. of who the to-be authenticated user is and the `<unauthenticated-saml-user>`
  423. placeholder is used instead. To diagnose the _actual_ problem, you must check
  424. the {es} logs for further details.
  425. --
  426. . *Symptoms:*
  427. +
  428. --
  429. Authentication in {kib} fails and the following error is printed in the {es}
  430. logs:
  431. ....
  432. Authentication to realm <saml-realm-name> failed - SAML Attribute [<AttributeName0>] for
  433. [xpack.security.authc.realms.saml.<saml-realm-name>.attributes.principal] not found in saml attributes
  434. [<AttributeName1>=<AttributeValue1>, <AttributeName2>=<AttributeValue2>, ...] or NameID [ NameID(format)=value ]
  435. ....
  436. *Resolution:*
  437. This error indicates that {es} failed to find the necessary SAML attribute in the SAML response that the
  438. Identity Provider sent. In this example, {es} is configured as follows:
  439. ....
  440. xpack.security.authc.realms.saml.<saml-realm-name>.attributes.principal: AttributeName0
  441. ....
  442. This configuration means that {es} expects to find a SAML Attribute with the name `AttributeName0` or a `NameID` with the appropriate format in the SAML
  443. response so that <<saml-attribute-mapping,it can map it>> to the `principal` user property. The `principal` user property is a
  444. mandatory one, so if this mapping can't happen, the authentication fails.
  445. If you are attempting to map a `NameID`, make sure that the expected `NameID` format matches the one that is sent.
  446. See <<saml-attribute-mapping-nameid>> for more details.
  447. If you are attempting to map a SAML attribute and it is not part of the list in the error message, it might mean
  448. that you have misspelled the attribute name, or that the IdP is not sending this particular attribute. You might
  449. be able to use another attribute from the list to map to `principal` or consult with your IdP administrator to
  450. determine if the required attribute can be sent.
  451. --
  452. . *Symptoms:*
  453. +
  454. --
  455. Authentication in {kib} fails and the following error is printed in the {es}
  456. logs:
  457. ....
  458. Cannot find [{urn:oasis:names:tc:SAML:2.0:metadata}IDPSSODescriptor]/[urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect] in descriptor
  459. ....
  460. *Resolution:*
  461. This error indicates that the SAML metadata for your Identity Provider do not contain a `<SingleSignOnService>` endpoint with binding of
  462. HTTP-Redirect (urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect). {es} supports only the `HTTP-Redirect` binding for SAML authentication
  463. requests (and it doesn't support the `HTTP-POST` binding). Consult your IdP administrator in order to enable at least one
  464. `<SingleSignOnService>` supporting `HTTP-Redirect` binding and update your IdP SAML Metadata.
  465. --
  466. . *Symptoms:*
  467. +
  468. --
  469. Authentication in {kib} fails and the following error is printed in the
  470. {es} logs:
  471. ....
  472. Authentication to realm my-saml-realm failed -
  473. Provided SAML response is not valid for realm saml/my-saml-realm
  474. (Caused by ElasticsearchSecurityException[SAML Response is not a 'success' response:
  475. The SAML IdP did not grant the request. It indicated that the Elastic Stack side sent
  476. something invalid (urn:oasis:names:tc:SAML:2.0:status:Requester). Specific status code which might
  477. indicate what the issue is: [urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy]]
  478. )
  479. ....
  480. *Resolution:*
  481. This means that the SAML Identity Provider failed to authenticate the user and
  482. sent a SAML Response to the Service Provider ({stack}) indicating this failure.
  483. The message will convey whether the SAML Identity Provider thinks that the problem
  484. is with the Service Provider ({stack}) or with the Identity Provider itself and
  485. the specific status code that follows is extremely useful as it usually indicates
  486. the underlying issue. The list of specific error codes is defined in the
  487. 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]
  488. and the most commonly encountered ones are:
  489. . `urn:oasis:names:tc:SAML:2.0:status:AuthnFailed`: The SAML Identity Provider failed to
  490. authenticate the user. There is not much to troubleshoot on the {stack} side for this status, the logs of
  491. the SAML Identity Provider will hopefully offer much more information.
  492. . `urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy`: The SAML Identity Provider cannot support
  493. releasing a NameID with the requested format. When creating SAML Authentication Requests, {es} sets
  494. the NameIDPolicy element of the Authentication request with the appropriate value. This is controlled
  495. by the <<ref-saml-settings,`nameid_format`>> configuration parameter in
  496. `elasticsearch.yml`, which if not set defaults to `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
  497. This instructs the Identity Provider to return a NameID with that specific format in the SAML Response. If
  498. the SAML Identity Provider cannot grant that request, for example because it is configured to release a
  499. NameID format with `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` format instead, it returns this error
  500. indicating an invalid NameID policy. This issue can be resolved by adjusting `nameid_format` to match the format
  501. the SAML Identity Provider can return or by setting it to `urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified`
  502. so that the Identity Provider is allowed to return any format it wants.
  503. --
  504. . *Symptoms:*
  505. +
  506. --
  507. Authentication in {kib} fails and the following error is printed in the
  508. {es} logs:
  509. ....
  510. The XML Signature of this SAML message cannot be validated. Please verify that the saml
  511. realm uses the correct SAMLmetadata file/URL for this Identity Provider
  512. ....
  513. *Resolution:*
  514. This means that {es} failed to validate the digital signature of the SAML
  515. message that the Identity Provider sent. {es} uses the public key of the
  516. Identity Provider that is included in the SAML metadata, in order to validate
  517. the signature that the IdP has created using its corresponding private key.
  518. Failure to do so, can have a number of causes:
  519. .. As the error message indicates, the most common cause is that the wrong
  520. metadata file is used and as such the public key it contains doesn't correspond
  521. to the private key the Identity Provider uses.
  522. .. The configuration of the Identity Provider has changed or the key has been
  523. rotated and the metadata file that {es} is using has not been updated.
  524. .. The SAML Response has been altered in transit and the signature cannot be
  525. validated even though the correct key is used.
  526. NOTE: The private keys and public keys and self-signed X.509 certificates that
  527. are used in SAML for digital signatures as described above have no relation to
  528. the keys and certificates that are used for TLS either on the transport or the
  529. http layer. A failure such as the one described above has nothing to do with
  530. your `xpack.ssl` related configuration.
  531. --
  532. . *Symptoms:*
  533. +
  534. --
  535. Users are unable to login with a local username and password in {kib} because
  536. SAML is enabled.
  537. *Resolution:*
  538. If you want your users to be able to use local credentials to authenticate to
  539. {kib} in addition to using the SAML realm for Single Sign-On, you must enable
  540. the `basic` `authProvider` in {kib}. The process is documented in the
  541. <<saml-kibana-basic, SAML Guide>>
  542. --
  543. *Logging:*
  544. If the previous resolutions do not solve your issue, enable additional
  545. logging for the SAML realm to troubleshoot further. You can enable debug
  546. logging by configuring the following persistent setting:
  547. [source, console]
  548. ----
  549. PUT /_cluster/settings
  550. {
  551. "persistent": {
  552. "logger.org.elasticsearch.xpack.security.authc.saml": "debug"
  553. }
  554. }
  555. ----
  556. Alternatively, you can add the following lines to the end of the
  557. `log4j2.properties` configuration file in the `ES_PATH_CONF`:
  558. [source,properties]
  559. ----------------
  560. logger.saml.name = org.elasticsearch.xpack.security.authc.saml
  561. logger.saml.level = DEBUG
  562. ----------------
  563. Refer to <<configuring-logging-levels,configuring logging levels>> for more
  564. information.
  565. [[trb-security-internalserver]]
  566. === Internal Server Error in Kibana
  567. *Symptoms:*
  568. * In 5.1.1, an `UnhandledPromiseRejectionWarning` occurs and {kib} displays an
  569. Internal Server Error.
  570. //TBD: Is the same true for later releases?
  571. *Resolution:*
  572. If the Security plugin is enabled in {es} but disabled in {kib}, you must
  573. still set `elasticsearch.username` and `elasticsearch.password` in `kibana.yml`.
  574. Otherwise, {kib} cannot connect to {es}.
  575. [[trb-security-setup]]
  576. === Setup-passwords command fails due to connection failure
  577. The <<setup-passwords,elasticsearch-setup-passwords command>> sets
  578. passwords for the built-in users by sending user management API requests. If
  579. your cluster uses SSL/TLS for the HTTP (REST) interface, the command attempts to
  580. establish a connection with the HTTPS protocol. If the connection attempt fails,
  581. the command fails.
  582. *Symptoms:*
  583. . {es} is running HTTPS, but the command fails to detect it and returns the
  584. following errors:
  585. +
  586. --
  587. [source, shell]
  588. ------------------------------------------
  589. Cannot connect to elasticsearch node.
  590. java.net.SocketException: Unexpected end of file from server
  591. ...
  592. ERROR: Failed to connect to elasticsearch at
  593. http://127.0.0.1:9200/_security/_authenticate?pretty.
  594. Is the URL correct and elasticsearch running?
  595. ------------------------------------------
  596. --
  597. . SSL/TLS is configured, but trust cannot be established. The command returns
  598. the following errors:
  599. +
  600. --
  601. [source, shell]
  602. ------------------------------------------
  603. SSL connection to
  604. https://127.0.0.1:9200/_security/_authenticate?pretty
  605. failed: sun.security.validator.ValidatorException:
  606. PKIX path building failed:
  607. sun.security.provider.certpath.SunCertPathBuilderException:
  608. unable to find valid certification path to requested target
  609. Please check the elasticsearch SSL settings under
  610. xpack.security.http.ssl.
  611. ...
  612. ERROR: Failed to establish SSL connection to elasticsearch at
  613. https://127.0.0.1:9200/_security/_authenticate?pretty.
  614. ------------------------------------------
  615. --
  616. . The command fails because hostname verification fails, which results in the
  617. following errors:
  618. +
  619. --
  620. [source, shell]
  621. ------------------------------------------
  622. SSL connection to
  623. https://idp.localhost.test:9200/_security/_authenticate?pretty
  624. failed: java.security.cert.CertificateException:
  625. No subject alternative DNS name matching
  626. elasticsearch.example.com found.
  627. Please check the elasticsearch SSL settings under
  628. xpack.security.http.ssl.
  629. ...
  630. ERROR: Failed to establish SSL connection to elasticsearch at
  631. https://elasticsearch.example.com:9200/_security/_authenticate?pretty.
  632. ------------------------------------------
  633. --
  634. *Resolution:*
  635. . If your cluster uses TLS/SSL for the HTTP interface but the
  636. `elasticsearch-setup-passwords` command attempts to establish a non-secure
  637. connection, use the `--url` command option to explicitly specify an HTTPS URL.
  638. Alternatively, set the `xpack.security.http.ssl.enabled` setting to `true`.
  639. . If the command does not trust the {es} server, verify that you configured the
  640. `xpack.security.http.ssl.certificate_authorities` setting or the
  641. `xpack.security.http.ssl.truststore.path` setting.
  642. . If hostname verification fails, you can disable this verification by setting
  643. `xpack.security.http.ssl.verification_mode` to `certificate`.
  644. For more information about these settings, see
  645. <<security-settings>>.
  646. [[trb-security-path]]
  647. === Failures due to relocation of the configuration files
  648. *Symptoms:*
  649. * Active Directory or LDAP realms might stop working after upgrading to {es} 6.3
  650. or later releases. In 6.4 or later releases, you might see messages in the {es}
  651. log that indicate a config file is in a deprecated location.
  652. *Resolution:*
  653. By default, in 6.2 and earlier releases, the security configuration files are
  654. located in the `ES_PATH_CONF/x-pack` directory, where `ES_PATH_CONF` is an
  655. environment variable that defines the location of the
  656. <<config-files-location,config directory>>.
  657. In 6.3 and later releases, the config directory no longer contains an `x-pack`
  658. directory. The files that were stored in this folder, such as the
  659. `log4j2.properties`, `role_mapping.yml`, `roles.yml`, `users`, and `users_roles`
  660. files, now exist directly in the config directory.
  661. IMPORTANT: If you upgraded to 6.3 or later releases, your old security
  662. configuration files still exist in an `x-pack` folder. That file path is
  663. deprecated, however, and you should move your files out of that folder.
  664. In 6.3 and later releases, settings such as `files.role_mapping` default to
  665. `ES_PATH_CONF/role_mapping.yml`. If you do not want to use the default locations,
  666. you must update the settings appropriately. See
  667. <<security-settings>>.