database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
ㆍLDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
LDAP Q&A 2154 게시물 읽기
No. 2154
LDAP에서 SASL Digest-MD5 로...
작성자
to
작성일
2005-03-18 20:29ⓒ
2005-03-18 20:42ⓜ
조회수
10,261

LDAP Server에 Client를 SASL Digest-MD5 Mechanism으로 할려고 하는데요.

( Digest-MD5 라함은 RFC2617의 HTTP Digest Authentication mechanism을 LDAP에서 사용할 수

있도록 한것입니다. 그 정의는 RFC2831에 있구요, 혹시 그냥 password를 md5로 암호화해서 전송한다고 답하시는 분 계실까봐 조바심에.... 죄송)

 

OpenLDAP에서 Server설정을 어떻게 해야하나요? 혹시 아시는 분 계세요?

그냥 Client에서 BindRequest를 보낼때 sasl mechanism field를 'Digest-MD5'라고 명시만 하면

OpenLDAP에서 알아서 하는 건가요? ( server가 'Digest-MD5'를 포함한 BindRequest를 보내면

BindResponse에 'digest-challenge header'를 작성해서 보내나요?)

그리고 이때 user에 대한 LDIF를 어떻게 적어 놔야 되는건지도 ...

부탁드립니다.

 

이 글에 대한 댓글이 총 3건 있습니다.

아래 light로 질문 하시분 맞죠? 아직도 저는 SASL이 헤깔리는데

한번 설명해 주세요. 잘 아시는거 같으시네요. 그런데 SASL을 이용하여 LDAP을 연동해 보셨나요? OpenLDAP방법을 알게 되면 한수 알려 주십시요

 

RFC 2222에서 각 Protocol별 설명이 있습니다. 그정의와 함께 ....

 

The SunONE Directory Server, v5 supports the Digest-MD5 authentication mechanism for users that have clear-text passwords. You must set the password encryption mode before you create the user. If you have already created the user, delete it and recreate it. To set the password encryption mode using the Administration Console, select the Configuration tab and the Data node. In the Passwords pane, select the "No encryption (CLEAR)" option for "Password encryption." The server accepts simple user names (that is, the value of the "uid" attribute for entries that have one) and the "dn:" format of user names. See the server's documentation for detailed information.

 

자바예제

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");

// Authenticate as C. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "DIGEST-MD5");
env.put(Context.SECURITY_PRINCIPAL, "dn:cn=C. User, ou=NewHires, o=JNDITutorial");
env.put(Context.SECURITY_CREDENTIALS, "mysecret");

// Create the initial context
DirContext ctx = new InitialDirContext(env);

// ... do something useful with ctx

 

제가 이해하기로는 사용자 ID와 PW를 입력하면 PW를 Digest(방법은 MD5)로 하여 변환하여 LDAP서버는 이를 받아서 기존에 PW를 같은 방식으로 암호화 하고 이를 비교하여 같으면 인증을 해주는것으로 알고 있습니다. 따라서 서버 측에서 같은 방식으로 Digest하려면 서버에 저장되어 있는 값이 Clear Text이어야 할 것 같습니다. 따라서 openLDAP도 마찬가지로 사용자 PW저장방식을 CLEAR TEXT로 하고 SASL 매커니즘을 Digest-MD5로 하시면 될것 같습니다.

송상준(sjsong)님이 2005-03-19 00:04에 작성한 댓글입니다.
이 댓글은 2005-03-19 01:01에 마지막으로 수정되었습니다.

저도 이 사이트에서 님께서 예를 들어주신 java코드보고 헷깔렸는데요

LDAP v3가 나오면서 인증 mechanism이 많이 추가 됐죠.. 그래서

RFC2829에 authentication methods for LDAP이 기술되어있는데

여기서 Digest-Authentication(Digest-MD5)이라는 인증 methods가 정의되어있습니다. Digest-Authentication이라함은 RFC2617 HTTP Digest Authentication과 같은 방식이구요. 거기에 LDAP에서 인증 methods로 digest-authentication을 사용할려면 bindRequest를 어떻게 만들고 bindResponse를 어떻게 하고하는게 나와있어요. 그리고 credentials field에는 어떤값이 있어야되는지 등등은 RFC2831 Using Digest Authentication as a SASL Mechanism에 정의되있구요. 또 이때 sasl_mechanism field에 'Digest-MD5'라고 적어라고 되어 있습니다.

그래서 위의 자바코드는 그냥 패스워드를 MD5해싱값만 들어간형태라 틀린거 같기도 하고...(이런걸 PLAIN text mechanism이라고 알고있습니다. 즉 그냥 clear text가 아닌 정해진 암호방식을 말하죠)

그리고 digest authentication mechanism은 bindrequest/response한번이 아니라 총 두번의 bindRequest/bindResponse가 필요합니다.

 

저도 웹서버에서 user를 인증하는 방식인 RFC2617을 몰랐을땐

digest authentication이 그냥 패스워드를 MD5해싱해서 전송하는 줄 알았는데 그건 아니더라구요...

