LDAP
- Lightweight Directory Service
環境
- Ubuntu20.04(wsl2)
手順
- https://hub.docker.com/r/osixia/openldap/
- Openldap用のイメージがある
docker-comppose.yml
docker-compose.yml
version: '3'
services:
ldap-server:
image: osixia/openldap:latest
restart: always
container_name: ldap-host
environment:
LDAP_ORGANISATION: "vamp"
LDAP_DOMAIN: "vamdemic.black"
LDAP_ADMIN_PASSWORD: "password"
ports:
- "389:389"
networks:
- webnet
ldap-admin:
image: osixia/phpldapadmin:latest
restart: always
container_name: ldap-admin
environment:
PHPLDAPADMIN_LDAP_HOSTS: "ldap"
PHPLDAPADMIN_HTTPS: "false"
ports:
- "8080:80"
links:
- "ldap-server:ldap"
networks:
- webnet
networks:
webnet:
起動
sudo docker-compose up -d
起動確認
yuta@DESKTOP-PT34LID:/mnt/c/Users/yuta/openldap$ sudo docker-compose ps
Name Command State Ports
------------------------------------------------------------------------
ldap-admin /container/tool/run Up 443/tcp, 0.0.0.0:8080->80/tcp
ldap-host /container/tool/run Up 389/tcp, 636/tcp
PHPAdminへログイン
ユーザーを作る
まずOUを作る
ユーザーを作る
結果
ldapsarchで検索をかける
ldapsearch -x -D "CN=admin,DC=vamdemic,DC=black" -w 'password' -h "localhost" -p 389 -b "OU=vamp,DC=vamdemic,DC=black" "cn=yuta"
インストールされていない場合
sudo apt install ldap-utils
出力
# extended LDIF
#
# LDAPv3
# base <OU=vamp,DC=vamdemic,DC=black> with scope subtree
# filter: cn=yuta
# requesting: ALL
#
# yuta, vamp, vamdemic.black
dn: cn=yuta,ou=vamp,dc=vamdemic,dc=black
sn: yuta
cn:: IHl1dGE=
objectClass: inetOrgPerson
objectClass: top
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
参考