3개월짜리 무료 SSL 인증서를 발급해 주는 프로젝트인 letsencrypt 에서 SSL/TKS Certificate 발급해서 웹 서버에 적용하기


사전 준비 사항

git 1.8 과 python 2.7 이상 설치

RedHat Enterprise Linux(RHEL)와 CentOS 6, Amazon Linux 1 은 python 2.6 이 설치되어 있고 시스템의 핵심 구성요소라 변경이 어려우니 ISU 저장소 설치 필요

  1. 저장소 다운로드 및 설치

    CentOS 6

    rpm -ivh https://centos6.iuscommunity.org/ius-release.rpm
    CODE
  2. 의존 패키지 설치

    yum install  git python27 python27-devel python27-pip python27-setuptools python27-virtualenv python27-libs
    CODE

SSL 발급 & 웹 서버 적용

  1. 저장소 복제

    git clone https://github.com/letsencrypt/letsencrypt
    cd letsencrypt
    CODE
  2. 인증서 발급

    ./letsencrypt-auto certonly --webroot --email your@email --agree-tos \
    -w /your/web/root/directory1 -d your.domain1 \
    -w /your/web/root/directory2 -d your.domain2 \
    -w /your/web/root/directory3 -d your.domain3
    CODE
    1. 기본 옵션
      1. (default) run  Obtain & install a certificate in your current webserver

      2. certonly         Obtain or renew a certificate, but do not install it

      3. renew             Renew all previously obtained certificates that are near

    2. --webroot         Place files in a server's webroot folder for authentication

    3.  --agree-tos       Agree to the ACME server's Subscriber Agreement
    4. --dry-run           Test "renew" or "certonly" without saving any certificates to disk

nginx 플러그인 사용해서 갱신

./letsencrypt-auto --nginx renew
CODE



cron 연동

3개월 만료이므로 자동으로 갱신하도록 cron 에 등록


문제 해결


UnicodeDecodeError

다음과 같은 에러가 발생할 경우 "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 330: ordinal not in range(128)"

nginx 설정 파일에 한글 주석등이 있어서 입니다.


ascii 가 아닌 문자가 있는 파일을 찾은 후에 한글등을 제거합니다.(https://github.com/certbot/certbot/issues/5236)

$ grep -r -P '[^\x00-\x7f]' /etc/apache2 /etc/letsencrypt /etc/nginx
CODE


같이 보기