manywaypark's Blog
개발, 검색, 함수

OpenLDAP(slapd)의 설치 및 설정에 관해서 간단히 알아본다.
언제나 그렇듯 Ubuntu (12.04.2 LTS) 기준이다.
Ubutu 10.04부터 OpenLDAP 기본 패키지 설치는 RTC(RunTime Configuration)를 사용한다.
(예전에 내가 알던 그 slapd.conf 방식이 아닌 것이다. 한참 삽질한 후에 알았다. Orz)
ldap-utils에 포함된 도구를 사용해서 그냥 일반적인 레코드 수정하듯이 cn=config의 엔트리를 조작하면 된다. 이름대로 변경하면 반영된다고 한다.

준비:
먼저 테스트 접속을 위해 Apache Directory Studio(이하 ADS)를 다운 받아 설치한다.

설치:

$ sudo apt-get install slapd ldap-utils

설치 과정에서는 admin password만 입력하면 된다.

설정: (dc 등이 제대로 설정되지 않을 때만 필요. hostname 설정이 제대로 되어 있다면 설치 과정에서 dc도 제대로 설정되었을 것이다.)

$ sudo dpkg-reconfigure slapd

주의 깊게 설명을 읽고 답변을 선택하거나 값을 입력한다 (내 경우에는 dc를 입력하는 것 말고는 별달리 할 것이 없다). DB 지우는 것을 물어보는 부분이 조금은 혼란을 일으키지만, Yes로 답하면 된다 (방금 설치했는데 뭘...)

여기서부터 편의 상 dc설정을 "dc=foo,dc=bar"로 가정한다.
확인하려면 대충 이렇게 해보자;

$ sudo ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config | grep cn=admin


시험:
ADS에서 새로운 연결을 만든다.
왼쪽 아래에 보면 Connections pane이 있고 LDAP+ 아이콘이 있다. 클릭!
Network Parameter 입력:

Connection name: 연결이름 아무거나
Hostname: 호스트의 FQDN 또는 IP 주소
Port: 389 (기본값)
Encryption method: No encryption (기본값)
Provider: Apache Directory LDAP Client API (기본값)

입력후 Check Network Parameter 버튼을 눌러서 확인.
성공했다면 Next로 가서 인증정보를 입력한다.

Authentication 입력:

Authentication Method: Simple Authentication
Bind DN or user: cn=admin,dc=foo,dc=bar
Bind password: [package 설치시 입력했던 password]

입력후 Check Authentication 버튼을 눌러서 확인.

TLS 설정:
참조링크에 자세히 나오는데, 그대로 발췌했다.

Here, we will be our own Certificate Authority and then create and sign our LDAP server certificate as that CA. Since slapd is compiled using the gnutls library, we will use the certtool utility to complete these tasks.

  1. Install the gnutls-bin and ssl-cert packages:

    sudo apt-get install gnutls-bin ssl-cert
    
  2. Create a private key for the Certificate Authority:

    sudo sh -c "certtool --generate-privkey > /etc/ssl/private/cakey.pem"
    
  3. Create the template/file /etc/ssl/ca.info to define the CA:

    cn = Example Company
    ca
    cert_signing_key
    
  4. Create the self-signed CA certificate:

    sudo certtool --generate-self-signed \
    --load-privkey /etc/ssl/private/cakey.pem \ 
    --template /etc/ssl/ca.info \
    --outfile /etc/ssl/certs/cacert.pem
    
  5. Make a private key for the server:

    sudo certtool --generate-privkey \
    --bits 1024 \
    --outfile /etc/ssl/private/ldap01_slapd_key.pem
    

    Replace ldap01 in the filename with your server's hostname. Naming the certificate and key for the host and service that will be using them will help keep things clear.

  6. Create the /etc/ssl/ldap01.info info file containing:

    organization = Example Company
    cn = ldap01.example.com
    tls_www_server
    encryption_key
    signing_key
    expiration_days = 3650
    

    The above certificate is good for 10 years. Adjust accordingly.

  7. Create the server's certificate:

    sudo certtool --generate-certificate \
    --load-privkey /etc/ssl/private/ldap01_slapd_key.pem \
    --load-ca-certificate /etc/ssl/certs/cacert.pem \
    --load-ca-privkey /etc/ssl/private/cakey.pem \
    --template /etc/ssl/ldap01.info \
    --outfile /etc/ssl/certs/ldap01_slapd_cert.pem
    

