troubleshooting.asciidoc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. [role="xpack"]
  2. [[security-troubleshooting]]
  3. == {security} Troubleshooting
  4. ++++
  5. <titleabbrev>{security}</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-internalserver>>
  17. * <<trb-security-setup>>
  18. To get help, see <<xpack-help>>.
  19. [[security-trb-settings]]
  20. === Some settings are not returned via the nodes settings API
  21. *Symptoms:*
  22. * When you use the {ref}/cluster-nodes-info.html[nodes info API] to retrieve
  23. settings for a node, some information is missing.
  24. *Resolution:*
  25. This is intentional. Some of the settings are considered to be highly
  26. sensitive: all `ssl` settings, ldap `bind_dn`, and `bind_password`.
  27. For this reason, we filter these settings and do not expose them via
  28. the nodes info API rest endpoint. You can also define additional
  29. sensitive settings that should be hidden using the
  30. `xpack.security.hide_settings` setting. For example, this snippet
  31. hides the `url` settings of the `ldap1` realm and all settings of the
  32. `ad1` realm.
  33. [source, yaml]
  34. ------------------------------------------
  35. xpack.security.hide_settings: xpack.security.authc.realms.ldap1.url,
  36. xpack.security.authc.realms.ad1.*
  37. ------------------------------------------
  38. [[security-trb-roles]]
  39. === Authorization exceptions
  40. *Symptoms:*
  41. * I configured the appropriate roles and the users, but I still get an
  42. authorization exception.
  43. * I can authenticate to LDAP, but I still get an authorization exception.
  44. *Resolution:*
  45. . Verify that the role names associated with the users match the roles defined
  46. in the `roles.yml` file. You can use the `elasticsearch-users` tool to list all
  47. the users. Any unknown roles are marked with `*`.
  48. +
  49. --
  50. [source, shell]
  51. ------------------------------------------
  52. bin/elasticsearch-users list
  53. rdeniro : admin
  54. alpacino : power_user
  55. jacknich : monitoring,unknown_role* <1>
  56. ------------------------------------------
  57. <1> `unknown_role` was not found in `roles.yml`
  58. For more information about this command, see the
  59. {ref}/users-command.html[`elasticsearch-users` command].
  60. --
  61. . If you are authenticating to LDAP, a number of configuration options can cause
  62. this error.
  63. +
  64. --
  65. |======================
  66. |_group identification_ |
  67. Groups are located by either an LDAP search or by the "memberOf" attribute on
  68. the user. Also, If subtree search is turned off, it will search only one
  69. level deep. See the <<ldap-settings, LDAP Settings>> for all the options.
  70. There are many options here and sticking to the defaults will not work for all
  71. scenarios.
  72. | _group to role mapping_|
  73. Either the `role_mapping.yml` file or the location for this file could be
  74. misconfigured. See <<security-files, Security Files>> for more.
  75. |_role definition_|
  76. The role definition might be missing or invalid.
  77. |======================
  78. To help track down these possibilities, add the following lines to the end of
  79. the `log4j2.properties` configuration file in the `CONFIG_DIR`:
  80. [source,properties]
  81. ----------------
  82. logger.authc.name = org.elasticsearch.xpack.security.authc
  83. logger.authc.level = DEBUG
  84. ----------------
  85. A successful authentication should produce debug statements that list groups and
  86. role mappings.
  87. --
  88. [[security-trb-extraargs]]
  89. === Users command fails due to extra arguments
  90. *Symptoms:*
  91. * The `elasticsearch-users` command fails with the following message:
  92. `ERROR: extra arguments [...] were provided`.
  93. *Resolution:*
  94. This error occurs when the `elasticsearch-users` tool is parsing the input and
  95. finds unexpected arguments. This can happen when there are special characters
  96. used in some of the arguments. For example, on Windows systems the `,` character
  97. is considered a parameter separator; in other words `-r role1,role2` is
  98. translated to `-r role1 role2` and the `elasticsearch-users` tool only
  99. recognizes `role1` as an expected parameter. The solution here is to quote the
  100. parameter: `-r "role1,role2"`.
  101. For more information about this command, see
  102. {ref}/users-command.html[`elasticsearch-users` command].
  103. [[trouble-shoot-active-directory]]
  104. === Users are frequently locked out of Active Directory
  105. *Symptoms:*
  106. * Certain users are being frequently locked out of Active Directory.
  107. *Resolution:*
  108. Check your realm configuration; realms are checked serially, one after another.
  109. If your Active Directory realm is being checked before other realms and there
  110. are usernames that appear in both Active Directory and another realm, a valid
  111. login for one realm might be causing failed login attempts in another realm.
  112. For example, if `UserA` exists in both Active Directory and a file realm, and
  113. the Active Directory realm is checked first and file is checked second, an
  114. attempt to authenticate as `UserA` in the file realm would first attempt to
  115. authenticate against Active Directory and fail, before successfully
  116. authenticating against the `file` realm. Because authentication is verified on
  117. each request, the Active Directory realm would be checked - and fail - on each
  118. request for `UserA` in the `file` realm. In this case, while the authentication
  119. request completed successfully, the account on Active Directory would have
  120. received several failed login attempts, and that account might become
  121. temporarily locked out. Plan the order of your realms accordingly.
  122. Also note that it is not typically necessary to define multiple Active Directory
  123. realms to handle domain controller failures. When using Microsoft DNS, the DNS
  124. entry for the domain should always point to an available domain controller.
  125. [[trb-security-maccurl]]
  126. === Certificate verification fails for curl on Mac
  127. *Symptoms:*
  128. * `curl` on the Mac returns a certificate verification error even when the
  129. `--cacert` option is used.
  130. *Resolution:*
  131. Apple's integration of `curl` with their keychain technology disables the
  132. `--cacert` option.
  133. See http://curl.haxx.se/mail/archive-2013-10/0036.html for more information.
  134. You can use another tool, such as `wget`, to test certificates. Alternately, you
  135. can add the certificate for the signing certificate authority MacOS system
  136. keychain, using a procedure similar to the one detailed at the
  137. http://support.apple.com/kb/PH14003[Apple knowledge base]. Be sure to add the
  138. signing CA's certificate and not the server's certificate.
  139. [[trb-security-sslhandshake]]
  140. === SSLHandshakeException causes connections to fail
  141. *Symptoms:*
  142. * A `SSLHandshakeException` causes a connection to a node to fail and indicates
  143. that there is a configuration issue. Some of the common exceptions are shown
  144. below with tips on how to resolve these issues.
  145. *Resolution:*
  146. `java.security.cert.CertificateException: No name matching node01.example.com found`::
  147. +
  148. --
  149. Indicates that a client connection was made to `node01.example.com` but the
  150. certificate returned did not contain the name `node01.example.com`. In most
  151. cases, the issue can be resolved by ensuring the name is specified during
  152. certificate creation. For more information, see <<ssl-tls>>. Another scenario is
  153. when the environment does not wish to use DNS names in certificates at all. In
  154. this scenario, all settings in `elasticsearch.yml` should only use IP addresses
  155. including the `network.publish_host` setting.
  156. --
  157. `java.security.cert.CertificateException: No subject alternative names present`::
  158. +
  159. --
  160. Indicates that a client connection was made to an IP address but the returned
  161. certificate did not contain any `SubjectAlternativeName` entries. IP addresses
  162. are only used for hostname verification if they are specified as a
  163. `SubjectAlternativeName` during certificate creation. If the intent was to use
  164. IP addresses for hostname verification, then the certificate will need to be
  165. regenerated with the appropriate IP address. See <<ssl-tls>>.
  166. --
  167. `javax.net.ssl.SSLHandshakeException: null cert chain` and `javax.net.ssl.SSLException: Received fatal alert: bad_certificate`::
  168. +
  169. --
  170. The `SSLHandshakeException` indicates that a self-signed certificate was
  171. returned by the client that is not trusted as it cannot be found in the
  172. `truststore` or `keystore`. This `SSLException` is seen on the client side of
  173. the connection.
  174. --
  175. `sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target` and `javax.net.ssl.SSLException: Received fatal alert: certificate_unknown`::
  176. +
  177. --
  178. This `SunCertPathBuilderException` indicates that a certificate was returned
  179. during the handshake that is not trusted. This message is seen on the client
  180. side of the connection. The `SSLException` is seen on the server side of the
  181. connection. The CA certificate that signed the returned certificate was not
  182. found in the `keystore` or `truststore` and needs to be added to trust this
  183. certificate.
  184. --
  185. [[trb-security-ssl]]
  186. === Common SSL/TLS exceptions
  187. *Symptoms:*
  188. * You might see some exceptions related to SSL/TLS in your logs. Some of the
  189. common exceptions are shown below with tips on how to resolve these issues. +
  190. *Resolution:*
  191. `WARN: received plaintext http traffic on a https channel, closing connection`::
  192. +
  193. --
  194. Indicates that there was an incoming plaintext http request. This typically
  195. occurs when an external applications attempts to make an unencrypted call to the
  196. REST interface. Please ensure that all applications are using `https` when
  197. calling the REST interface with SSL enabled.
  198. --
  199. `org.elasticsearch.common.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record:`::
  200. +
  201. --
  202. Indicates that there was incoming plaintext traffic on an SSL connection. This
  203. typically occurs when a node is not configured to use encrypted communication
  204. and tries to connect to nodes that are using encrypted communication. Please
  205. verify that all nodes are using the same setting for
  206. `xpack.security.transport.ssl.enabled`.
  207. For more information about this setting, see
  208. {ref}/security-settings.html[Security Settings in {es}].
  209. --
  210. `java.io.StreamCorruptedException: invalid internal transport message format, got`::
  211. +
  212. --
  213. Indicates an issue with data received on the transport interface in an unknown
  214. format. This can happen when a node with encrypted communication enabled
  215. connects to a node that has encrypted communication disabled. Please verify that
  216. all nodes are using the same setting for `xpack.security.transport.ssl.enabled`.
  217. For more information about this setting, see
  218. {ref}/security-settings.html[Security Settings in {es}].
  219. --
  220. `java.lang.IllegalArgumentException: empty text`::
  221. +
  222. --
  223. This exception is typically seen when a `https` request is made to a node that
  224. is not using `https`. If `https` is desired, please ensure the following setting
  225. is in `elasticsearch.yml`:
  226. [source,yaml]
  227. ----------------
  228. xpack.security.http.ssl.enabled: true
  229. ----------------
  230. For more information about this setting, see
  231. {ref}/security-settings.html[Security Settings in {es}].
  232. --
  233. `ERROR: unsupported ciphers [...] were requested but cannot be used in this JVM`::
  234. +
  235. --
  236. This error occurs when a SSL/TLS cipher suite is specified that cannot supported
  237. by the JVM that {es} is running in. Security tries to use the specified cipher
  238. suites that are supported by this JVM. This error can occur when using the
  239. Security defaults as some distributions of OpenJDK do not enable the PKCS11
  240. provider by default. In this case, we recommend consulting your JVM
  241. documentation for details on how to enable the PKCS11 provider.
  242. Another common source of this error is requesting cipher suites that use
  243. encrypting with a key length greater than 128 bits when running on an Oracle JDK.
  244. In this case, you must install the
  245. <<ciphers, JCE Unlimited Strength Jurisdiction Policy Files>>.
  246. --
  247. [[trb-security-internalserver]]
  248. === Internal Server Error in Kibana
  249. *Symptoms:*
  250. * In 5.1.1, an `UnhandledPromiseRejectionWarning` occurs and {kib} displays an
  251. Internal Server Error.
  252. //TBD: Is the same true for later releases?
  253. *Resolution:*
  254. If the Security plugin is enabled in {es} but disabled in {kib}, you must
  255. still set `elasticsearch.username` and `elasticsearch.password` in `kibana.yml`.
  256. Otherwise, {kib} cannot connect to {es}.
  257. [[trb-security-setup]]
  258. === Setup-passwords command fails due to connection failure
  259. The {ref}/setup-passwords.html[elasticsearch-setup-passwords command] sets
  260. passwords for the built-in users by sending user management API requests. If
  261. your cluster uses SSL/TLS for the HTTP (REST) interface, the command attempts to
  262. establish a connection with the HTTPS protocol. If the connection attempt fails,
  263. the command fails.
  264. *Symptoms:*
  265. . {es} is running HTTPS, but the command fails to detect it and returns the
  266. following errors:
  267. +
  268. --
  269. [source, shell]
  270. ------------------------------------------
  271. Cannot connect to elasticsearch node.
  272. java.net.SocketException: Unexpected end of file from server
  273. ...
  274. ERROR: Failed to connect to elasticsearch at
  275. http://127.0.0.1:9200/_xpack/security/_authenticate?pretty.
  276. Is the URL correct and elasticsearch running?
  277. ------------------------------------------
  278. --
  279. . SSL/TLS is configured, but trust cannot be established. The command returns
  280. the following errors:
  281. +
  282. --
  283. [source, shell]
  284. ------------------------------------------
  285. SSL connection to
  286. https://127.0.0.1:9200/_xpack/security/_authenticate?pretty
  287. failed: sun.security.validator.ValidatorException:
  288. PKIX path building failed:
  289. sun.security.provider.certpath.SunCertPathBuilderException:
  290. unable to find valid certification path to requested target
  291. Please check the elasticsearch SSL settings under
  292. xpack.security.http.ssl.
  293. ...
  294. ERROR: Failed to establish SSL connection to elasticsearch at
  295. https://127.0.0.1:9200/_xpack/security/_authenticate?pretty.
  296. ------------------------------------------
  297. --
  298. . The command fails because hostname verification fails, which results in the
  299. following errors:
  300. +
  301. --
  302. [source, shell]
  303. ------------------------------------------
  304. SSL connection to
  305. https://idp.localhost.test:9200/_xpack/security/_authenticate?pretty
  306. failed: java.security.cert.CertificateException:
  307. No subject alternative DNS name matching
  308. elasticsearch.example.com found.
  309. Please check the elasticsearch SSL settings under
  310. xpack.security.http.ssl.
  311. ...
  312. ERROR: Failed to establish SSL connection to elasticsearch at
  313. https://elasticsearch.example.com:9200/_xpack/security/_authenticate?pretty.
  314. ------------------------------------------
  315. --
  316. *Resolution:*
  317. . If your cluster uses TLS/SSL for the HTTP interface but the
  318. `elasticsearch-setup-passwords` command attempts to establish a non-secure
  319. connection, use the `--url` command option to explicitly specify an HTTPS URL.
  320. Alternatively, set the `xpack.security.http.ssl.enabled` setting to `true`.
  321. . If the command does not trust the {es} server, verify that you configured the
  322. `xpack.security.http.ssl.certificate_authorities` setting or the
  323. `xpack.security.http.ssl.truststore.path` setting.
  324. . If hostname verification fails, you can disable this verification by setting
  325. `xpack.security.http.ssl.verification_mode` to `certificate`.
  326. For more information about these settings, see
  327. {ref}/security-settings.html[Security Settings in {es}].