Help Center/ Scalable File Service Turbo/ API Reference/ API/ Permissions Management/ Creating and Binding the LDAP Configuration
Updated on 2024-11-13 GMT+08:00

Creating and Binding the LDAP Configuration

Function

This API is used to create and bind the LDAP configuration. Lightweight Directory Access Protocol (LDAP) is a standard protocol used for accessing and controlling directory servers. An LDAP server can centrally manage the relationship between users and groups. After an LDAP server is bound, when a user accesses a file in your file system, SFS Turbo accesses your LDAP server for user authentication and obtains the relationship between users and groups. In this way, standards Linux file UGO permissions are checked. To use this function, you need to first set up an LDAP server. SFS Turbo only supports LDAP v3 currently. Common directory servers that provide LDAP access include OpenLDAP (Linux) and Active Directory (Windows). The implementation varies depending on the directory server. When binding an LDAP server, you need to specify the corresponding schema. If the configured schema is incorrect, SFS Turbo cannot obtain the correct user and group information. As a result, users may fail to access files in the file system. Schemas that SFS Turbo supports include:

  1. RFC2307 (Usually selected for OpenLDAP)

  2. MS-AD-BIS (Usually selected for Active Directory. It supports RFC2307bis and nested groups.)

SFS Turbo also supports active and standby LDAP servers. If one LDAP server fails and cannot be accessed, SFS Turbo automatically switches to the standby LDAP server. In addition, if you set allow_local_user to Yes (default value is No), when both LDAP servers fail, SFS Turbo will use your local user and group information instead of the information configured on the LDAP server for identity authentication and UGO permissions check to minimize the fault impact.

Constraints

base_dn and url cannot be empty.

URI

POST /v1/{project_id}/sfs-turbo/shares/{share_id}/fs/ldap

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

share_id

Yes

String

File system ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Account token

Content-Type

Yes

String

MIME type

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

url

Yes

String

URL of the LDAP server. The format is ldap://{ip_address}:{port_number} or ldaps://{ip_address}:{port_number}, for example, ldap://192.168.xx.xx:60000.

base_dn

Yes

String

Base DN

user_dn

No

String

User DN

password

No

String

LDAP authentication password

vpc_id

No

String

ID of the VPC which the specified LDAP server can be connected to. This parameter is required only when the SFS Turbo file system is used across VPCs.

filter_condition

No

String

Filter criteria. This is a reserved field and is not supported currently.

backup_url

No

String

URL of the standby LDAP server. The format is ldap://{ip_address}:{port_number} or ldaps://{ip_address}:{port_number}, for example, ldap://192.168.xx.xx:60000.

schema

No

String

LDAP schema. If it is not specified, RFC2307 is used by default.

search_timeout

No

Integer

LDAP search timeout interval, in seconds. If it is not specified, 3 seconds is used by default.

allow_local_user

No

String

Whether to allow local user authentication after access to the LDAP server failed.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

jobId

String

ID of an asynchronous LDAP task. You can query the task execution status by calling the API for querying details about a task.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Example Requests

Creating and binding an LDAP server

{
  "url" : "ldap://192.168.xx.xx:60000",
  "base_dn" : "dc=example,dc=com",
  "user_dn" : "cn=admin,dc=example,dc=com",
  "password" : "pwdxxxxxx",
  "backup_url" : "ldap://192.168.xx.xx:60000",
  "schema" : "RFC2307",
  "search_timeout" : 10,
  "allow_local_user" : "Yes"
}

Example Responses

Status code: 200

Request accepted

{
  "jobId" : "72362dxxxxa04d419dbd5e6d9fe5xxxx"
}

Status code: 400

Client error

{
  "errCode" : "SFS.TURBO.0001",
  "errMsg" : "Invalid rule id"
}

Status code: 500

Internal error

{
  "errCode" : "SFS.TURBO.0005",
  "errMsg" : "Internal server error"
}

Status Codes

Status Code

Description

200

Request accepted

400

Client error

500

Internal error

Error Codes

See Error Codes.