Create LDAP configuration

POST /platform/configuration/security/realms/ldap

Creates a new LDAP configuration.

Body Required

The LDAP configuration

  • id string Required

    The identifier for the security realm

  • name string Required

    The friendly name of the security realm

  • urls array[string] Required

    The LDAP URLs used to authenticate against, in the format ldap[s]://server:port. Note that ldap and ldaps protocols cannot be mixed together.

  • bind_anonymously boolean Required

    When true, bindDb credentials are ignored

  • bind_type string Required

    The type of user binding to apply

    Values are user_search or user_templates.

  • user_dn_templates array[string]

    The distinguished name template that replaces the user name with the string {0}. Only used when bind_type is set to 'user_templates'.

  • bind_dn string

    The distinguished name of the user that is used to bind to the LDAP and perform searches. Only used when bind_type is set to 'user_search'.

  • The user password that is used to bind to the LDAP server. Only used when bind_type is set to 'user_search'.

  • Specifies the attribute to examine on the user for group membership. If any 'group_search' settings are specified, this setting is ignored. Defaults to 'memberOf'.

  • The LDAP load balancing behavior

    Additional properties are allowed.

    Hide load_balance attributes Show load_balance attributes object
    • type string

      The behavior to use when there are multiple LDAP URLs defined

      Values are failover, dns_failover, round_robin, or dns_round_robin.

    • When using dns_failover or dns_round_robin as the load balancing type, this setting controls the amount of time to cache DNS lookups. Defaults to 1h.

  • The SSL trusted CA certificate bundle URL. The bundle should be a zip file containing a single keystore file 'keystore.ks' in the directory '/ldap/:id/truststore', where :id is the value of the [id] field.

  • The password to the certificate bundle URL truststore

  • The format of the truststore file. Should be jks to use the Java Keystore format or PKCS12 to use PKCS#12 files. The default is jks.

    Values are jks or PKCS12.

  • The role mapping rules associated with the security realm

    Additional properties are allowed.

    Hide role_mappings attributes Show role_mappings attributes object
    • default_roles array[string] Required

      The default roles applied to all users

    • rules array[object] Required

      The role mapping rules to evaluate

      Hide rules attributes Show rules attributes object
      • type string Required

        The type of role mapping rule

        Values are user_dn or group_dn.

      • roles array[string] Required

        The roles that are applied when the mapping rule is successfully evaluated

      • value string Required

        The value to match when evaluating this rule

  • enabled boolean

    When true, enables the security realm

  • order integer(int32)

    The order that the security realm is evaluated

  • Advanced configuration options in YAML format. Any settings defined here will override any configuration set via the API. Note that all keys should omit the 'xpack.security.authc.realms.ldap.{realm_id}' prefix. For example, when the realm ID is set to 'ldap1', the advanced configuration 'xpack.security.authc.realms.ldap.ldap1.ssl.verification_mode: full' should be added as 'ssl.verification_mode: full'.

Responses

  • The LDAP configuration was successfully created

    Hide headers attributes Show headers attributes

    Additional properties are allowed.

    • The realm id is already in use. (code: security_realm.id_conflict)
    • The selected id is not valid. (code: security_realm.invalid_id)
    • Order must be greater than zero. (code: security_realm.invalid_order)
    • Invalid Elasticsearch Security realm type. (code: security_realm.invalid_type)
    • The realm order is already in use. (code: security_realm.order_conflict)
    • Advanced YAML format is invalid. (code: security_realm.invalid_yaml)
    • The url format is invalid. (code: security_realm.invalid_url)
    • Invalid LDAP URL. (code: security_realm.ldap.invalid_url)
    • Invalid certificate bundle URL. (code: security_realm.invalid_bundle_url)
    Hide headers attribute Show headers attribute
    • The error codes associated with the response

      Values are security_realm.id_conflict, security_realm.invalid_id, security_realm.invalid_order, security_realm.invalid_type, security_realm.order_conflict, security_realm.invalid_yaml, security_realm.invalid_url, security_realm.ldap.invalid_url, or security_realm.invalid_bundle_url.

    Hide response attribute Show response attribute object
    • errors array[object] Required

      A list of errors that occurred in the failing request

      Hide errors attributes Show errors attributes object
      • code string Required

        A structured code representing the error type that occurred

      • message string Required

        A human readable message describing the error that occurred

      • fields array[string]

        If the error can be tied to a specific field or fields in the user request, this lists those fields

POST /platform/configuration/security/realms/ldap
curl \
 -X POST https://{{hostname}}/api/v1/platform/configuration/security/realms/ldap \
 -d '{"id":"string","name":"string","urls":["string"],"bind_anonymously":true,"bind_type":"user_search","group_search":{"base_dn":"string","scope":"sub_tree","filter":"string","user_attribute":"string"},"user_search":{"base_dn":"string","scope":"sub_tree","filter":"string"},"user_dn_templates":["string"],"bind_dn":"string","bind_password":"string","user_group_attribute":"string","load_balance":{"type":"failover","cache_ttl":"string"},"certificate_url":"string","certificate_url_truststore_password":"string","certificate_url_truststore_type":"jks","role_mappings":{"default_roles":["string"],"rules":[{"type":"user_dn","roles":["string"],"value":"string"}]},"enabled":true,"order":42,"override_yaml":"string"}'
Request examples
{
  "id": "string",
  "name": "string",
  "urls": [
    "string"
  ],
  "bind_anonymously": true,
  "bind_type": "user_search",
  "group_search": {
    "base_dn": "string",
    "scope": "sub_tree",
    "filter": "string",
    "user_attribute": "string"
  },
  "user_search": {
    "base_dn": "string",
    "scope": "sub_tree",
    "filter": "string"
  },
  "user_dn_templates": [
    "string"
  ],
  "bind_dn": "string",
  "bind_password": "string",
  "user_group_attribute": "string",
  "load_balance": {
    "type": "failover",
    "cache_ttl": "string"
  },
  "certificate_url": "string",
  "certificate_url_truststore_password": "string",
  "certificate_url_truststore_type": "jks",
  "role_mappings": {
    "default_roles": [
      "string"
    ],
    "rules": [
      {
        "type": "user_dn",
        "roles": [
          "string"
        ],
        "value": "string"
      }
    ]
  },
  "enabled": true,
  "order": 42,
  "override_yaml": "string"
}
Response examples (201)
# Headers
x-cloud-resource-version: string
x-cloud-resource-created: string
x-cloud-resource-last-modified: string

# Payload
{}
Response examples (400)
# Headers
x-cloud-error-codes: security_realm.id_conflict

# Payload
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}