Create static LDAP roles
Configure static roles to map names in Vault to LDAP entries and use the rotation settings to manage credentials automatically with the role.
For self-managed roles, use Vault Enterprise 2.2.0 or later and set
self_managed=true when you first configure the mount with the CLI or API.
You cannot change the management setting after configuration, and the GUI
configuration form does not include it. Do not set bindpass on a self-managed
mount.
For example, if you enable a new LDAP plugin at the path self-managed-ldap:
$ vault secrets enable -path=self-managed-ldap ldap
You can then configure self-management for the plugin using vault write:
$ vault write self-managed-ldap/config \
url="ldaps://ldap.example.com" \
schema="openldap" \
self_managed=true
Create a configuration file,
ldap-role.json, with your role settings:{ "role_name": "<vault_role_name>", "username": "<existing_ldap_username>", "dn": "<existing_ldap_dn>", "rotation_period": "<credential_rotation_frequency>" }For example:
{ "role_name": "hashicorp", "username": "vault", "dn": "uid=vault,ou=users,dc=hashicorp,dc=com", "rotation_period": "24h" }You must set
passwordto the current account password for a self-managed mount.Save the new role:
Use
vault writewith the/{mount_path}/static-rolepath and your static role configuration,ldap-role.json, to create a new static role:$ vault write <mount_path>/static-role @ldap-role.jsonFor example:
$ vault write devcreds/static-role @ldap-role.jsonFor example, to create a self-managed role without a configuration file:
$ vault write self-managed-ldap/static-role/billing-svc \ dn="cn=billing-svc,ou=services,dc=example,dc=com" \ username="billing-svc" \ password="<current-password>" \ rotation_period=0Confirm the role settings by requesting credentials from the plugin:
Use
vault readwith the/{mount_path}/static-cred/{role_name}path to fetch the credential information for the given role:$ vault read <mount_path>/static-role/<role_name>For example:
$ vault read devcreds/static-role/hashicorp