리눅스 Apache + SSL 설치
페이지 정보
작성자
본문
1. 준비물<?XML:NAMESPACE PREFIX = O />
1) openssl 컴파일 및 설치
① http://www.openssl.org/source/openssl-0.9.8k.tar.gz
② tar –vxzf openssl-0.9.8k.tar.gz
③ cd openssl-0.9.8k
④ ./config--prefix=/usr/local/openssl
2) Apache (2.x) 컴파일 및 설치 (DSO로 컴파일)
② tar –vxzf httpd-2.0.63.tgz
③ cd httpd-2.0.63
④ /configure--prefix=/usr/local/apache-SSL --enable-module=ssl
--with-ssl=/usr/local/openssl
--enable-mods-shared=all --enable-rewrite --enable-ssl--enable-module=so
--enable-rule=SHARED_CORE --enable-shared=max
[ httpd.cof 파일 설정 ]
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so ßssl모듈사용
</IfDefine>
<IfModule mod_ssl.c>
Include conf/ssl.conf <-ssl설정 로딩
</IfModule>
혹시, weblogic과 연동이 필요하면 다음의 코드를 추가한다.
so파일은 설치 아파치 버전에 따라 다르다. 파일은 아래 디렉토리에 위치한다.
~weblogic/bea/wlserver_10.0/server/plugin/aix/ppc/
LoadModuleweblogic_module modules/mod_wl_20.so <- 설치된아파치 버전에 따라 다르다. (apache2.0.x)
#LoadModule expires_module modules/ mod_wl_22.so (apache2.2.x)
<Location /weblogic>
SetHandler weblogic-handler
PathTrim /weblogic
</Location>
[ssl.conf 파일 설정 ]
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLSessionCache dbm:/usr/local/apache-SSL/logs/ssl_scache
SSLSessionCacheTimeout 300
SSLMutex file:/usr/local/apache-SSL/logs/ssl_mutex
<VirtualHost domain.com:443>
DocumentRoot"/usr/local/apache-SSL/htdocs"
ServerName domain.com:443
ServerAdmin ID@domain.com
ErrorLog"/usr/local/apache-SSL/logs/ssl_error_log"
TransferLog"/usr/local/apache-SSL/logs/ssl_access_log"
SSLEngine on
SSLCipherSuiteALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile"/usr/local/apache-SSL/conf/ssl/cert.pem" (발급받은 인증서)
SSLCertificateKeyFile"/usr/local/apache-SSL/conf/ssl/key.pem"
SSLCertificateChainFile"/usr/local/apache-SSL/conf/ssl/chain.cer"
SSLCACertificatePath"/usr/local/apache-SSL/conf/ssl"
SSLCACertificateFile"/usr/local/apache-SSL/conf/ssl/rootca.cer" (루트 인증서)
# 교과부 루트 인증서는 홈페이지에서 제공함
<FilesMatch"\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory"/usr/local/apache-SSL/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog/usr/local/apache-SSL/logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
</IfDefine>
3) ldap서버 접근 허용(행안부, 교과부)
아래 서버로 접속이 가능하여야 한다.
URI:ldap://cen.dir.go.kr:389
URI:ldap://ldap.epki.go.kr:389
2. 랜덤파일 생성
개인키 생성시 사용할 random information을 생성 합니다.
생성된 rand.dat 파일이 중요하지 않다고 판단될 때, 언제든지 이 파일을 삭제하거나 변경 할 수 있습니다.
#>openssl sha1 * > rand.dat
or
cat file1 file2 file3 > rand.dat
or
생성하지 않아도 됨
3. 랜덤파일을 가지고 개인키 생성
1) $ openssl genrsa -rand rand.dat -des3 1024 > key.pem
0 semi-random bytes loaded
Generating RSA private key, 1024 bit longmodulus
....................................................++++++
.++++++
e is 65537 (0x10001)
Enterpass phrase: 패스워드 입력
Verifying- Enter pass phrase: 위의 패스워드 다시 입력
4. 생성된 개인키를 가지고 csr 파일 생성
$ openssl req -new -key key.pem -out csr.pem
Enter pass phrase for key.pem: <-개인키 생성시 사용한 비밀번호
You are about to be asked to enterinformation that will be incorporated
into your certificate request.
What you are about to enter is what iscalled a Distinguished Name or a DN.
There are quite a few fields but you canleave some blank
For some fields there will be a defaultvalue,
If you enter '.', the field will be leftblank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name)[Some-State]: 엔터
Locality Name (eg, city) []:
Organization Name (eg, company) [InternetWidgits Pty Ltd]: Government of Korea
Organizational Unit Name (eg, section) []:Group of Server
Common Name (eg, YOUR name) []: *.domain.com
Email Address []:ID@domain.com
Please enter the following 'extra'attributes
to be sent with your certificate request
A challenge password []: 엔터
An optional company name []: 엔터
CSR및 인증서 디코딩 사이트 : http://www.redkestrel.co.uk/cgi/decodeCSR.pl
위에서 만든 키를 이용하여 행안부/교과부에서 인증서를 발급받아야 한다. ( cert.pem )
본 문서는 교과부에 적합하며 행안부는 약간 다르다.(자세한 것은 각기관 배포문서 참고)
교과부용 인증서 발급은 pkcs7옵션을 통한 키파일 생성이 없다.
3. 아파치 실행(SSL)
# /usr/local/apache-SSL/bin/apachectlstartssl
Apache/2.0.63 mod_ssl/2.0.63 (Pass PhraseDialog)
Some of your private key files areencrypted for security reasons.
In order to read them you have to provideus with the pass phrases.
Server domain.com:443 (RSA)
Enter pass phrase: 비밀번호(개인키 만들 때 생성한 비번)
Ok: Pass Phrase Dialog successful.
# ps -ef |grep http
apache-SSL/bin/httpd -k start –DSSL
apache-SSL/bin/httpd -k start –DSSL
apache-SSL/bin/httpd -k start -DSSL
4. 인증서 확인(웹페이지)
댓글목록
등록된 댓글이 없습니다.