Unix/유닉스와 디렉토리

AD에서 LDAPS를 쓰자.

ForceCore 2008. 12. 29. 18:54
adLDAP과 연계를 하려고.
adLDAP를 SSL에서 해야 진정한 모든 기능이 enable된다.

생각하기 싫다 -_- 쉬운 방법으로 가자.
http://blogs.technet.com/jrosen/archive/2006/08/21/448286.aspx
이런 시스템 구축보다는, ldaps로 뭘 할건지가 중요하기 때문에 -_- 이런 것에 비중을 두지는 않겠다.

SSL and Active Directory (LDAPS)

 I needed to setup secure LDAP for my lab and was not sure how to do it.  I did not want to purchase a certificate, and I did not want to have to install a Windows CA either.

I found a self SSL certificate generator in the IIS 6.0 Resource Kit called selfSSL.

With selfSSL I was able to create a self-signed certificate.

1) run selfSSL.  Make sure the CN=fully qualified hostname (i.e. mydc.putyourdomainhere.com).  Also the default validity period is low, so I used a year.  I took defaults for the rest of the settings.

2) start the certificates MMC (for the computer) and copy the personal certificate to the trusted root certificate store.

3) start the Internet Service Manager Snap-ip and remove the SSL from the default website (optional)

4) reboot


해보자...
selfssl에서 parameter인 CN을 어떻게 해야 되지;;
연결이 되는지 안 되는지는 일단 ldp로 체크 가능하다.
(시작 -> 실행 -> LDP 로 ...)
성공할 때까지 반복해야 한다.
우선은 636포트 말고, 그냥 389포트로 ssl없이 connect해봐서 connect된 후의 결과가 어떻게 되는지부터 확인하는 것이 좋다.

> selfssl.exe /N:CN=PRIME.sohee.xxx.ac.kr /K:1024 /V:3650 /S:1 /P:443 /T
이런 명령을 수행한 뒤에 LDP로 connect가 성공했다.
왜 CN이 저렇게 되었는지는
http://forcecore.tistory.com/notice/828
를 참고하라.
뒤의 /T parameter를 빼면, trusted certificate에 추가되지 않아서 ldp가 실패할 것이다 -_-;; 그 외 CN이 틀려도 접속이 실패한다.

이제 LDAPS 연결이 되는 것은 알았으니...
apache에서도 ldaps를 사용할 수 있어야 하겠다.

우선은 해당 apache 서버가 있을 서버에서 command line으로 뭐가 잘 되는지 체크.
$ ldapsearch -H "ldaps://sohee.xxx.ac.kr" -b "" -s base -Omaxssf=0
이렇게 했을 때 에러가 나면 다 때려잡아야 한다.
앗차... ldap.conf는 이미 잘 설정되어 있다고 가정한다.
필자의 경우는 -_- CentOS의 active directory 물리기를 따라해서 wizard가 ldap.conf를 잘 설정해 주었다.
그거 해본지도 꽤 오래 되었군... ㄷㄷ

매뉴얼로 부족하군... 구글에 adldap ssl를 검색했다.
http://forums.kayako.com/f56/ad-ldap-via-ssl-8441/
이런게 걸렸음.

우선은
ldap_sasl_interactive_bind_s: Can't contact LDAP server (-1)
        additional info: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed


이런 에러가 나온다. 왜냐... self signed certificate라서 거부반응을 일으키는 것이다.
TLS_REQCERT never
를 ldap.conf에 추가하면 일단 그 단계는 넘어가게 된다.
SASL/GSSAPI authentication started
ldap_sasl_interactive_bind_s: Local error (-2)
        additional info: SASL(-1): generic failure: GSSAPI Error: Miscellaneous failure (Unknown code krb5 195)

이런 에러로 바뀌게 된다.
물론 제일 아래의 Unknown code krb5 195를 구글 검색한다 -_-;;
후후...

왜 안 되는지 봤더니...
그냥 local ID로 로그인 해서 저 명령어를 수행했기 때문이다 -_-;;
이미 AD에 로그인 되는 ID로 로그인 해서 저 명령어를 수행하니 이상 없이 잘 된다.
혹시 안 되면 kinit을 한 뒤에 시도해보라.

여기까지 되니 필자는 adLDAP로 ssl을 enable할 수 있었다 :D