티스토리 뷰

카테고리 없음

SSL 인증서 설치 - CentOS

성공마스터 2018. 6. 22. 00:57



SSL 인증서 설치 방법



리눅스 CentOS에서 아파치 서버가 깔려있다는 가정하게 SSL 보안 인증서를 설치하는 방법을 알아보겠습니다.




1. 개인키 생성


# openssl genrsa -des3 -out mydomain.key 2048

# 비밀번호 입력


+ 생성한 키 검증

# openssl rsa -noout -text -in mydomain.key



2. CSR(인증요청서) 생성


[root@localhost]# openssl req -new -key mydomain.key -out mydomain.csr

Enter pass phrase for mydomain.key:

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) [XX]:KR

State or Province Name (full name) []:Seoul

Locality Name (eg, city) [Default City]:Gangnam-gu

Organization Name (eg, company) [Default Company Ltd]:(회사명)

Organizational Unit Name (eg, section) []:development

Common Name (eg, your name or your server's hostname) []:mydomain.com

Email Address []:(관리자이메일주소)


Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:(엔터)

An optional company name []:(엔터)



3. 호스팅사에 SSL 인증서 신청


신청시에 CSR 입력 화면이 나옵니다. 그럼 위에서 생성한 파일을 열어서 내용을 복사해서 붙여넣으면 됩니다.

그리고 이메일 인증이나 웹인증을 하면 호스팅사로 부터 인증서 파일들을 보내줍니다.

그 파일들을 전부 서버에 복사해 넣습니다. 

위치는 아무곳이나 상관없지만,

저는 /usr/local/apache/conf/ssl/ 폴더를 만들고 여기에 복사해 두었습니다.



4. httpd.conf 파일 수정


LoadModule socache_shmcb_module modules/mod_socache_shmcb.so (주석제거)

LoadModule ssl_module modules/mod_ssl.so (주석제거)

Include conf/extra/httpd-ssl.conf (주석제거)

<IfModule ssl_module> (주석제거확인)

SSLRandomSeed startup builtin

SSLRandomSeed connect builtin

</IfModule>     



5. extra/httpd-ssl.conf 파일 수정


호스팅사에서 보내준 인증서 관련 파일들이 여러개 많이 올수도 있는데,

다 세팅할 필요는 없고, 아래에 있는 3가지만 찾아서 세팅하면 된다.


<VirtualHost *:443>

    DocumentRoot "/home/mydomain"

    ServerName mydomain.com:443

    ServerAdmin root@localhost

    SSLEngine on

    SSLCertificateFile "/usr/local/apache/conf/ssl/mydomain_com_cert.pem"

    SSLCertificateKeyFile "/usr/local/apache/conf/ssl/mydomain.key"

    SSLCertificateChainFile "/usr/local/apache/conf/ssl/Chain_RootCA_Bundle.crt"

</VirtualHost>



6. 리눅스 방화벽 443 포트 개방



7. 아파치 재시작 + SSL 비밀번호 입력  



아파치 재시작후 브라우저에서 https://으로 시작하는 자신의 도메인 주소를 입려해 보면,

인증서가 정상적을 설치되었다면,

아래와 같이 "안전함"이라고 뜨는 것을 확인할 수 있다.





댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함