> For the complete documentation index, see [llms.txt](https://docs.1kosmos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1kosmos.com/authentication/authentication-proxy/ldap-setup.md).

# LDAP Setup

***

### Starting the LDAP server service

To start the LDAP server on the default port 389 (if no port is specified, 389 is used):

```
./startGoAuthProxy.bsh -u 20783f4d-fc7a-4133-b379-1224f1e3c92e -l "ldap" -b "ou=People,dc=example,dc=com"
```

To start the LDAP server on a custom port (1389):

```
./startGoAuthProxy.bsh -u 20783f4d-fc7a-4133-b379-1224f1e3c92e -l "ldaps:1389" -b "ou=People,dc=example,dc=com"
```

### LDAP/LDAPS server configuration parameters

* `-l <ldap configuration>` (required to start the LDAP/LDAPS server) — specify either `ldap:<port>` or `ldaps:<port>` (protocol is mandatory, port is optional). Default LDAP ports are 389 and 636; custom ports such as `ldap:1389` or `ldaps:2333` are also supported.

{% hint style="info" %}
**Note:**

* On Linux and macOS, you need root access to run servers on ports below 1024, including LDAP on port 389 and LDAPS on port 636.

* A single GoAuthProxy instance does not currently support multiple LDAP/LDAPS servers simultaneously.
  {% endhint %}

* `-b <baseDN>` (required when `-l` is specified) — if the baseDN contains special bash characters, it may need to be escaped. The bind password may also need escaping if it contains bash special characters.

  Use the Bind DN to find the user entry from the user-management endpoint. The Bind DN must be subordinate to both the baseDN specified on the command line (`-b baseDN`) and the authmodule baseDN attribute. Example Bind DN: `cn=johnwick,ou=People,dc=example,dc=com`.

Examples of successful and unsuccessful LDAP bind DN (`-D`) operations using `ldapsearch`:

```
Bind success: DN CN=testuser,ou=People,dc=example,dc=com is subordinate to ou=People,dc=example,dc=com
ldapsearch -Z -x -H ldaps://test.example.com:1389 -D "CN=testuser,ou=People,dc=example,dc=com" -w "push" ...
```

```
Bind fail: DN CN=testuser,ou=People,dc=foo,dc=com is NOT subordinate to ou=People,dc=example,dc=com
ldapsearch -Z -x -H ldaps://test.example.com:1389 -D "CN=testuser,ou=People,dc=foo,dc=com" -w "push" ...
```

```
ldapsearch example escaping password (-w)
ldapsearch -Z -x -H ldaps://test.example.com:1389 -D "CN=testuser,ou=People,dc=foo,dc=com" -w "testPassword123\$238915" ...
```

### **LDAP certificate configuration parameters**

These LDAPS-specific parameters configure the certificate:

* `-c <common name>` — specify the certificate's common name. This optional parameter is not directly used but is included for correctness. If not specified, it defaults to `Server`.
* `-d <dns list>` — specify a list of domain names or DNS names (used as the GOLANG Certificate Subject Alternative Name value). DNS names may include wildcards (`*`) for client-side domain validation. If not provided, the certificate has an empty DNS list. You can ignore this option if the certificate and private key are loaded from a file.

### Stopping the LDAP servers

Run `stopGoAuthProxy.bsh`:

| Port        | Command                         |
| ----------- | ------------------------------- |
| 1636 (ldap) | `./stopGoAuthProxy.bsh -P 1636` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.1kosmos.com/authentication/authentication-proxy/ldap-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
