WHEREIS

개인키 생성

openssl genrsa -des3 -out server.key 1024



csr 키 생성

openssl req -new -key server.key -out server.csr


개인키에서 패스워드 삭제하기 

openssl rsa -in server.key -out server.key.insecure

mv server.key server.key.secure

mv server.key.insecure server.key


CA 인증서 생성 


openssl x509 -req -days 1280 -in server.csr -signkey server.key -out server.crt


apache 2.x 설정 


Include conf/extra/httpd-ssl.conf 주석 해제 


httpd-ssl.conf 설정


<VirtualHost 192.168.100.1>


#   General setup for the virtual host

DocumentRoot "/www/test"

ServerName www.test.com

ServerAdmin sysadmin@test.com

ErrorLog "/logs/test.com-error_log"

TransferLog "/logs/test.com-access_log"


#   SSL Engine Switch:

#   Enable/Disable SSL for this virtual host.

SSLEngine on


SSLCertificateFile "/usr/local/apache2/conf/server.crt"

SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"



옵션 관련

--------------------------------------------------------------------------------

* genrsa : RSA 개인키생성 
* rsa : RSA 키 처리 프로그램. 개인키의 암호화를 없앨 경우 사용할 수 있음 
* req : X.509 Certificate Signing Request (CSR) Management (man openssl) . 인증서 생성시 사용 
* ca : Certificate Authority (CA) Management (man openssl) . ca에서 사용 
* req 에 대한 상세설명은 man req 을 참고한다. 

genrsa 

* -des3 : 개인키 암호화. 이 옵션을 빼면 개인키를 암호화하지 않아서 비밀번호를 물어보지 않는다. 

req 

* -new : 인증 요청서 생성 
this option generates a new certificate request. It will prompt the user for the relevant field values. The actual fields prompted for and their maximum and minimum sizes are specified in the configuration file and any requested extensions. If the -key option is not used it will generate a new RSA private key using information specified in the configuration file 
* -key : 읽어들일 개인키 지정. 개인키를 미리 생성하여 사용할 경우에 필요함 
This specifies the file to read the private key from. It also accepts PKCS#8 format private keys for PEM format files. 
* -keyout : 새로 생성할 개인키 파일명 지정 
this gives the filename to write the newly created private key to. If this option is not specified then the filename present in the configura-tion file is used. 
* -out : 공개키 파일 명 지정 
This specifies the output filename to write to or standard output by default. 
* -days : 인증서 유효기간. 기본값은 30일임 
when the -x509 option is being used this specifies the number of days to certify the certificate for. The default is 30 days. 
* -x509 : 인증요청서를 만드는 대신에 자체 사인한 인증서를 만듬. 보통 테스팅용 인증서를 만들거나 root CA를 만들 경우에 필요함. 
this option outputs a self signed certificate instead of a certificate request. This is typically used to generate a test certificate or a self signed root CA. The extensions added to the certificate (if any) are specified in the configuration file. Unless specified using the set_serial option 0 will be used for the serial number. 
* -subj : DN 내용을 미리 입력할 수 있음. 
sets subject name for new request or supersedes the subject name when processing a request. The arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \ (backslash), no spaces are skipped. 
예제 : /usr/bin/openssl req -new -subj '/CN=sds.co.kr/O=samjung/C=KO/ST=gurogu/L=seoul' -keyout newreq.pem -x509 -days 1825 -out newreq.pem 
* -nodes : 개인키 암호화를 하지 않는다. 대몬프로그램을 올리고 내릴때 편리하다. 
if this option is specified then if a private key is created it will not be encrypted. 

ca 

* -infiles : 인증요청서(csr) 파일명 
if present this should be the last option, all subsequent arguments are assumed to the the names of files containing certificate requests. 
* -out : 생성할 인증서 파일 
* -revoke : 인증을 철회할 파일명 
* -gencrl : this option generates a CRL based on information in the index file. 


#출처 : http://blog.naver.com/PostView.nhn?blogId=tomcat75&logNo=140139259671

          : http://songic.egloos.com/10449983


이 글을 공유합시다

facebook twitter kakaoTalk kakaostory naver band
loading