docker에서 OpenLDAP 사용

5726 단어 openldapDocker

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 로그인


  • 사용자 이름은 admin
  • cn=admin,dc=vamdemic,dc=black

  • 사용자 만들기


    일단 OU를 만들겠습니다.



    사용자 만들기

  • ou 선택create newchild entry
  • 선택
  • kolab user entry
  • Require를 채워주시면 됩니다
  • .

    결과




    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
    

    참고 자료

    좋은 웹페이지 즐겨찾기