저도 LDAP 본지 얼마 되지 않아서.... 많이 헷갈리네요...

그리고 OpenLDAP에서 저 방식이 된다고 명확히 나온건 못봤는데 RFC가 2000년에 나온거니까 되지않을까 생각하고 있습니다. 실제로 해보진 않았구요^^

OpenLDAP에서 SASL 지원하면 저 방식은 꼭 되어야 정상이라 생각되는데....???

 

-----------------------------------------------------

참.. 글쓰는 김에 저도 질문이 있는데요

OpenLDAP 이나 SunOne에서 이런게 되는지 궁금합니다.

클라이언트의 인증할때 LDAP Connection을 하나만 맺어놓고 그 Connection을 이용해서 클라이언트들의 인증을 하려고 합니다.

예를 들어 (OpenLDAP API)

ldap_init() // 서버 connection open

ldap_bind(user A) // user A 인증요청

ldap_bind(user B) // user B 인증요청

      :

ldap_unbind()

이런식이죠...

이런게 가능하죠?

 

가능하다면

ldap_init()으로 connect한 TCP Channel이 ldap_bind(user B)를 할때 끊겼으면 어떻게 되죠?

Connection이 끊겼다는 event를 띄워주거나 그런게 있나요?

하나의 connection handle로 계속 bind요청을 해야 한다면

connection handle이 유효한지를 체크해야되는데 어떻게 체크해야될지....

ldap 라이브러리에서 그런걸 체크해서 알려주는 먼가가 있는지를 알고 싶습니다.

 

아시는분 꼭좀 대답해주세요...

말을 넘 어렵게 한건 아닌가싶네요.... 제가 정리가 잘안된 관계로..


 

light님이 2005-03-25 03:11에 작성한 댓글입니다. Edit

6.1. Digest authentication

   An LDAP client MAY determine whether the server supports this
   mechanism by performing a search request on the root DSE, requesting
   the supportedSASLMechanisms attribute, and checking whether the
   string "DIGEST-MD5" is present as a value of this attribute.

   In the first stage of authentication, when the client is performing
   an "initial authentication" as defined in section 2.1 of [4], the
   client sends a bind request in which the version number is 3, the
   authentication choice is sasl, the sasl mechanism name is "DIGEST-
   MD5", and the credentials are absent.  The client then waits for a
   response from the server to this request.

   The server will respond with a bind response in which the resultCode
   is saslBindInProgress, and the serverSaslCreds field is present.  The
   contents of this field is a string defined by "digest-challenge" in
   section 2.1.1 of [4].  The server SHOULD include a realm indication
   and MUST indicate support for UTF-8.

   The client will send a bind request with a distinct message id, in
   which the version number is 3, the authentication choice is sasl, the
   sasl mechanism name is "DIGEST-MD5", and the credentials contain the
   string defined by "digest-response" in section 2.1.2 of [4].  The
   serv-type is "ldap".

   The server will respond with a bind response in which the resultCode
   is either success, or an error indication.  If the authentication is
   successful and the server does not support subsequent authentication,
   then the credentials field is absent.  If the authentication is
   successful and the server supports subsequent authentication, then
   the credentials field contains the string defined by "response-auth"
   in section 2.1.3 of [4].   Support for subsequent authentication is
   OPTIONAL in clients and servers.

 

전 이런 분들이 많았으면 합니다. 저도 더 책도 찾아보고 그럴수 있게요. 감사합니다.

 

light님의 말대로 한번 RFC문서를 읽어보았습니다. 그리고 SunONE의 SASL에 관련된 모듈을 한번 보았습니다. OpenLDAP도 같으리라 생각됩니다.

 

두번 bind하는거는 맞는거 같습니다. 처음에는 ROOTDSE에 SASL의 어떤 방식을 지원하는지 확인하는 메시지를 보내고 받고 해당 매커니즘이 있는지 확인하고 있으면 ID와 PW를 보내는 방식으로 이해 했습니다. 맞을까? 일단 SunONE의 SASL의 모듈을 본 내용과 위 내용을 더해서 제가 이해한 사항입니다.

 

아 그리고 세션이 끊겼을때 아마 REBIND라는 함수 있는데. 이는 netscae LDAP SDK에 있는데 이걸 사요하면 끊기면 다시 Bind하게 하는 함수입니다.

송상준(sjsong)님이 2005-03-25 09:52에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
2157asp로 netscape LDAP 연결 문제 [3]
Harry
2005-04-02
8239
2156UNIX와 맥 그리고 윈도우의 통한 인증 및 권한 제어가 가능할지 [4]
구기현
2005-04-01
9130
2155송상준님 토요일 교육내용중에 질문있습니다. [5]
윤성중
2005-03-28
7703
2154LDAP에서 SASL Digest-MD5 로... [3]
to
2005-03-18
10261
2153LINUX package [1]
초보
2005-03-18
7839
2152OpenLDAP을 뒤져보다가 [1]
송상준
2005-03-18
8164
2151LDAP 세미나 및 인원 확정 되었습니다. [5]
송상준
2005-03-17
9405
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.047초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다