http://rhrnak522.tistory.com/170

openssl 설치

zlib 모듈 설치

http://www.zlib.net/ 에서 zlib Source code, version 1.2.3, tar.gz (다운로드)

#tar zxvf zlib-1.2.3.tar.gz
#cd /usr/local/src/zlib-1.2.3 (압축을 푼 경로 이동)

설치
#./configure --shared
#make test install
#make clean
#/sbin/ldconfig

openssl 설치
http://www.openssl.org/source/ [LATEST] (최신버전 다운로드)
#tar zxf openssl-0.9.8d.tar.gz
#cd /usr/local/src/openssl-0.9.8d (압축을 푼 경로 이동)
설치

#export LDFLAGS=-L/usr/local/lib
#export CPPFLAGS=-I/usr/local/include

#./config \
--openssldir=/usr/local/openssl \
shared \
threads \
zlib


참고
--openssldir [openssl 을 설치할 디렉토리를 설정해줍니다.]

#make
#make test
#make install
#make clean


#unset LDFLAGS
#unset CPPFLAGS
#sbin/ldconfig


mod_ssl 설치

apache 소스 다운로드
http://www.apache.org/source/apache_1.3.33.tar.gz (다운로드)
#tar zxf apache_1.3.33.tar.gz
mod_ssl 모듈에 apache 소스 삽입
http://www.modssl.org/source/mod_ssl-2.8.24-1.3.33.tar.gz (다운로드)
#tar zxf mod_ssl-2.8.24-1.3.33.tar.gz
#cd /usr/local/src/mod_ssl-2.8.24-1.3.33 (압축을 푼 경로 이동)

설치
#./configure \
--with-apache=/usr/local/src/apache_1.3.33 \
--with-ssl=/usr/local/openssl \
--prefix=/usr/local/etc/apache-ssl

참고
--with-apache : 위에서 다운받아서 압축을 해제한 아파치 소스 경로 지정
--with-ssl:openssl --openssldir 로 설치위치 경로 지정
--prefix:apache-ssl 설치될 경로 지정


apache 설정하기

#cd /usr/local/src/apache_1.3.33 (압축을 푼 경로 이동)

설치
#SSL_BASE=/usr/local/openssl
#export SSL_BASE
#LDFLAGS=-L/usr/local/openssl/lib
#export LDFLAGS
#CPPFLAGS=-I/usr/local/openssl/include
#export CPPFLAGS

#./configure \
--prefix=/usr/local/etc/apache-ssl \
--enable-module=ssl \
--enable-shared=ssl \
--enable-rule=SHARED_CORE



#make



테스터 인증서 설치
#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]:Kangnam
4. Organization Name (eg, company) [Snake Oil, Ltd]:Swingme Cafe
5. Organizational Unit Name (eg, section) [Webserver Team]:HAHAHA
6. Common Name (eg, FQDN) [www.snakeoil.dom]:www.swingmecafe.co.kr
7. Email Address (eg, name@FQDN) [www@snakeoil.dom]:mshout77@naver.com
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.
...
#make install


#make clean
#unset SSL_BASE
#unset LDFLAGS
#unset CPPFLAGS

개인키 .key 생성 및 확인

개인키 생성하기
#cd /usr/local/openssll (OpenSSL이 설치된 경로로 이동합니다)
설치
#openssl genrsa -des3 -out www_ucert_co_kr.key 1024

Generating RSA private key, 1024 bit long modulus
.............++++++
...++++++
e is 65537 (0x10001)
Enter pass phrase for swingme2006.key: ******
Verifying - Enter pass phrase for swingme2006.key: ******

생성된 개인키 확인

위에서의 작업과 연관된 작업으로 아래와 같이 입력

#openssl rsa -noout -text -in s www_ucert_co_kr.key
Enter pass phrase for ssl.key: ******
Private-Key: (1024 bit)
modulus:
00:da:bf:f3:39:d7:c6:1f:bd:6f:a7:b8:aa:67:f2:
...
coefficient:
6b:26:51:9e:fb:77:cf:7e:d4:2a:a6:d2:7f:21:fa:
42:e4:7c:54:2e:5e:e9:fb:03:a6:25:d0:6a:fc:e9:
e1:1b:45:82:61:c0:35:a9:50:25:0a:75:2a:f8:cc:
87:10:30:9d:bd:36:8e:4b:f6:55:0d:08:30:e8:55:
e4:00:3b:ec

CSR 생성 및 확인

CSR 생성하기
#openssl req -new -key www_ucert_co_kr.key ?out www_ucert_co_kr.csr

Country Name (2 letter code) [KR]: KR 국가코드
State or Province Name (full name) [Berkshire]:Seoul
Locality Name (eg, city) [Newbury]:Kang-Nam
Organization Name (eg, company) [My Company Ltd]: Ucert 회사명
Organizational Unit Name (eg, section) []: Information 부서명
Common Name (eg, your name or your server's hostname) []:www.ucert.co.kr 도메인
Email Address []: xxx@ucert.co.kr

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:Enter
An optional company name []:Enter



CSR 확인

위에서의 작업과 연관된 작업으로 아래와 같이 입력을 하면 생성된
www_ucert_co_kr.csr 의 내용을 확인할 수 있습니다.

#openssl req -noout -text -in www_ucert_co_kr.csr
Certificate Request:
Data:
Version: 0 (0x0)
Subject: C=KR, ST=Seoul, L=Kang-nam, O=Swingme ucert
OU=Informatin CN=www.ucert.co.kr
...
개인키 백업

#cd /usr/local/openssl
#mv www_ucert_co_kr.* /root/

CSR 파일 인증받기

인증기관을 통해 인증을 받습니다.

apache가 설치 되어 있는 디렉토리의 conf/httpd.conf 파일을 수정합니다.



데몬을 실행합니다.



홈페이지에 접속해 보안인증서를 확인 합니다.

+ Recent posts