Skip to content

Commit eb7e05e

Browse files
committed
Add OpenLDAP support in Makefile and include necessary schema and LDIF files
- Introduced OpenLDAP configuration in the Makefile with a new target to start the OpenLDAP database for development. - Added `openldap.local.ldif` to define organizational units for users. - Created `sogxmail.schema` to define custom attributes and object classes for OpenLDAP integration.
1 parent 12420c6 commit eb7e05e

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ BASE_NAME = "sesame"
33
APP_NAME = "sesame-daemon"
44
PLATFORM = "linux/amd64"
55
PKG_TARGETS = "linux,macos,win"
6+
SESAME_OPENLDAP_PORT?=389
7+
SESAME_LDAPORGANISATION?=Sesame
8+
SESAME_LDAPDOMAIN?=sesame.local
9+
SESAME_LDAPPASSWORD?=sesame
610
include .env
711

812
.DEFAULT_GOAL := help
13+
.PHONY: help build dev install exec pkg dbs openldap stop stop-all
914
help:
1015
@printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n"
1116
@grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) \
@@ -96,10 +101,21 @@ dbs: ## Start databases
96101
redis redis-server --appendonly yes || true
97102
@docker exec -it $(BASE_NAME)-mongodb mongosh --eval "rs.initiate({_id: 'rs0', members: [{_id: 0, host: '127.0.0.1:27017'}]})" || true
98103

104+
openldap: ## Start openldap database for development
105+
@docker run --rm -it --name $(BASE_NAME)-openldap \
106+
-e LDAP_ORGANISATION=$(SESAME_LDAPORGANISATION) \
107+
-e LDAP_DOMAIN=$(SESAME_LDAPDOMAIN) \
108+
-e LDAP_ADMIN_PASSWORD=$(SESAME_LDAPPASSWORD) \
109+
-v $(CURDIR)/openldap/sogxmail.schema:/container/service/slapd/assets/config/bootstrap/schema/custom/sogxmail.schema \
110+
-v $(CURDIR)/openldap/openldap.local.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif \
111+
--network dev \
112+
-p $(SESAME_OPENLDAP_PORT):389 \
113+
osixia/openldap:1.5.0 --copy-service || true
114+
99115
stop: ## Stop the container
100116
@docker stop $(APP_NAME) || true
101117

102-
stop-all: ## Stop the container
118+
stop-all: ## Stop all containers
103119
@docker stop $(APP_NAME) || true
104120
@docker stop $(BASE_NAME)-mongodb || true
105121
@docker stop $(BASE_NAME)-redis || true

openldap/openldap.local.ldif

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
dn: ou=peoples,dc=sesame,dc=local
2+
objectClass: top
3+
objectClass: organizationalUnit
4+
ou: peoples
5+
6+
dn: ou=Etudiants,ou=peoples,dc=sesame,dc=local
7+
objectClass: top
8+
objectClass: organizationalUnit
9+
ou: Etudiants
10+
11+
dn: ou=Administratifs,ou=peoples,dc=sesame,dc=local
12+
objectClass: top
13+
objectClass: organizationalUnit
14+
ou: Administratifs
15+
16+
dn: ou=Enseignants,ou=peoples,dc=sesame,dc=local
17+
objectClass: top
18+
objectClass: organizationalUnit
19+
ou: Enseignants

openldap/sogxmail.schema

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Minimal sogxmail schema for dev OpenLDAP
3+
#
4+
5+
attributetype ( 1.3.6.1.4.1.7383.20.1
6+
NAME 'sogxdisableflag'
7+
DESC 'Account disable flag'
8+
EQUALITY caseIgnoreIA5Match
9+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
10+
SINGLE-VALUE )
11+
12+
attributetype ( 1.3.6.1.4.1.7383.20.2
13+
NAME 'proxyaddress'
14+
DESC 'Emulate AD proxyaddress'
15+
EQUALITY caseIgnoreIA5Match
16+
SUBSTR caseIgnoreIA5SubstringsMatch
17+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
18+
19+
attributetype ( 1.3.6.1.4.1.7383.20.3
20+
NAME 'sogxHomeServer'
21+
DESC 'Server which keeps the users mailbox'
22+
EQUALITY caseIgnoreIA5Match
23+
SUBSTR caseIgnoreIA5SubstringsMatch
24+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
25+
26+
attributetype ( 1.3.6.1.4.1.7383.20.4
27+
NAME 'sogxquota'
28+
DESC 'Mailbox quota'
29+
EQUALITY caseIgnoreIA5Match
30+
SUBSTR caseIgnoreIA5SubstringsMatch
31+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
32+
33+
objectclass ( 1.3.6.1.4.1.7383.21.1
34+
NAME 'sogxUser'
35+
DESC 'SogxUser'
36+
SUP top
37+
AUXILIARY
38+
MAY ( sogxquota $ proxyaddress $ sogxHomeServer $ sogxdisableflag ) )
39+

0 commit comments

Comments
 (0)