Skip to content
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

[doc/example] Make LDAP example functional again by running OpenLDAP with docker-compose #1762

Merged
merged 4 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Documentation/connectors/ldap.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ The connector executes two primary queries:

The dex repo contains a basic LDAP setup using [OpenLDAP][openldap].

First start the LDAP server using the example script. This will run the OpenLDAP daemon and seed it with an initial set of users.
First start the LDAP server using docker-compose. This will run the OpenLDAP daemon in a Docker container, and seed it with an initial set of users.

```
./scripts/slapd.sh
cd examples/ldap
docker-compose up
```

This script sets the LDAP daemon to debug mode, and is expected to print several error messages which are normal. Once the server is up, run dex.
This container is expected to print several warning messages which are normal. Once the server is up, run dex in another terminal.

```
./bin/dex serve examples/config-ldap.yaml
./bin/dex serve examples/ldap/config-ldap.yaml
```

Then run the OAuth client in another terminal.
Expand Down
12 changes: 7 additions & 5 deletions examples/config-ldap.ldif → examples/ldap/config-ldap.ldif
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
dn: dc=example,dc=org
objectClass: dcObject
objectClass: organization
o: Example Company
dc: example
# Already included in default config of Docker image osixia/openldap:1.4.0.
#
# dn: dc=example,dc=org
# objectClass: dcObject
# objectClass: organization
# o: Example Company
# dc: example

dn: ou=People,dc=example,dc=org
objectClass: organizationalUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ connectors:
name: OpenLDAP
id: ldap
config:
host: localhost:10389
host: localhost:389

# No TLS for this setup.
insecureNoSSL: true
Expand Down
16 changes: 16 additions & 0 deletions examples/ldap/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

services:
ldap:
image: osixia/openldap:1.4.0
# Copying is required because the entrypoint modifies the *.ldif files.
# For verbose output, use: command: ["--copy-service", "--loglevel", "debug"]
command: ["--copy-service"]
# https://github.com/osixia/docker-openldap#seed-ldap-database-with-ldif
# Option 1: Add custom seed file -> mount to /container/service/slapd/assets/config/bootstrap/ldif/custom/
# Option 2: Overwrite default seed file -> mount to /container/service/slapd/assets/config/bootstrap/ldif/
volumes:
- ./config-ldap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/config-ldap.ldif
ports:
- 389:389
- 636:636