phi/openldap/Makefile

39 lines
753 B
Makefile

.PHONY: all
all: build run
.PHONY: build
build: gen-cert
docker build --no-cache -t unit/slapd .
.PHONY: gen-cert
gen-cert:
openssl req \
-x509 -nodes -days 365 -sha256 \
-subj '/C=IT/ST=Lombardia/L=Milano/CN=localhost' \
-newkey rsa:2048 -keyout key.pem -out cert.pem
.PHONY: clean
clean:
rm -f key.pem cert.pem
.PHONY: run
run:
docker run -p 389:389 --rm unit/slapd
.PHONY: shell
shell:
LDAPTLS_REQCERT=never sh
.PHONY: populate
populate:
ldapmodify -ZZ -H ldap://127.0.0.1 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-a -f init.ldif
.PHONY: inspect
inspect:
ldapsearch -ZZ -H ldap://127.0.0.1 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-b "dc=unit,dc=macaomilano,dc=org" \
'(objectclass=*)'