Sign inSign up

neocampus/openldap

By neocampus

Updated over 5 years ago

Customized osixia/openldap for anon binding and root to modifiy a user passwd

Image
0

266

neocampus/openldap repository overview

osixia/openldap revisited

Our container version of the famous osixia/openldap server allows:

  • anonymous binding,
  • root to change a student account password (for example)

Docker-compose file:

services:

  server:
    image: neocampus/openldap
    restart: unless-stopped
    # container_name implies only one instance
    container_name: ldap-server
    volumes:
      - /etc/localtime:/etc/localtime:ro
    network_mode: bridge
    # Port mapping between the localhost and the container
    ports:
      - 389:389
      - 636:636
    environment:
      - TZ=Europe/Paris
      - LDAP_ORGANISATION=<your org>
      - LDAP_DOMAIN=<your_www_hostname>
      #- LDAP_RFC2307BIS_SCHEMA=true    [mar.21] not supported by migrationtools
      #- LDAP_TLS=false
      - LDAP_TLS_VERIFY_CLIENT=never
      - LDAP_ADMIN_PASSWORD

  web:
    image: osixia/phpldapadmin
    restart: unless-stopped
    # container_name implies only one instance
    container_name: ldap-web
    volumes:
      - /etc/localtime:/etc/localtime:ro
    network_mode: bridge
    # Port mapping between the localhost and the container
    ports:
      - 8081:80
    environment:
      - TZ=Europe/Paris
      - PHPLDAPADMIN_LDAP_HOSTS=<your_www_hostname>
      - PHPLDAPADMIN_HTTPS=false
      - PHPLDAPADMIN_SERVER_PATH=/ldapadmin

To launch both services: LDAP_ADMIN_PASSWORD='<passwd>' docker-compose --verbose -f /root/ldap-compose.yml up -d

To gain access to your LDAP server through phpLDAPadmin, you need a nginx proxy setup:

    # ############
    # PhpLDAPadmin
    location ^~ /ldapadmin/ {

        if ( $https = "" ) { rewrite ^ https://$http_host$request_uri? break; }

        # Access rules only for specified sites
        include conf.d/access_rules;
        # Deny for all (except for those explicitly specified)
        deny all;

        access_log /var/log/nginx/phpldapadmin/access.log;
        error_log /var/log/nginx/phpldapadmin/error.log;

        proxy_pass http://127.0.0.1:8081/;  # warning '/' at the end set relative path from current location
    }

Hence, your LDAP server should ger reachable from https://<your_www_hostname>/ldapadmin

For initial filling of the LDAP server, we were using migrationtools

special usage: allowing root to change a user password

For this, you need to add a special user named: ldapadmin Then from root account you'll be able to passwd <user>

  • /etc/nslcd.conf
#
# for passwd change
rootpwmoddn uid=ldapadmin,ou=People,dc=xxxx,dc=xxxxx,dc=fr
rootpwmodpw <ldapadmin user account passwd>

Hope this helps

Tag summary

Content type

Image

Digest

Size

87.4 MB

Last updated

over 5 years ago

docker pull neocampus/openldap