티스토리 뷰

반응형

안녕하세요. 09LABS입니다.

오늘 포스팅할 주제는 LDAP 인증서버 구축하는 방법입니다.
사실 LDAP 인증서버를 저는 여태 써본적이 없는데 회사에서 쓰게 되어 알아보다가 여러 자료를 찾아봤지만
언제나 그렇듯 '참 쉽죠? 이렇게 하면 됩니다' 라고 하지만 절대 안되더라구요.
짜증나서 제대로 되는 방법을 정리해서 올려드립니다.

우선 LDAP 서버를 설치하는 순서는 다음과 같습니다.
OpenLDAP 설치 -> 사용자 추가 -> phpldapadmin 설치
바로 본론으로 들어가보죠.

먼저 우분투 패키지 업데이트후 OpenLDAP을 설치 해줍니다.

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
33
34
35
36
37
38
39
40
41
42
43
root@dlp:~# apt-get update
root@dlp:~# apt-get -y install slapd ldap-utils
# set LDAP admin password during installation like follows
 +-------------------------------------------------| Configuring slapd |--+
 | Please enter the password for the admin entry in your LDAP directory.  |
 |                                                                        |
 | Administrator password:                                                |
 |                                                                        |
 | ********______________________________________________________________ |
 |                                                                        |
 |                                 <Ok>                                   |
 |                                                                        |
 +------------------------------------------------------------------------+
 
# confirm settings
root@dlp:~# slapcat
dn: dc=srv,dc=world
objectClass: top
objectClass: dcObject
objectClass: organization
o: srv.world
dc: srv
structuralObjectClass: organization
entryUUID: 10b94454-b747-1035-8c5c-7fa90ef080bf
creatorsName: cn=admin,dc=srv,dc=world
createTimestamp: 20160526043549Z
entryCSN: 20160526043549.180234Z#000000#000#000000
modifiersName: cn=admin,dc=srv,dc=world
modifyTimestamp: 20160526043549Z
 
dn: cn=admin,dc=srv,dc=world
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9Y2w1NklOTW9VaytSVnNUMUxlME9ZUlJDZHFaN1pVSEs=
structuralObjectClass: organizationalRole
entryUUID: 10bf9dea-b747-1035-8c5d-7fa90ef080bf
creatorsName: cn=admin,dc=srv,dc=world
createTimestamp: 20160526043549Z
entryCSN: 20160526043549.221895Z#000000#000#000000
modifiersName: cn=admin,dc=srv,dc=world
modifyTimestamp: 20160526043549Z
cs

OpenLDAP 패키지 설치 시 비밀번호 입력하는 부분이 나옵니다.
비밀번호 입력 후 엔터를 누르면 설치가 진행됩니다.
그렇지만 언제나 그렇든 우리는 실패를 하죠.
slapcat을 쳐도 위와 같이 표시가 되지 않을 겁니다.
저는 도메인을 srv.world로 설정했지만 아마 여러분은 dc=example, dc=com으로 되어있을겁니다.

터미널에 아래와 같이 입력을 합니다.

1
root@dlp:~# dpkg-reconfigure slapd
cs
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
Package configuration
 
 
 
 
   ┌─────────────────────────────────┤ Configuring slapd ├─────────────────────────────────┐
   │                                                                                       │ 
   │ If you enable this option, no initial configuration or database will be created for   │ 
   │ you.                                                                                  │ 
   │                                                                                       │ 
   │ Omit OpenLDAP server configuration?                                                   │ 
   │                                                                                       │ 
   │                        <Yes>                           <No>                           │ 
   │                                                                                       │ 
   └───────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                             
 
 
 
 
cs

위와 같은 화면이 뜨면 No를 선택합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Package configuration
 
 
 
 ┌──────────────────────────────────┤ Configuring slapd ├───────────────────────────────────┐
 │ The DNS domain name is used to construct the base DN of the LDAP directory. For          │ 
 │ example, 'foo.example.org' will create the directory with 'dc=foo, dc=example, dc=org'   │ 
 │ as base DN.                                                                              │ 
 │                                                                                          │ 
 │ DNS domain name:                                                                         │ 
 │                                                                                          │ 
 │ srv.world ______________________________________________________________________________ │ 
 │                                                                                          │ 
 │                                          <Ok>                                            │ 
 │                                                                                          │ 
 └──────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                              
 
 
 
