Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dockerでOpenLDAPを使う

Posted at

LDAP

  • Lightweight Directory Service

環境

  • Ubuntu20.04(wsl2)

手順

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へログイン

image.png

  • ユーザー名はadmin
  • cn=admin,dc=vamdemic,dc=black
    image.png

image.png

ユーザーを作る

まずOUを作る

image.png

ユーザーを作る

  • ouを選んでcreate new child entry

  • kolab user entryを選ぶ
    image.png

  • Requireの箇所を埋めれば作れる

image.png

結果

image.png

image.png

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

参考

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Advent Calendar is held!

Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅

Some calendars come with gifts and some gifts are drawn from all calendars 👀

Please tie the article to your calendar and let's enjoy Christmas together!

5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?