Create the file certinfo.ldif with the following contents (adjust accordingly, our example assumes we created certs using https://www.cacert.org):

dn: cn=config
add: olcTLSCACertificateFile
olcTLSCACertificateFile: /etc/ssl/certs/cacert.pem
-
add: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ssl/certs/ldap01_slapd_cert.pem
-
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ssl/private/ldap01_slapd_key.pem

Use the ldapmodify command to tell slapd about our TLS work via the slapd-config database:

sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f /etc/ssl/certinfo.ldif

Contratry to popular belief, you do not need ldaps:// in /etc/default/slapd in order to use encryption. You should have just:

SLAPD_SERVICES="ldap:/// ldapi:///"

LDAP over TLS/SSL (ldaps://) is deprecated in favour of StartTLS. The latter refers to an existing LDAP session (listening on TCP port 389) becoming protected by TLS/SSL whereas LDAPS, like HTTPS, is a distinct encrypted-from-the-start protocol that operates over TCP port 636.

Tighten up ownership and permissions:

sudo adduser openldap ssl-cert
sudo chgrp ssl-cert /etc/ssl/private/ldap01_slapd_key.pem
sudo chmod g+r /etc/ssl/private/ldap01_slapd_key.pem
sudo chmod o-r /etc/ssl/private/ldap01_slapd_key.pem

Restart OpenLDAP:

sudo service slapd restart

Check your host's logs (/var/log/syslog) to see if the server has started properly.


TLS 시험:
ADS에서 새로운 연결을 하나 만들어서 테스트한다. 연결설정에서 다른 설정들은 모두 이전과 같이 하고 Encryption methodUse StartTLS extension으로 선택한다.
연결시 인증서 관련 경고 비슷한게 나오는데, 사설(self-signed) 인증서라 그런 것이므로 무시하고, trust하는 것으로....

refs:
https://help.ubuntu.com/12.10/serverguide/openldap-server.html

https://help.ubuntu.com/community/OpenLDAPServer

http://www.openldap.org/faq/data/cache/185.html

happy hackin'

svn에서 git으로 옮겨타기

tips & tricks 2013. 4. 5. 23:44 by manywaypark

svn에서 git으로 소스트리 옮기기.

git-svn 설치 후 git remote add 후 push!

예를 들어 google code의 svn repo에서 github로 옮긴다면 다음과 같이 한다.

참고로 모든 변경 내역이 유지된다.

git svn clone http://[yourproject].googlecode.com/svn/trunk/path/to/code/

git remote add origin git@github.com:[youraccount]/[yourrepository].git

git push origin master


ref: http://bassistance.de/2009/08/20/getting-started-with-git-and-github-and-importing-from-subversion/


happy hackin'

git flow

tips & tricks 2012. 12. 21. 01:08 by manywaypark

git flow를 쓰면 개발 과정에서 좀더 체계적으로 git을 활용할 수 있다.


refs:

https://github.com/nvie/gitflow/wiki/Installation

http://nvie.com/posts/a-successful-git-branching-model/

http://knight76.tistory.com/entry/Git-Flow-%EC%A2%8B%EC%9D%80-%EC%9E%90%EB%A3%8C

http://yakiloo.com/getting-started-git-flow/


happy hackin'

DB Schema graph

tips & tricks 2012. 12. 20. 22:11 by manywaypark

SchemaSpySQLFairy를 사용하면 DB schema에서 그래프를 얻을 수 있다.

ref: http://pwnguin.net/generating-database-schema-with-sql-and-graphviz.html

happy hackin'

사용 버전: Xcode 4.3

대충 참고링크에 나오는 대로(소스 받고, Xcode에서 빌드하고 shell(command line) project로 test target 새로 만들기 등) 따라하면 되는데, 링크의 내용중에 Xcode 버전 차이 등으로 잘 이해가 안된 부분은 환경변수 DYLD_FRAMEWORK_PATH 설정이었다.

요점은 아주 간단한데, test target을 실행할때 DYLD_FRAMEWORK_PATH를 설정하는 것이다. (VC나 Qt는 프로젝트 설정에 있다.)

여튼 환경 변수 설정법은 Xcode 오른쪽 상단의 Run, Stop 버튼 옆의 configuration 선택 부분(drop 박스랑 버튼이랑 조합된 것같은... 머라 부르는지 잘 모르겠다.)에서 테스트 프로젝트를 선택한 후에 아래쪽에 있는 Edit Scheme...을 선택하면 나오는 대화상자에서, 위쪽과 왼쪽의 프로젝트 설정 관련 선택이 제대로 되었는지 확인한 후에, Arguments 탭에 보면 Environment Variables 섹션이 있다. 여기서 추가하면 된다.

제법 한참 삽질한거같다. 예전 버전에서는 프로젝트 설정에 있었던거같기도 하고... (귀찮아서 찾아보지는 않았다).

GUI tool은 버전바뀔때마다 먼가 조금씩 바뀌는 것이 영 맘에 안든다. 글로 설명하기도 애매하고, 자세히 설명하려면 화면 갈무리도 해야하고 여간 귀찮은게 아니다. plain text로 된 설정이 더 나은거같다. qmake, make(autotool)  등이 좋은 예라고 할 수 있다.

refs:

  • http://sidelightblog.blogspot.kr/2008/08/using-google-testing-framework-in-your.html
  • http://code.google.com/p/sidelight/wiki/gtestSample
  • http://code.google.com/p/googletest/wiki/XcodeGuide

happy hackin'

git untrack file

tips & tricks 2012. 6. 12. 11:50 by manywaypark

git status 해보면 가끔 의도치 않게 파일이 추가 되어있는 경우가 있다 (modified 로 보임).

git rm --cached [filenames]


refs:

http://www.devdaily.com/git/git-rm-file-git-repository-dont-track-accidentally-added

http://source.kohlerville.com/2009/02/untrack-files-in-git/


happy hackin'

아래와 같은 메시지가 나오면서 빌드가 안되는 경우가 있다.

com.android.sdklib.build.ApkCreationException: Debug Certificate expired on ...

메시지를 보면 인증서 기한 문제인데, debug용 key는 없으면 자동으로 생성되므로 지워주면 된다.

rm ~/.android/debug.keystore

ref:

http://stackoverflow.com/questions/3814503/ant-rules-r3-xml-error


happy hackin'

[TIP] macport svn downgrade

tips & tricks 2012. 3. 14. 16:42 by manywaypark
macport에서 subversion을 downgrade할 일이 생겼다(1,7.x -> 1.6.x).
현재로서는 간단하게 하는 방법은 없는 듯하고 아래처럼 수동으로 해야한다. 

$ cd /tmp
$ svn co http://svn.macports.org/repository/macports/trunk/dports/devel/subversion
$ cd subversion
$ svn log
......
------------------------------------------------------------------------
r85581 | dluke@macports.org | 2011-10-15 03:56:06 +0900 (Sat, 15 Oct 2011) | 2 lines

subversion: version bump, subversion and bindings ports to 1.7.0

------------------------------------------------------------------------
r80777 | blair@macports.org | 2011-07-17 14:55:53 +0900 (Sun, 17 Jul 2011) | 5 lines

subversion, subversion-javahlbindings, subversion-rubybindings,
subversion-python26bindings, subversion-python27bindings,
subversion-python24bindings, subversion-perlbindings,
subversion-python25bindings: Depend upon serf0 instead of serf.
......
$ cd ..
$ svn co -r 80777 http://svn.macports.org/repository/macports/trunk/dports/devel/subversion subversion80777
$ cd subversion80777
$ sudo port install
......
--->  Attempting to fetch subversion-1.6.17_1......
......
$ port installed subversion
The following ports are currently installed:
  subversion @1.6.17_1 (active)
  subversion @1.7.3_1

 
refs:
http://reinout.vanrees.org/weblog/2008/09/19/macports-downgrading-subversion.html
https://trac.macports.org/wiki/howto/InstallingOlderPort 

happy hackin' 

[TIP] doxygen on Xcode 4

tips & tricks 2012. 3. 13. 19:58 by manywaypark
대충 스크립트를 등록해서 쓰면 좀더 인생이 편해진다.
아래 링크 참조

ref: http://www.duckrowing.com/2011/05/14/using-the-doxygen-helper-in-xcode-4/

happy hackin' 
문제:
linux에서는 "exec ssh-agent" 로 하면 되었던 것으로 기억하는데 cygwin bash 환경에서는 제목과 같은 오류가 나면서 제대로 동작하지 않았다.

해결:
다음과 같이 ssh-agent를 실행한다.
$ exec ssh-agent /usr/bin/bash

refs:
http://linuxindetails.wordpress.com/2010/06/07/could-not-open-a-connection-to-your-authentication-agent/

happy hackin'
1 ··· 7 8 9 10 11 12 13 ··· 16 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

05-18 17:46