YAML files

Before running securityadmin.sh to load the settings into the .opendistro_security index, configure the YAML files in plugins/opensearch-security/securityconfig. You might want to back up these files so that you can reuse them on other clusters.

The best use of these YAML files is to configure reserved and hidden resources, such as the admin and kibanaserver users. You might find it easier to create other users, roles, mappings, action groups, and tenants using OpenSearch Dashboards or the REST API.

internal_users.yml

This file contains any initial users that you want to add to the security plugin’s internal user database.

The file format requires a hashed password. To generate one, run plugins/opensearch-security/tools/hash.sh -p <new-password>. If you decide to keep any of the demo users, change their passwords and re-run securityadmin.sh to apply the new passwords.

  1. ---
  2. # This is the internal user database
  3. # The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh
  4. _meta:
  5. type: "internalusers"
  6. config_version: 2
  7. # Define your internal users here
  8. new-user:
  9. hash: "$2y$12$88IFVl6IfIwCFh5aQYfOmuXVL9j2hz/GusQb35o.4sdTDAEMTOD.K"
  10. reserved: false
  11. hidden: false
  12. opensearch_security_roles:
  13. - "specify-some-security-role-here"
  14. backend_roles:
  15. - "specify-some-backend-role-here"
  16. attributes:
  17. attribute1: "value1"
  18. static: false
  19. ## Demo users
  20. admin:
  21. hash: "$2a$12$VcCDgh2NDk07JGN0rjGbM.Ad41qVR/YFJcgHp0UGns5JDymv..TOG"
  22. reserved: true
  23. backend_roles:
  24. - "admin"
  25. description: "Demo admin user"
  26. kibanaserver:
  27. hash: "$2a$12$4AcgAt3xwOWadA5s5blL6ev39OXDNhmOesEoo33eZtrq2N0YrU3H."
  28. reserved: true
  29. description: "Demo user for the OpenSearch Dashboards server"
  30. kibanaro:
  31. hash: "$2a$12$JJSXNfTowz7Uu5ttXfeYpeYE0arACvcwlPBStB1F.MI7f0U9Z4DGC"
  32. reserved: false
  33. backend_roles:
  34. - "kibanauser"
  35. - "readall"
  36. attributes:
  37. attribute1: "value1"
  38. attribute2: "value2"
  39. attribute3: "value3"
  40. description: "Demo read-only user for OpenSearch dashboards"
  41. logstash:
  42. hash: "$2a$12$u1ShR4l4uBS3Uv59Pa2y5.1uQuZBrZtmNfqB3iM/.jL0XoV9sghS2"
  43. reserved: false
  44. backend_roles:
  45. - "logstash"
  46. description: "Demo logstash user"
  47. readall:
  48. hash: "$2a$12$ae4ycwzwvLtZxwZ82RmiEunBbIPiAmGZduBAjKN0TXdwQFtCwARz2"
  49. reserved: false
  50. backend_roles:
  51. - "readall"
  52. description: "Demo readall user"
  53. snapshotrestore:
  54. hash: "$2y$12$DpwmetHKwgYnorbgdvORCenv4NAK8cPUg8AI6pxLCuWf/ALc0.v7W"
  55. reserved: false
  56. backend_roles:
  57. - "snapshotrestore"
  58. description: "Demo snapshotrestore user"

opensearch.yml

In addition to many OpenSearch settings, this file contains paths to TLS certificates and their attributes, such as distinguished names and trusted certificate authorities.

  1. plugins.security.ssl.transport.pemcert_filepath: esnode.pem
  2. plugins.security.ssl.transport.pemkey_filepath: esnode-key.pem
  3. plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
  4. plugins.security.ssl.transport.enforce_hostname_verification: false
  5. plugins.security.ssl.http.enabled: true
  6. plugins.security.ssl.http.pemcert_filepath: esnode.pem
  7. plugins.security.ssl.http.pemkey_filepath: esnode-key.pem
  8. plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
  9. plugins.security.allow_unsafe_democertificates: true
  10. plugins.security.allow_default_init_securityindex: true
  11. plugins.security.authcz.admin_dn:
  12. - CN=kirk,OU=client,O=client,L=test, C=de
  13. plugins.security.audit.type: internal_opensearch
  14. plugins.security.enable_snapshot_restore_privilege: true
  15. plugins.security.check_snapshot_restore_write_privileges: true
  16. plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]
  17. plugins.security.system_indices.enabled: true
  18. plugins.security.system_indices.indices: [".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opendistro-notifications-*", ".opendistro-notebooks", ".opendistro-asynchronous-search-response*"]
  19. node.max_local_storage_nodes: 3

