Autenticació LDAP

De wikijoan
Salta a la navegació Salta a la cerca
Phpldapadmin.png
https://scytalelabs.com/setup-and-configure-openldap-using-docker-image-on-ubuntu-16-04/

$ mkdir openldap_prova
$ cd openldap_prova/

$ docker run -p 389:389 --name ldap-service --hostname ldap-service --env LDAP_ORGANISATION="ScytaleLabs" --env LDAP_DOMAIN="scytalelabs.com" \
--env LDAP_ADMIN_PASSWORD="adminPassword" --env LDAP_BASE_DN="dc=scytalelabs,dc=com" --volume /data/slapd/database:/var/lib/ldap \
--volume /data/slapd/config:/etc/ldap/slapd.d --detach osixia/openldap:1.3.0

$ docker run --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-service --detach osixia/phpldapadmin:0.9.0

$ docker inspect -f "{{ .NetworkSettings.IPAddress }}" phpldapadmin-service
172.17.0.3


https://172.17.0.3


docker run -p 389:389 --name ldap-service --hostname ldap-service --env LDAP_ORGANISATION="ScytaleLabs" --env LDAP_DOMAIN="scytalelabs.com" \
--env LDAP_ADMIN_PASSWORD="adminPassword" --env LDAP_BASE_DN="dc=scytalelabs,dc=com" --volume /data/slapd/database:/var/lib/ldap \
--volume /data/slapd/config:/etc/ldap/slapd.d --detach osixia/openldap:1.3.0

docker run --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-service --detach osixia/phpldapadmin:0.9.0

PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" phpldapadmin-service)
echo "Go to: https://$PHPLDAP_IP" 


Per crear un usuari:
You probably just want to create an end user account by selecting the 'Default' option and selecting the inetOrgPerson object class and click the "Proceed" button. On the next screen, you can complete the attribute template to create your entry.

---
$ docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                      PORTS                  NAMES
e6cf9de7ca04        osixia/phpldapadmin:0.9.0   "/container/tool/run"    5 days ago          Exited (0) 11 seconds ago                          phpldapadmin-service
4ff8564a1df8        osixia/openldap:1.3.0       "/container/tool/run"    5 days ago          Exited (0) 5 seconds ago                           ldap-service


docker start 4ff8564a1df8
docker start e6cf9de7ca04
docker inspect -f "{{ .NetworkSettings.IPAddress }}" phpldapadmin-service
https://172.17.0.3
login: cn=admin,dc=scytalelabs,dc=com
password: adminPassword



$ cd DAW_M08_DESPL/UF3/LDAP/

scripts PHP:
Connexió:
*http://localhost/M08/UF3/LDAP/autenticacio_ldap.php
*http://localhost/M08/UF3/LDAP/autenticacio_ldap2.php
*Consulta dels usuaria:
*http://localhost/M08/UF3/LDAP/ldap.examples-basic.php

scripts node:
$ node autenticacio_ldap
$ node autenticacio_ldapw


$ sudo apt-cache search php | grep ldap
php-ldap - LDAP module for PHP [default]



creat per Joan Quintana Compte, març 2022