Skip to content

Commit

Permalink
Add LDAP container
Browse files Browse the repository at this point in the history
  • Loading branch information
fpotier committed May 29, 2024
1 parent e3e534f commit 4642f26
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/backend/services/ldap/.compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## empty file used when override configs are not enabled
17 changes: 17 additions & 0 deletions services/backend/services/ldap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# LDAP (OpenLDAP)

LDAP (Lightweight Directory Access Protocol) is a protocol used to access and manage directory information such as user credentials.
SciCat can use LDAP as third-party authentication provider.

## Configuration options

The OpenLDAP configuration is set by the [.env file](./config/.env).

For an extensive list of available options see [here](https://hub.docker.com/r/bitnami/openldap).

## Default configuration
The default configuration [.env file](./config/.env) creates the `dc=facility` domain with the following user:

| Username | Password |
| --------- | -------- |
| ldap-user | password |
13 changes: 13 additions & 0 deletions services/backend/services/ldap/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
ldap:
image: bitnami/openldap:2.6
volumes:
- ./config/ldifs:/ldifs:ro
env_file:
- ./config/.env
healthcheck:
test: ldapwhoami -H ldap://ldap:389 -D 'cn=admin,dc=facility' -w 'admin'
start_period: 5s
interval: 10s
timeout: 10s
retries: 5
4 changes: 4 additions & 0 deletions services/backend/services/ldap/config/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LDAP_ADMIN_USERNAME=admin
LDAP_ADMIN_PASSWORD=admin
LDAP_PORT_NUMBER=389
LDAP_ROOT=dc=facility
11 changes: 11 additions & 0 deletions services/backend/services/ldap/config/ldifs/01-bootstrap.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dn: dc=facility
objectClass: top
objectClass: dcObject
objectClass: organization
o: My Organization
dc: facility

dn: ou=users,dc=facility
objectClass: top
objectClass: organizationalUnit
ou: users
12 changes: 12 additions & 0 deletions services/backend/services/ldap/config/ldifs/02-users.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dn: uid=ldap-user,ou=users,dc=facility
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: ldap-user
cn: LDAP user
displayName: ldap-user
sn: LDAP
givenName: User
mail: ldap-user@facility.com
userPassword: password

0 comments on commit 4642f26

Please sign in to comment.