2022년/Developement

[Network] LDAP Ubuntu <-> Windows LDAP Manager

위지원 2022. 1. 3. 14:33

LDAP는 데이터를 중앙관리 할 때 유용하다. 권한관리라던지, 사용자 정보 관리 등..

 

openLDAP는 LDAP를 구현하는 오픈소스 중 자주 쓰이는 오픈소스라고 한다. 이를 기반으로 간단하게 구현해보자.

 

OpenLDAP, Main Page

The suite includes: lloadd - stand-alone LDAP Load Balancer Daemon (server or slapd module) slapd - stand-alone LDAP daemon (server) libraries implementing the LDAP protocol, and utilities, tools, and sample clients. Also available from the OpenLDAP Projec

www.openldap.org

 

~$ sudo apt install slapd ldap-utils
~$ service --status-all

# 서비스 확인
~$ sudo service slapd start
~$ sudo vi ldaprootpasswd.ldif

# 방화벽 요청 허용
~$ sudo ufw allow ldap

# 패스워드 생성
~$ slappasswd

# 아래 내용 작성
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}PASSWORD_CREATED

~$ sudo ldapadd -Y EXTERNAL -H ldapi:/// -f ldaprootpasswd.ldif

# 포트 오픈 확인 (389 열리면된다)
~$ netstat -tnl

 

http://www.ldapadmin.org/download/index.html 에서 WebUI 다운로드

 

1. 위 서버의 주소를 입력

2. Fetch DNs하면 자동으로 가져옴

3. UserName에 cn=admin을 적어준뒤 2번에서 가져온 값을 콤마(,)와 함께 작성 

 

여기까지하면 UI와 LDAP가 연결이 된다. 

 

추가로 DB CONFIG 파일은 아래에 존재한다.

weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ ll
total 20
drwxr-xr-x 2 root root 4096 Jan  4 09:35 ./
drwxr-xr-x 3 root root 4096 Jan  4 09:33 ../
-rw-r--r-- 1 root root 3080 Apr  8  2021 DB_CONFIG
-rw-r--r-- 1 root root 1293 Apr  8  2021 slapd.backup
-rw-r--r-- 1 root root 1773 Apr  8  2021 slapd.conf.gz

weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ ls /var/lib/ldap/DB_CONFIG/
weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ tail DB_CONFIG
# Sven Hartge reported that he had to set this value incredibly high
# to get slapd running at all. See http://bugs.debian.org/303057
# for more information.

# Number of objects that can be locked at the same time.
set_lk_max_objects      5000
# Number of locks (both requested and granted)
set_lk_max_locks        5000
# Number of lockers
set_lk_max_lockers      5000

weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ sudo cp DB_CONFIG /var/lib/ldap/DB_CONFIG/
[sudo] password for weejw:
weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ sudo chown -R weejw:weejw /var/lib/ldap/DB_CONFIG/
weejw@DESKTOP-LQRSEG1:/usr/share/doc/slapd/examples$ sudo service slapd restart
 * Stopping OpenLDAP slapd                                                                                       [ OK ]
 * Starting OpenLDAP slapd

 

 

 

 

REFERENCES

https://www.tecmint.com/install-openldap-server-for-centralized-authentication/

https://smoh.tistory.com/285

https://ko.linux-console.net/?p=122 

https://www.dgkim.net/wordpress/2010/06/13/%ED%8E%B8%EB%A6%AC%ED%95%9C-ldap-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8/

https://blog.hkwon.me/use-openldap-part1/