-
Notifications
You must be signed in to change notification settings - Fork 472
LDAP automatic user provisioning #20033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
61a8fb3
d3166fd
fabdfa7
ae1c4e2
7e4940c
3942aec
729b8b8
9cc0fc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,9 +4,13 @@ summary: Learn how to configure CockroachDB for user authentication using LDAP-c | |||||
toc: true | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This page is broken on preview. Not sure why but often has to do with a misformatted tag: ![]() |
||||||
--- | ||||||
|
||||||
{{site.data.alerts.callout_info}} | ||||||
{% include feature-phases/preview.md %} | ||||||
{{site.data.alerts.end}} | ||||||
|
||||||
CockroachDB supports authentication and authorization using LDAP-compatible directory services, such as Active Directory and Microsoft Entra ID. This allows you to integrate your cluster with your organization's existing identity infrastructure for centralized user management and access control. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be useful to spell out "Lightweight Directory Access Protocol" and link https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol in the intro, unless you feel everyone knows it already. |
||||||
|
||||||
This page describes how to configure CockroachDB user authentication using LDAP. You can additionally configure CockroachDB to use the same directory service for user [authorization]({% link v24.3/ldap-authorization.md %}) (role-based access control), which assigns CockroachDB roles to users based on their group memberships in the directory. | ||||||
This page describes how to configure CockroachDB user authentication using LDAP. You can additionally configure CockroachDB to use the same directory service for user [authorization]({% link {{ page.version.version }}/ldap-authorization.md %}) (role-based access control), which assigns CockroachDB roles to users based on their group memberships in the directory. | ||||||
|
||||||
## Overview | ||||||
|
||||||
|
@@ -21,12 +25,16 @@ While LDAP configuration is cluster-specific, each request to authenticate a use | |||||
- If a matching record was found, the cluster attempts to verify the user's identity through another LDAP request, this time using the credentials (username and password) provided by that user. | ||||||
- If this LDAP bind operation succeeds, the user is authenticated to the CockroachDB cluster. | ||||||
1. Authorize the user (optional) | ||||||
- If [LDAP authorization]({% link v24.3/ldap-authorization.md %}) is also enabled, an additional request is sent to retrieve the groups to which the user is assigned, using configurable criteria. | ||||||
- If [LDAP authorization]({% link {{ page.version.version }}/ldap-authorization.md %}) is also enabled, an additional request is sent to retrieve the groups to which the user is assigned, using configurable criteria. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this right?
Suggested change
|
||||||
- If group memberships are found, any existing CockroachDB roles that match these group names are assigned to the user. | ||||||
|
||||||
These requests use a node's existing connection to the LDAP server, if one is open. Otherwise, the node establishes a new connection. The connection remains open for handling additional LDAP requests until it is closed by the LDAP server, based on its timeout setting. | ||||||
|
||||||
Because CockroachDB maintains no more than one LDAP connection per node, for a cluster with `n` nodes, you can expect up to `n` concurrent LDAP connections. | ||||||
Because CockroachDB maintains no more than one LDAP connection per node, for a cluster with `n` nodes, you can expect up to `n` concurrent LDAP connections. | ||||||
|
||||||
{{site.data.alerts.callout_info}} | ||||||
LDAP authentication cannot be used for the `root` user or other [reserved identities]({% link {{ page.version.version }}/security-reference/authorization.md %}#reserved-identities). Credentials for `root` must be managed separately using password authentication to ensure continuous administrative access regardless of LDAP availability. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{{site.data.alerts.end}} | ||||||
|
||||||
## Configuration | ||||||
|
||||||
|
@@ -96,15 +104,14 @@ SET CLUSTER SETTING server.ldap_authentication.client.tls_key = '<PEM_ENCODED_KE | |||||
|
||||||
### Step 4: Sync database users | ||||||
|
||||||
Before LDAP authentication can be used for a user, the username must be created directly in CockroachDB. You will need to establish an automated method for keeping users in sync with the directory server, creating and dropping them as needed. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
{{site.data.alerts.callout_info}} | ||||||
LDAP authentication cannot be used for the `root` user or other [reserved identities]({% link {{ page.version.version }}/security-reference/authorization.md %}#reserved-identities). Credentials for `root` must be managed separately using password authentication to ensure continuous administrative access regardless of LDAP availability. | ||||||
As of v25.3, CockroachDB can automatically provision users during their first successful LDAP authentication. Refer to the [latest version]({% link {{ site.versions.stable }}/ldap-authentication.md %}) of this page. | ||||||
{{site.data.alerts.end}} | ||||||
|
||||||
Before LDAP authentication can be used for a user, the username must be created directly in CockroachDB. You will need to establish an automated method for keeping users in sync with the directory server, creating and dropping them as needed. | ||||||
|
||||||
For Active Directory deployments, the CockroachDB username can typically be set to match the `sAMAccountName` field from the `user` object. This field name would need to be specified in the HBA configuration using `ldapsearchattribute=sAMAccountName`. | ||||||
|
||||||
{{site.data.alerts.callout_info}} | ||||||
SQL usernames must comply with CockroachDB's [username requirements]({% link {{ page.version.version }}/create-user.md %}#user-names). Ensure that the values in the field you are using for `ldapsearchattribute` meet these requirements. | ||||||
{{site.data.alerts.end}} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.