블로그 이미지
좋은느낌/원철
이것저것 필요한 것을 모아보렵니다.. 방문해 주셔서 감사합니다..

calendar

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

Notice

    2009. 6. 11. 17:45 개발/Linux 계열

    apache 공식 사이트 http://httpd.apache.org/ 에서 아파치 소스와 자료를 참고하실 수 있습니다. 
    modssl 공식 사이트 http://www.modssl.org/ 에서는 mod_ssl 소스와 자료를 참고하실 수 있습니다.

    apache 1.3.xx 은 ssl 모듈이 없는 버젼이라서 modssl 모듈을 apache 소스에 패치하는 것으로 설치를 진행하게 됩니다. 이와 같은 기본 구조에서 아래의 설치 과정을 참고 바랍니다. (레드헷 8.0 기반에서 설치 테스트 되었습니다.)

    ※ Apache 1.3.xx + mod_ssl 2.8.xx-1.3.xx 설치 순서

    1. openssl 모듈 설치
    2. 최신 apache 소스, mod_ssl 소스 얻기
    3. mod_ssl 모듈 apache 소스 삽입
    4. apache 설정단계(./configure)
    5. apache 컴파일(make)
    6. apache 테스트 인증서 설치(make certificate)
    7. apache 설치(make install)
    8. apache 설치 예시(Apache 1.3.31 + mod_ssl 2.8.19-1.3.31 )

    1. openssl 모듈 설치

    먼저 openssl 라이브러리가 설치되어 있어야 합니다. 
    openssl 설치 자료는 openssl 설치 가이드를 참고해 주시기 바랍니다.

    2. 최신 apache 소스, mod_ssl 소스 얻기

    apache 소스는 httpd.apache.org/download.cgi 에서 최신 버젼의 소스를 받을 수 있습니다. 

    mod_ssl 소스는 www.modssl.org/source/ 에서 최신 버젼의 소스를 확인합니다. [LATEST] 가 붙어있는 소스가 최신 소스입니다.

    mod_ssl-2.8.18-1.3.31.tar.gz [LATEST] 소스가 있을 경우에 이것은 mod_ssl-2.8.18 버젼이며, apache 1.3.31 버젼에 mod_ssl을 패치하는 소스임을 뜻합니다. 참고바랍니다.
    대부분의 경우에 apache가 먼저 업데이트되므로, mod_ssl에서 지원하는 최신 소스에 맞는 버젼의 apache 를 선택해 주시면 되겠습니다.

    3. mod_ssl 모듈 apache 소스 삽입

    최신 mod_ssl 소스와 그에 맞는 apache 소스를 다운받은 후에 압축을 풀고, 풀려진 mod_ssl 디렉토리에서 apache 소스 mod_ssl 패치를 진행합니다.
    --with-apache 옵션은 압축이 풀려진 아파치 소스 경로 /usr/local/src/apache_1.3.xx 를 설정합니다.
    --with-ssl 옵션의 디렉토리를 /usr/local/openssl 과 같이 openssl 설치시에 --openssldir 설정된 디렉토리를 지정해 줍니다.
    --prefix 옵션은 아파치 설치될 경로 /usr/local/apache-ssl 를 지정해 줍니다. 
    ./configure \
    --with-apache=/usr/local/src/apache_1.3.xx \
    --with-ssl=/usr/local/openssl \
    --prefix=/usr/local/apache-ssl
    

    4. apache 설정단계(./configure)

    apache 소스 컴파일 설정전에 SSL 라이브러리 변수 옵션을 먼저 잡아줍니다.
    SSL_BASE=/usr/local/openssl
    export SSL_BASE
    LDFLAGS=-L/usr/local/openssl/lib
    export LDFLAGS
    CPPFLAGS=-I/usr/local/openssl/include
    export CPPFLAGS
    
    apache 소스 디렉토리로 이동을 합니다. apache 소스는 mod_ssl 패치가 되었으며, apache 컴파일 설정 진행합니다.
    apache 소스 설치에는 두가지 방식으로 모듈을 설치할 수 있습니다. statically linking module, DSO(Dynamic Shared Objects) module 모듈로 설치할 수 있습니다.
    정적설치와 동적설치에 대한 문서는 아파치 문서를 참고해 주시바랍니다.

    --prefix 옵션은 아파치 설치 디렉토리를 설정합니다. 
    --enable-module=ssl 옵션으로 ssl 모듈을 설치하는 것을 설정합니다. 
    1. statically linking module 로 mod_ssl 모듈 설치
    --disable-shared=ssl 옵션은 ssl 모듈을 정적으로 링크시키는 것을 지정합니다.
    그 밖의 모듈과 설정 옵션들을 더 추가하시고, 설정을 진행합니다. 
    ./configure \
    --prefix=/usr/local/apache-ssl \
    --enable-module=ssl \
    --disable-shared=ssl \
    ...
    

    2. DSO(Dynamic Shared Objects) module 로 mod_ssl 모듈 설치
    --enable-shared=ssl 옵션은 ssl 모듈을 동적으로 링크시키는 것을 지정합니다.
    그 밖의 모듈과 설정 옵션들을 더 추가하시고, 설정을 진행합니다. 
    ./configure \
    --prefix=/usr/local/apache-ssl \
    --enable-module=ssl \
    --enable-shared=ssl \
    ...
    

    5. apache 컴파일(make)

    컴파일을 진행합니다.
    make

    6. apache 테스트 인증서 설치(make certificate)

    apache 1.3.xx 는 설치시에 테스트 인증서 설치를 도와 줍니다. 테스트 인증서를 설치합니다. (파란색으로 표시된 것이 입력된 문자입니다.)
    이부분은 CSR 생성 가이드 문서를 참고하시면 좋습니다.
    make certificate TYPE=test
    ...
    STEP 0: Decide the signature algorithm used for certificate
    The generated X.509 CA certificate can contain either
    RSA or DSA based ingredients. Select the one you want to use.
    Signature Algorithm ((R)SA or (D)SA) [R]:R
    
    STEP 1: Generating RSA private key (1024 bit) [server.key] ...
    STEP 2: Generating X.509 certificate signing request [server.csr] ... 1. Country Name (2 letter code) [XY]:KR 2. State or Province Name (full name) [Snake Desert]:seoul 3. Locality Name (eg, city) [Snake Town]:seoul 4. Organization Name (eg, company) [Snake Oil, Ltd]:Dotname Korea 5. Organizational Unit Name (eg, section) [Webserver Team]:Digital Certificate Team 6. Common Name (eg, FQDN) [www.snakeoil.dom]:www.anycert.co.kr 7. Email Address (eg, name@FQDN) [www@snakeoil.dom]:(적당한 이메일 주소를 넣어주세요) 8. Certificate Validity (days) [365]:365
    STEP 3: Generating X.509 certificate signed by Snake Oil CA [server.crt] Certificate Version (1 or 3) [3]:3 ... STEP 4: Enrypting RSA private key with a pass phrase for security [server.key] The contents of the server.key file (the generated private key) has to be kept secret. So we strongly recommend you to encrypt the server.key file with a Triple-DES cipher and a Pass Phrase. Encrypt the private key now? [Y/n]: y writing RSA key Enter PEM pass phrase: (적당한 테스트 비밀번호) Verifying - Enter PEM pass phrase: (적당한 테스트 비밀번호) Fine, you're using an encrypted RSA private key. ...

    7. apache 설치(make install)

    apache 를 설치합니다.
    make install
    apache 컴파일 오브젝트들을 삭제합니다.
    make clean
    apache 컴파일 SSL 옵션 변수들을 해제합니다.
    unset SSL_BASE
    unset LDFLAGS
    unset CPPFLAGS

    8. apache 설치 예시(Apache 1.3.31 + mod_ssl 2.8.19-1.3.31 )

    (리눅스 레드헷 8.0 이상 기준 설치 예시입니다.)
    [root@web1 root]# cd /usr/local/src
    [root@web1 src]# wget http://www.modssl.org/source/mod_ssl-2.8.19-1.3.31.tar.gz
    [root@web1 src]# wget http://ftp.apache-kr.org/httpd/apache_1.3.31.tar.gz
    [root@web1 src]# tar zxf mod_ssl-2.8.19-1.3.31.tar.gz
    [root@web1 src]# tar zxf apache_1.3.31.tar.gz
    [root@web1 src]# cd mod_ssl-2.8.19-1.3.31
    [root@web1 mod_ssl-2.8.19-1.3.31]# ./configure \
    > --with-apache=/usr/local/src/apache_1.3.31 \
    > --with-ssl=/usr/local/openssl \
    > --prefix=/usr/local/apache-ssl
    ...
    [root@web1 mod_ssl-2.8.19-1.3.31]# cd /usr/local/src/apache_1.3.31
    [root@web1 apache_1.3.31]# SSL_BASE=/usr/local/openssl
    [root@web1 apache_1.3.31]# export SSL_BASE
    [root@web1 apache_1.3.31]# LDFLAGS=-L/usr/local/openssl/lib
    [root@web1 apache_1.3.31]# export LDFLAGS
    [root@web1 apache_1.3.31]# CPPFLAGS=-I/usr/local/openssl/include
    [root@web1 apache_1.3.31]# export CPPFLAGS
    [root@web1 apache_1.3.31]# ./configure \
    > --prefix=/usr/local/apache-ssl \
    > --enable-module=ssl \
    ...
    [root@web1 apache_1.3.31]# make
    [root@web1 apache_1.3.31]# make certificate TYPE=test
    ...
    [root@web1 apache_1.3.31]# make install
    [root@web1 apache_1.3.31]# make clean
    
    posted by 좋은느낌/원철