PHP教程

Docker搭建OpenLDAP+phpLDAPadmin统一用户认证

本文主要是介绍Docker搭建OpenLDAP+phpLDAPadmin统一用户认证,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Docker 搭建 LDAP

docker run -p 389:389 -p 636:636 --name my-openldap-container --env LDAP_ORGANISATION="ihopeit" --env LDAP_DOMAIN="ihopeit.com" --env LDAP_ADMIN_PASSWORD="admin_passwd_4_ldap" --detach osixia/openldap:1.4.0

Docker 搭建 phpLDAPadmin

docker run -p 80:80 -p 443:443 --name phpldapadmin-service --hostname phpldapadmin-service --link my-openldap-container --env PHPLDAPADMIN_LDAP_HOSTS=my-openldap-container --detach osixia/phpldapadmin:0.9.0

访问

https://ip

在这里插入图片描述

查询账户

docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b dc=ihopeit,dc=com -D "cn=admin,dc=ihopeit,dc=com" -w admin_passwd_4_ldap
[root@localhost ~]# docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b dc=ihopeit,dc=com -D "cn=admin,dc=ihopeit,dc=com" -w admin_passwd_4_ldap
# extended LDIF
#
# LDAPv3
# base <dc=ihopeit,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# ihopeit.com
dn: dc=ihopeit,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: ihopeit
dc: ihopeit

# admin, ihopeit.com
dn: cn=admin,dc=ihopeit,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9VXFlYkNzZUhDSmY3cW9Jbm9ISHFiVDFhQ3VxU2g0VGY=

# ducheng, admin, ihopeit.com
dn: uid=ducheng,cn=admin,dc=ihopeit,dc=com
objectClass: posixAccount
objectClass: top
objectClass: inetOrgPerson
gidNumber: 0
givenName: du
sn: cheng
displayName: ducheng
uid: ducheng
homeDirectory: cn=admin
cn: ducheng
uidNumber: 8528

# search result
search: 2
result: 0 Success

# numResponses: 4
# numEntries: 3

登录账户

DN: cn=admin,dc=ihopeit,dc=com
PASSWORD: admin_passwd_4_ldap

OpenLDAP文章

推荐文章

这篇关于Docker搭建OpenLDAP+phpLDAPadmin统一用户认证的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!