1
0

security.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. [[modules-scripting-security]]
  2. == Scripting and security
  3. Painless and {es} implement layers of security to build a defense in depth
  4. strategy for running scripts safely.
  5. Painless uses a fine-grained allowlist. Anything that is not part of the
  6. allowlist results in a compilation error. This capability is the first layer of
  7. security in a defense in depth strategy for scripting.
  8. The second layer of security is the https://www.oracle.com/java/technologies/javase/seccodeguide.html[Java Security Manager]. As part of its startup
  9. sequence, {es} enables the Java Security Manager to limit the actions that
  10. portions of the code can take. <<modules-scripting-painless,Painless>> uses
  11. the Java Security Manager as an additional layer of defense to prevent scripts
  12. from doing things like writing files and listening to sockets.
  13. {es} uses
  14. {wikipedia}/Seccomp[seccomp] in Linux,
  15. https://www.chromium.org/developers/design-documents/sandbox/osx-sandboxing-design[Seatbelt]
  16. in macOS, and
  17. https://msdn.microsoft.com/en-us/library/windows/desktop/ms684147[ActiveProcessLimit]
  18. on Windows as additional security layers to prevent {es} from forking or
  19. running other processes.
  20. You can modify the following script settings to restrict the type of scripts
  21. that are allowed to run, and control the available
  22. {painless}/painless-contexts.html[contexts] that scripts can run in. To
  23. implement additional layers in your defense in depth strategy, follow the
  24. <<es-security-principles,{es} security principles>>.
  25. [[allowed-script-types-setting]]
  26. [discrete]
  27. === Allowed script types setting
  28. {es} supports two script types: `inline` and `stored`. By default, {es} is
  29. configured to run both types of scripts. To limit what type of scripts are run,
  30. set `script.allowed_types` to `inline` or `stored`. To prevent any scripts from
  31. running, set `script.allowed_types` to `none`.
  32. IMPORTANT: If you use {kib}, set `script.allowed_types` to `both` or `inline`.
  33. Some {kib} features rely on inline scripts and do not function as expected
  34. if {es} does not allow inline scripts.
  35. For example, to run `inline` scripts but not `stored` scripts:
  36. [source,yaml]
  37. ----
  38. script.allowed_types: inline
  39. ----
  40. [[allowed-script-contexts-setting]]
  41. [discrete]
  42. === Allowed script contexts setting
  43. By default, all script contexts are permitted. Use the `script.allowed_contexts`
  44. setting to specify the contexts that are allowed. To specify that no contexts
  45. are allowed, set `script.allowed_contexts` to `none`.
  46. For example, to allow scripts to run only in `scoring` and `update` contexts:
  47. [source,yaml]
  48. ----
  49. script.allowed_contexts: score, update
  50. ----