osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.06k stars 978 forks source link

Error when Restarting LDAP_SEED_INTERNAL_LDIF_PATH LDAP_SEED_INTERNAL_SCHEMA_PATH /container/run/service/slapd/assets/config/bootstrap/schema/custom #660

Open ugoevola opened 1 year ago

ugoevola commented 1 year ago
version: '3'
services:
  openldap:
    image: osixia/openldap:1.5.0
    container_name: openldap
    hostname: openldap
    restart: unless-stopped
    ports:
      - "389:389"
      - "636:636"
    volumes:
      - /var/lib/ldap
      - /etc/ldap/slapd.d
      - /container/service/slapd/assets/certs/
      - ./assets/openldap/schema:/assets/openldap/custom/schema
      - ./assets/openldap/ldif:/assets/openldap/custom/ldif
    environment:
      LDAP_LOG_LEVEL: "8"
      LDAP_ORGANISATION: "Test"
      LDAP_DOMAIN: "test.com"
      LDAP_BASE_DN: ""
      LDAP_ADMIN_PASSWORD: "admin"
      LDAP_CONFIG_PASSWORD: "config"
      LDAP_READONLY_USER: "false"
      LDAP_RFC2307BIS_SCHEMA: "false"
      LDAP_BACKEND: "mdb"
      LDAP_TLS: "true"
      LDAP_TLS_CRT_FILENAME: "ldap.crt"
      LDAP_TLS_KEY_FILENAME: "ldap.key"
      LDAP_TLS_DH_PARAM_FILENAME: "dhparam.pem"
      LDAP_TLS_CA_CRT_FILENAME: "ca.crt"
      LDAP_TLS_ENFORCE: "false"
      LDAP_TLS_CIPHER_SUITE: "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC"
      LDAP_TLS_VERIFY_CLIENT: "never"
      LDAP_REPLICATION: "false"
      KEEP_EXISTING_CONFIG: "false"
      LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"
      LDAP_SSL_HELPER_PREFIX: "ldap"
      LDAP_SEED_INTERNAL_LDIF_PATH: "/assets/openldap/custom/ldif"
      LDAP_SEED_INTERNAL_SCHEMA_PATH: "/assets/openldap/custom/schema"
    command: --copy-service
    networks:
      - openldap

When I launch my container for the first time, I get no error, my custom schemas are copied correctly.

However, if I restart my container, I get this error :

**Copy from internal path /assets/openldap/custom/schema to /container/run/service/slapd/assets/config/bootstrap/schema/custom cp: cannot create directory '/container/run/service/slapd/assets/config/bootstrap/schema/custom': No such file or directory * ERROR | 2023-07-05 17:27:36 | /container/run/startup/slapd failed with status 1

I have the impression that on first startup the customs files are temporarily copied to the /container/run/service/slapd/assets/config/bootstrap/schema/custom

that this folder disappears once the ldap base has been configured

Then, if I restart the container, it will no longer find these folders.

miamilabs commented 1 year ago

Not sure why my comment got deleted twice..

Did you find any solution for this issue, i am fighting this since few days.

I did also try to use command: [ "--loglevel", "warning", "--copy-service" ] and still same issue.

openldap | Copy from internal path /assets/openldap/custom/schema to /container/run/service/slapd/assets/config/bootstrap/schema/custom openldap | cp: cannot create directory '/container/run/service/slapd/assets/config/bootstrap/schema/custom': No such file or directory openldap | *** ERROR | 2023-08-22 11:18:40 | /container/run/startup/slapd failed with status 1

ugoevola commented 1 year ago

no, unfortunately I haven't found anything conclusive...

If you find a solution tell me :(

jonathanmedd commented 1 year ago

We had the same issue. Got round it by setting the following:

LDAP_REMOVE_CONFIG_AFTER_SETUP=false

Also stopped mounting the schema and ldif files via volumes in docker compose, rather created our own docker image from osixia/openldap:1.5.0 and copying the schema and ldif files into that image.