docker 搭建ldap

$ docker run -itd --name ldap-test01 -p 40000:389 -p 40001:80 ubuntu:16.04 /bin/bash

$ docker cp sources.list ldap-test01:/etc/apt/sources.list

apt-get update

apt-get install slapd ldap-utils -y # 安裝相關的包

設置密碼

dpkg-reconfigure slapd #配置ldap

Omit OpenLDAP server configuration? [yes/no] # no

DNS domain name: baidu.com

Organization name: baidu

設置密碼

Database backend to use: 3

Do you want the database to be removed when slapd is purged? [yes/no] yes

Allow LDAPv2 protocol? [yes/no] yes

/etc/init.d/slapd start

cat /etc/ldap/slapd.d/cn\=config/olcDatabase\={1}mdb.ldif # 相關的內容


AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.

CRC32 60751870

dn: olcDatabase={1}mdb
objectClass: olcDatabaseConfig
objectClass: olcMdbConfig
olcDatabase: {1}mdb
olcDbDirectory: /var/lib/ldap
olcSuffix: dc=baidu,dc=com
olcAccess: {0}to attrs=userPassword by self write by anonymous auth by non
e
olcAccess: {1}to attrs=shadowLastChange by self write by
read
olcAccess: {2}to by read
olcLastMod: TRUE
olcRootDN: cn=admin,dc=baidu,dc=com
olcRootPW:: e1NTSEF9MG5YT2lrRmRyOURicEhxeEl0MU5paWlCaC8xTU1UQXo=
olcDbCheckpoint: 512 30
olcDbIndex: objectClass eq
olcDbIndex: cn,uid eq
olcDbIndex: uidNumber,gidNumber eq
olcDbIndex: member,memberUid eq
olcDbMaxSize: 1073741824
structuralObjectClass: olcMdbConfig
entryUUID: 003cfcec-cac2-1038-96ab-db71de40cffc
creatorsName: cn=config
createTimestamp: 20190222074834Z
entryCSN: 20190222074834.725975Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20190222074834Z

ldapwhoami -H ldap:// -x # 測試是否正常

docker 搭建ldap

第2步 - 安裝和配置phpLDAPadmin Web界面

apt-get install phpldapadmin -y

apt-get install vim -y

vim /etc/phpldapadmin/config.php # 修改相關內容


$servers->setValue('server','base',array('dc=baidu,dc=com'));

$config->custom->appearance['hide_template_warning'] = true;

/etc/init.d/apache2 restart

http://127.0.0.1:40001/phpldapadmin # 打開網址

cn=admin,dc=baidu,dc=com # 賬號

docker 搭建ldap

登錄成功
docker 搭建ldap

創建OU
docker 搭建ldap

docker 搭建ldap

創建名字爲users
docker 搭建ldap

再創建UID
選擇defualt #
查找 inetOrgPerson

docker 搭建ldap

選擇 rdn
必填寫
cn sn Password User Name

docker 搭建ldap

點外賣的小夥伴可以能進羣
docker 搭建ldap

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章