If you want to run your users’ passwords against some validation, specify a regular expression (regex) in this file. You can also include an error message that loads when passwords don’t pass validation. The following example demonstrates how to include a regex so OpenSearch requires new passwords to be a minimum of eight characters with at least one uppercase, one lowercase, one digit, and one special character.

Note that OpenSearch validates only users and passwords created through OpenSearch Dashboards or the REST API.

  1. plugins.restapi.password_validation_regex: '(?=.*[A-Z])(?=.*[^a-zA-Z\d])(?=.*[0-9])(?=.*[a-z]).{8,}'
  2. plugins.restapi.password_validation_error_message: "Password must be minimum 8 characters long and must contain at least one uppercase letter, one lowercase letter, one digit, and one special character."

roles.yml

This file contains any initial roles that you want to add to the security plugin. Aside from some metadata, the default file is empty, because the security plugin has a number of static roles that it adds automatically.

  1. ---
  2. complex-role:
  3. reserved: false
  4. hidden: false
  5. cluster_permissions:
  6. - "read"
  7. - "cluster:monitor/nodes/stats"
  8. - "cluster:monitor/task/get"
  9. index_permissions:
  10. - index_patterns:
  11. - "opensearch_dashboards_sample_data_*"
  12. dls: "{\"match\": {\"FlightDelay\": true}}"
  13. fls:
  14. - "~FlightNum"
  15. masked_fields:
  16. - "Carrier"
  17. allowed_actions:
  18. - "read"
  19. tenant_permissions:
  20. - tenant_patterns:
  21. - "analyst_*"
  22. allowed_actions:
  23. - "kibana_all_write"
  24. static: false
  25. _meta:
  26. type: "roles"
  27. config_version: 2

roles_mapping.yml

  1. ---
  2. manage_snapshots:
  3. reserved: true
  4. hidden: false
  5. backend_roles:
  6. - "snapshotrestore"
  7. hosts: []
  8. users: []
  9. and_backend_roles: []
  10. logstash:
  11. reserved: false
  12. hidden: false
  13. backend_roles:
  14. - "logstash"
  15. hosts: []
  16. users: []
  17. and_backend_roles: []
  18. own_index:
  19. reserved: false
  20. hidden: false
  21. backend_roles: []
  22. hosts: []
  23. users:
  24. - "*"
  25. and_backend_roles: []
  26. description: "Allow full access to an index named like the username"
  27. kibana_user:
  28. reserved: false
  29. hidden: false
  30. backend_roles:
  31. - "kibanauser"
  32. hosts: []
  33. users: []
  34. and_backend_roles: []
  35. description: "Maps kibanauser to kibana_user"
  36. complex-role:
  37. reserved: false
  38. hidden: false
  39. backend_roles:
  40. - "ldap-analyst"
  41. hosts: []
  42. users:
  43. - "new-user"
  44. and_backend_roles: []
  45. _meta:
  46. type: "rolesmapping"
  47. config_version: 2
  48. all_access:
  49. reserved: true
  50. hidden: false
  51. backend_roles:
  52. - "admin"
  53. hosts: []
  54. users: []
  55. and_backend_roles: []
  56. description: "Maps admin to all_access"
  57. readall:
  58. reserved: true
  59. hidden: false
  60. backend_roles:
  61. - "readall"
  62. hosts: []
  63. users: []
  64. and_backend_roles: []
  65. kibana_server:
  66. reserved: true
  67. hidden: false
  68. backend_roles: []
  69. hosts: []
  70. users:
  71. - "kibanaserver"
  72. and_backend_roles: []

action_groups.yml

This file contains any initial action groups that you want to add to the security plugin.

Aside from some metadata, the default file is empty, because the security plugin has a number of static action groups that it adds automatically. These static action groups cover a wide variety of use cases and are a great way to get started with the plugin.

  1. ---
  2. my-action-group:
  3. reserved: false
  4. hidden: false
  5. allowed_actions:
  6. - "indices:data/write/index*"
  7. - "indices:data/write/update*"
  8. - "indices:admin/mapping/put"
  9. - "indices:data/write/bulk*"
  10. - "read"
  11. - "write"
  12. static: false
  13. _meta:
  14. type: "actiongroups"
  15. config_version: 2

tenants.yml

  1. ---
  2. _meta:
  3. type: "tenants"
  4. config_version: 2
  5. admin_tenant:
  6. reserved: false
  7. description: "Demo tenant for admin user"

nodes_dn.yml

  1. ---
  2. _meta:
  3. type: "nodesdn"
  4. config_version: 2
  5. # Define nodesdn mapping name and corresponding values
  6. # cluster1:
  7. # nodes_dn:
  8. # - CN=*.example.com