지인 분의 부탁으로 SSL인증서를 웹서버에 설치하게되었다.
페이스북의 Canvas라는 App인데, 이를 사용하려면 https를 사용해야만 해당 App을 쓸수있다고하여 SSL을 설치하게되었다.
1. Random State 생성
|
openssl sha1 * > rand.dat |
2. 개인키 생성
|
openssl genrsa -rand rand.dat -des3 2048 > key.pem |
개인키를 생성하면 비밀번호를 입력하게 되는데, 이 비밀번호는 Apache 기동시 반드시 필요하므로 꼭 기억하도록 합니다.
잊으면 인증서를 재발급 해야 합니다.
3. CSR 생성
|
openssl req -new -key key.pem -out csr.pem |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Enter pass phrase for key.pem: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:KR State or Province Name (full name) [Berkshire]:Ulsan Locality Name (eg, city) [Newbury]:Nam-gu Organization Name (eg, company) [My Company Ltd]: Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []:OOO.issro.net Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: |
우선, 개인키 생성 때 입력한 비밀번호를 입력하고 순차적으로 입력합니다.
Country Name : 국가(C : country)에 해당하는 값
State or Province Name : 지방(ST : state)에 해당하는 값
Locality Name : 지역(L : locality)에 해당하는 값 (city, town 등)
Organization Name (eg, company) [My Company Ltd] : DN(Distinguish Name)에 포함될 기간명(O : organization)을 입력합니다.
Organizational Unit Name (eg, section) [] : DN에 포함될 부서이름(OU : organization unit)을 입력합니다.
Common Name (eg, your name or your server’s hostname) [] : SSL인증서를 사용하실 웹 서버의 Full domain name(host + domain name)을 입력합니다. ex) www.kisa.or.kr
추가 사항은 생략하셔도 됩니다.
이렇게 생성한 CSR파일을 SSL 인증서를 구매하는 업체에 전달하고, 이제 인증서를 기다리고 기다리고 기다리면 됩니다.
마지막으로 제 서버는 Apache 2.2.29인데, 컴파일 설치 할 때 mod_ssl 조건을 주지 않아 다시 컴파일해야 합니다.
기존의 소스 설치파일을 남겨 두었기 때문에 config.log 파일에 기존의 컴파일 명령어들이 남아있어 거기에 “–enable-ssl” 조건을 추가하여 새로 컴파일 후, 새로 설치된 Apache 아래의 /modules/mod_ssl.so 파일을 기존의 Apache 아래의 /modules/에 복사하고, 기존의 Apache의 htpd.conf파일에서 “LoadModule ssl_module modules/mod_ssl.so”을 추가하고 Apache를 재시작하면 됩니다.
근데, 이상하다… 예전에 설치할땐 Apache아래의 bin에서 어떤 실행파일을 통해서 mod_ssl.so 파일을 등록해 주었는데, 다시하니 그런게없다… httpd -l 하니 mod_ssl.c가 보이지 않는다… 역시 다시 삽질해야한다… 그게 aspx라는 건데, mod_ssl.c 파일을 컴파일해서 mod_ssl.so파일을 만들어준단다. so파일을 conf파일에서 로드하면 문제없이 된다고 하니, 일단은 더 진행하지 않고 인증서를 기다려봐야겠다.
Apache 2.2.29에서 위 처럼 하면 SSL 모듈이 정상적으로 작동을 해서, httpd-ssl.conf 에서 ssl 관련 VirtualHost만 설정해주고 재시작하고, 개인키 생성 할 때 입력했던 비밀번호만 입력하면 됩니다.