LDAP
- Lightweight Directory Service
環境
- Ubuntu20.04(wsl2)
手順
- https://hub.docker.com/r/osixia/openldap/
- Openldap用のイメージがある
docker-comppose.yml
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<span class="na">version</span><span class="pi">:</span> <span class="s1">'</span><span class="s">3'</span> <span class="na">services</span><span class="pi">:</span> <span class="na">ldap-server</span><span class="pi">:</span> <span class="na">image</span><span class="pi">:</span> <span class="s">osixia/openldap:latest</span> <span class="na">restart</span><span class="pi">:</span> <span class="s">always</span> <span class="na">container_name</span><span class="pi">:</span> <span class="s">ldap-host</span> <span class="na">environment</span><span class="pi">:</span> <span class="na">LDAP_ORGANISATION</span><span class="pi">:</span> <span class="s2">"</span><span class="s">vamp"</span> <span class="na">LDAP_DOMAIN</span><span class="pi">:</span> <span class="s2">"</span><span class="s">vamdemic.black"</span> <span class="na">LDAP_ADMIN_PASSWORD</span><span class="pi">:</span> <span class="s2">"</span><span class="s">password"</span> <span class="na">ports</span><span class="pi">:</span> <span class="pi">-</span> <span class="s2">"</span><span class="s">389:389"</span> <span class="na">networks</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">webnet</span> <span class="na">ldap-admin</span><span class="pi">:</span> <span class="na">image</span><span class="pi">:</span> <span class="s">osixia/phpldapadmin:latest</span> <span class="na">restart</span><span class="pi">:</span> <span class="s">always</span> <span class="na">container_name</span><span class="pi">:</span> <span class="s">ldap-admin</span> <span class="na">environment</span><span class="pi">:</span> <span class="na">PHPLDAPADMIN_LDAP_HOSTS</span><span class="pi">:</span> <span class="s2">"</span><span class="s">ldap"</span> <span class="na">PHPLDAPADMIN_HTTPS</span><span class="pi">:</span> <span class="s2">"</span><span class="s">false"</span> <span class="na">ports</span><span class="pi">:</span> <span class="pi">-</span> <span class="s2">"</span><span class="s">8080:80"</span> <span class="na">links</span><span class="pi">:</span> <span class="pi">-</span> <span class="s2">"</span><span class="s">ldap-server:ldap"</span> <span class="na">networks</span><span class="pi">:</span> <span class="pi">-</span> <span class="s">webnet</span> <span class="na">networks</span><span class="pi">:</span> <span class="na">webnet</span><span class="pi">:</span> |
起動
1 |
sudo docker-compose up -d |
起動確認
1 2 3 4 5 |
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へログイン
- ユーザー名は
admin
cn=admin,dc=vamdemic,dc=black
ユーザーを作る
まずOUを作る
ユーザーを作る
結果
ldapsarchで検索をかける
1 2 |
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
出力
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 |