cs

사용할 도메인 주소를 입력합니다. 저는 srv.world라고 적었습니다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Package configuration
 
 
 
 
 ┌──────────────────────────────────┤ Configuring slapd ├───────────────────────────────────┐
 │ Please enter the name of the organization to use in the base DN of your LDAP directory.  │ 
 │                                                                                          │ 
 │ Organization name:                                                                       │ 
 │                                                                                          │ 
 │ testOrg_________________________________________________________________________________ │
 │                                                                                          │ 
 │                                          <Ok>                                            │ 
 │                                                                                          │ 
 └──────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                              
cs

Organization name은 임의로 입력해줍니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Package configuration
 
 
 
  ┌──────────────────────────────────┤ Configuring slapd ├──────────────────────────────────┐
  │ Please enter the admin password for your LDAP directory again to verify that you have   │ 
  │ typed it correctly.                                                                     │ 
  │                                                                                         │ 
  │ Confirm password:                                                                       │ 
  │                                                                                         │ 
  │ *********______________________________________________________________________________ │ 
  │                                                                                         │ 
  │                                         <Ok>                                            │ 
  │                                                                                         │ 
  └─────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                              
 
 
cs

비밀번호를 설정합니다.

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
Package configuration
 
 
 
 
 ┌──────────────────────────────────┤ Configuring slapd ├───────────────────────────────────┐
 │ HDB and BDB use similar storage formats, but HDB adds support for subtree renames. Both  │ 
 │ support the same configuration options.                                                  │ 
 │                                                                                          │ 
 │ The MDB backend is recommended. MDB uses a new storage format and requires less          │ 
 │ configuration than BDB or HDB.                                                           │ 
 │                                                                                          │ 
 │ In any case, you should review the resulting database configuration for your needs. See  │ 
 │ /usr/share/doc/slapd/README.Debian.gz for more details.                                  │ 
 │                                                                                          │ 
 │ Database backend to use:                                                                 │ 
 │                                                                                          │ 
 │                                           BDB                                            │ 
 │                                           HDB                                            │ 
 │                                           MDB                                            │ 
 │                                                                                          │ 
 │                                                                                          │ 
 │                                          <Ok>                                            │ 
 │                                                                                          │ 
 └──────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                              
 
 
cs

위의 화면에선 MDB를 선택합니다.
그 이후 나오는 화면에선 그냥 계-속 엔터누르시면 OpenLDAP 설정이 완료됩니다.
다시 slapcat을 입력하시면 원하는 대로 수정되어 출력이 될 것입니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
root@dlp:~# vi base.ldif
# create new
# change to your own suffix for the field 'dc=srv,dc=world'
dn: ou=people,dc=srv,dc=world
objectClass: organizationalUnit
ou: people
 
dn: ou=groups,dc=srv,dc=world
objectClass: organizationalUnit
ou: groups 
 
root@dlp:~# ldapadd -x -D cn=admin,dc=srv,dc=world -W -f base.ldif
Enter LDAP Password:     # LDAP admin password (set in installation of openldap)
adding new entry "ou=people,dc=srv,dc=world"
 
adding new entry "ou=groups,dc=srv,dc=world"
cs

그 다음 basedn을 추가할 것입니다.
base.ldif에서 수정해야할 부분은 dc=srv,dc=world입니다.
본인이 사용하는 도메인이 아니라 위 예제를 그냥 긁어다가 붙여넣기 하면 아예 작동되지 않습니다.
만약 도메인이 ldap.test.localdomain이라면 dc=ldap,dc=test,dc=localdomain으로 수정하시면 됩니다.
ldapadd 명령어 입력 후 설정하신 비밀번호를 입력하면 basedn 추가가 완료됩니다.

여기까지 OpenLDAP 설치에 대해 알아봤습니다.
다음 강의는  ldapadd명령어를 통해 사용자를 추가하는 방법에 대해 알아보겠습니다.

출처 : server-world.info/en/note?os=Ubuntu_16.04&p=openldap&f=1

 

반응형

'Linux > Ubuntu' 카테고리의 다른 글

1. 네트워크 접속상태 확인방법  (0) 2018.01.01
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
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
글 보관함