티스토리 뷰


무료 인증서 (SSL) 발급 서비스 (LetsEncrypt) 간단 셋팅하기



사이트



 https://letsencrypt.org





특징


 

자가 서명 인증서 (무료)


인증서 유효기간은 90일 (30일 미만 남았을때 부터 인증서 갱신 가능)


*.domain 일괄 서브 도메인 등록 불가 (서브 도메인 하나씩 인증서 발급)


certbot 이라는 스크립트 이용하여 인증서 자동 생성, 갱신 가능





테스트 환경


 

도메인 : test.kensei.co.kr


Centos 7 64bit


httpd, mod_ssl (RPM)





EPEL 저장소 추가


yum install epel-release




certbot 설치



yum install certbot





웹서버가 Apache 인 경우



yum install python2-certbot-apache

 




웹서버가 nginx 인 경우


 

yum install python2-certbot-nginx






[사전 작업 필요]


 

SSL 모듈 설치 필요 (mod_ssl)


1. 발급받을 도메인이 certbot을 실행하는 서버 아이피를 바라보고 있어야 함


2. SSL 설정이 되어 있어야 함




1번 예시) test.kensei.co.kr 이라는 도메인을 네임서버에서 certbot 을 설치한 웹 서버로 잡아준다.


 




2번 예시)


/etc/httpd/conf.d/ssl.conf (파일에 도메인 설정이 되어 있어야 함)



ServerName test.kensei.co.kr:443

 




위 2가지 작업이 미리 진행되어야 아래와 같이 에러 없이 잘 실행된다.




certbot 명령어 실행 (apache 에서 실행해보았다)



[root@iwinvhelper-8053 wordpress]# certbot --apache -m takakocap@naver.com -d test.kensei.co.kr -n --agree-tos
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Cert not yet due for renewal
Keeping the existing certificate
Deploying Certificate for test.kensei.co.kr to VirtualHost /etc/httpd/conf.d/ssl.conf

-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://test.kensei.co.kr

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=test.kensei.co.kr
-------------------------------------------------------------------------------

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/test.kensei.co.kr/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/test.kensei.co.kr/privkey.pem
   Your cert will expire on 2017-12-19. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le 





/etc/httpd/conf.d/ssl.conf (아래 라인이 추가되었다)



SSLCertificateFile /etc/letsencrypt/live/test.kensei.co.kr/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/test.kensei.co.kr/privkey.pem

SSLCertificateChainFile /etc/letsencrypt/live/test.kensei.co.kr/chain.pem

ServerAlias test.kensei.co.kr





nginx 에서도 아래와 같이 하면 ssl.conf 파일안에 자동으로 설정까지 끝난다.



[root@iwinvhelper-7795 etc]# certbot --nginx -m takakocap@naver.com -d cert.kensei.co.kr -n --agree-tos
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for cert.kensei.co.kr
Waiting for verification...
Cleaning up challenges
Deployed Certificate to VirtualHost /etc/nginx/nginx.conf for set(['cert.kensei.

-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://cert.kensei.co.kr

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=cert.kensei.co.kr
-------------------------------------------------------------------------------

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/cert.kensei.co.kr/fullchain.pem. Your cert
   will expire on 2017-12-06. To obtain a new or tweaked version of
   this certificate in the future, simply run certbot again with the
   "certonly" option. To non-interactively renew *all* of your
   certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le





인증서 갱신 명령어 (crontab 에 추가해서 자동으로 돌려주면 된다)



certbot renew

 




아직 인증서 갱신 할때가 안되었나 보다


 

[root@iwinvhelper-8561 conf.d]# certbot renew

Saving debug log to /var/log/letsencrypt/letsencrypt.log


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

Processing /etc/letsencrypt/renewal/wp.kensei.co.kr.conf

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

Cert not yet due for renewal


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


The following certs are not due for renewal yet:

  /etc/letsencrypt/live/wp.kensei.co.kr/fullchain.pem (skipped)

No renewals were attempted.

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






참고 사이트


 

http://blog.naver.com/itperson/220853849351


https://i.k-june.com/wp/4087



'WEB' 카테고리의 다른 글

워드프레스 구버젼 (옜날 버전) 설치하기  (0) 2017.09.29
mod_rewrite 예제)  (0) 2017.09.13
워드프레스 이커머스 (Electronic Commerce)  (0) 2017.05.24
cookie 보안 취약점  (0) 2017.03.16
HTTP 링크 가져오기  (0) 2017.03.03
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/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
글 보관함