2022-12-14 11:19:32 +01:00
|
|
|
ARG LDAP_ADMIN_PASSWORD
|
|
|
|
ARG LDAP_DOMAIN
|
|
|
|
ARG LDAP_ORGANISATION
|
2022-12-14 21:57:05 +01:00
|
|
|
ARG LDAP_USER
|
|
|
|
ARG LDAP_GROUP
|
2022-12-14 11:19:32 +01:00
|
|
|
|
2023-05-17 20:09:18 +02:00
|
|
|
FROM debian:stable-slim
|
|
|
|
|
|
|
|
ARG LDAP_ADMIN_PASSWORD
|
|
|
|
ARG LDAP_DOMAIN
|
|
|
|
ARG LDAP_ORGANISATION
|
|
|
|
ARG LDAP_USER=1000
|
|
|
|
ARG LDAP_GROUP=1000
|
|
|
|
|
|
|
|
ARG UID=1000
|
|
|
|
ARG GID=1000
|
|
|
|
|
2022-12-14 11:19:32 +01:00
|
|
|
ENV LDAP_ADMIN_PASSWORD $LDAP_ADMIN_PASSWORD
|
|
|
|
ENV LDAP_ORGANISATION $LDAP_ORGANISATION
|
|
|
|
ENV LDAP_DOMAIN $LDAP_DOMAIN
|
2022-12-14 21:57:05 +01:00
|
|
|
ENV LDAP_USER $LDAP_USER
|
|
|
|
ENV LDAP_GROUP $LDAP_GROUP
|
2022-12-14 11:19:32 +01:00
|
|
|
|
|
|
|
RUN apt-get update -y && apt dist-upgrade -y
|
|
|
|
|
2023-05-17 20:09:18 +02:00
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y slapd ldap-utils ca-certificates
|
2022-12-14 11:19:32 +01:00
|
|
|
|
2023-05-17 20:09:18 +02:00
|
|
|
RUN usermod -u ${UID} openldap && \
|
|
|
|
groupmod -g ${GID} openldap
|
2022-12-14 11:19:32 +01:00
|
|
|
|
|
|
|
ADD slapd.sh /opt/slapd
|
2023-05-17 20:09:18 +02:00
|
|
|
|
|
|
|
## Run on entrypoint
|
|
|
|
#RUN /opt/slapd
|
|
|
|
|
|
|
|
#COPY ./schema/*.ldif ./schema/*.schema /etc/ldap/schema/
|
|
|
|
|
|
|
|
#RUN slapcat -n 0 \
|
|
|
|
# |sed 's/cn: config/cn: config\nolcPasswordHash: {CRYPT}\nolcPasswordCryptSaltFormat: $6$%.16s/' \
|
|
|
|
# |sed 's/cn: module{0}/cn: module{0}\nolcModuleLoad: {0}lastbind/' > /tmp/config.ldif && \
|
|
|
|
# rm -rf /etc/ldap/slapd.d/* && \
|
|
|
|
# slapadd -n 0 -F /etc/ldap/slapd.d/ -l /tmp/config.ldif && \
|
|
|
|
# echo "dn: olcOverlay={0}lastbind, olcDatabase={1}mdb,cn=config\nobjectClass: olcLastBindConfig\nolcOverlay: {0}lastbind" | slapadd -n 0 && \
|
|
|
|
# slapadd -l /etc/ldap/schema/nextcloud.ldif && \
|
|
|
|
# rm /tmp/config.ldif
|
2022-12-14 21:57:05 +01:00
|
|
|
|
|
|
|
RUN chmod -R o+rw /etc/ldap/slapd.d/ && \
|
|
|
|
chmod -R o+rwx /etc/ldap/slapd.d/cn=config/ && \
|
|
|
|
chmod -R o+rwx /etc/ldap/slapd.d/cn=config/cn=schema/ && \
|
2022-12-14 22:13:58 +01:00
|
|
|
chmod -R o+rwx /var/lib/ldap && \
|
2022-12-14 21:57:05 +01:00
|
|
|
chmod -R o+rw /var/run/slapd/
|
2022-12-14 11:19:32 +01:00
|
|
|
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
2022-12-14 21:57:05 +01:00
|
|
|
ADD entrypoint.sh /entrypoint.sh
|
|
|
|
|
|
|
|
#VOLUME ["/var/lib/ldap"]
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
|
|
|
EXPOSE 389
|
|
|
|
|
|
|
|
CMD ["/usr/sbin/slapd","-h", "ldap:///","-d","4"]
|