mth12
mth12

Reputation: 15

How to enable Hash Passwords in OpenLDAP With Docker

Can you help me, I need to enable password hashing at openLDAP level I need to have situation where clients send password in PLAIN_TEXT and openLDAP store this as {SSHA}

I would like to enable this: http://xacmlinfo.org/2015/06/25/enable-hash-passwords-in-openldap/

but I do not know how to do this during container configuration. I need to perform these operations via Docker because I want any user to be able to start my project simply by running docker-compose up through the .NET Web API. Therefore, I cannot use command-line operations directly.

this is my docker-compose.yml

networks:
my_network:
driver: bridge

services:
openldap:
image: osixia/openldap:latest
container_name: openldap
environment:
LDAP_BASE_DN: "dc=example,dc=com"
LDAP_ORGANISATION: "Example Organization"
LDAP_DOMAIN: "example.com"
LDAP_ADMIN_PASSWORD: "admin"
LDAP_TLS: "false"
LDAP_PASSWORD_HASH: "SSHA"
volumes:
- ./ldap/init.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-init.ldif
- ./ldap/ppolicy.ldif:/etc/ldap/ppolicy.ldif
- ./ldap/ppolicy_overlay.ldif:/etc/ldap/ppolicy_overlay.ldif
- openldap-data:/var/lib/ldap
- openldap-config:/etc/ldap/slapd.d
networks:
- my_network
ports:
- "389:389"
command: --copy-service
restart: unless-stopped
phpldapadmin:
image: osixia/phpldapadmin:latest
container_name: phpldapadmin
environment:
PHPLDAPADMIN_LDAP_HOSTS: openldap
PHPLDAPADMIN_HTTPS: "false" # deactivate HTTPS
networks:
- my_network
ports:
- "8081:80"
restart: unless-stopped
depends_on:
- openldap

volumes:
openldap-data:
driver: local
openldap-config:
driver: local

and this is my Dockerfile

FROM osixia/openldap:latest

COPY ./ldap/ppolicy.ldif /etc/ldap/ppolicy.ldif
COPY ./ldap/ppolicy_overlay.ldif /etc/ldap/ppolicy_overlay.ldif
COPY ./ldap/init.ldif /container/service/slapd/assets/config/bootstrap/ldif/custom/50-init.ldif

CMD ["sh", "-c", "sleep 5 && ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/ppolicy.ldif && ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/ppolicy_overlay.ldif && ldapadd -Y EXTERNAL -H ldapi:/// -f /container/service/slapd/assets/config/bootstrap/ldif/custom/50-init.ldif && /container/tool/run.sh"]

and my ldif docs; ppolicy_overlay.ldif

   objectClass: olcOverlayConfig 
   objectClass: olcPPolicyConfig
   olcOverlay: {2}ppolicy 
   olcPPolicyHashCleartext: TRUE

ppolicy.ldif

   cn=config 
   changetype: modify 
   add: olcModuleLoad 
   olcModuleLoad: ppolicy

when i open my phpldapadmin i can't see SSHA it looks like this;

enter image description here how can i fix this! Please help!!

Upvotes: 0

Views: 19

Answers (0)

Related Questions