메뉴 건너뛰기

XEDITION

MaraSong :: 정보와 기술 IT

[ letsencrypt 설치 및 설정 ]

- 무료로 인증된 기관에서 https 용 ssl 인증서 발급받기.

- Lets Encrypt : 암호화하자 : 무료 웹 SSL 인증서 배포 그룹.

 

 

먼저 설치 디렉토리를 정합니다.

여기에서는  /usr/local/src/letsencrypt <-- 여기에 설치됩니다.

 

# cd /usr/local/src

# git clone https://github.com/letsencrypt/letsencrypt

# cd letsencrypt

# ./letsencrypt-auto --help     ->  다운받은 폴더로 이동 후 아래 명령을 실행하면 자동으로 관련 의존성을 다운받아서 설치 된다.

# ./letsencrypt-auto certonly -a webroot --agree-tos -m <이메일> -w <webrootpath> -d <SSL발급도메인명> --rsa-key-size 4096

ex) ./letsencrypt-auto certonly -a webroot --agree-tos -m marasong.kr@gmail.com.com -w /home/web/html/ -d marasong.net --rsa-key-size 4096

 

주의) 발급을 원하는 도메인은 반드시 웹접속이 가능한 상태어어야 한다. ( 웹서버, DNS , 방화벽 확인 필요)
(주) 최초 발급 시도시 아래의 메세지가 표시되며, 이후 물어보지 않는다.
 EFF의 Let’s Encrypt 관련 소식을 이메일로 받고 싶다면 “y”를 원하지 않는다면, “n” 입력 한다.
-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: n


기본 포트를 SSL으로 이용하는 경우

vi /usr/local/apache/conf/extra/httpd-ssl.conf

 

<VirtualHost *:443>

DocumentRoot 웹루트경로

ServerName 도메인명:443

SSLEngine on 

SSLCertificateFile /etc/letsencrypt/live/도메인명/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/도메인명 /privkey.pem

SSLCertificateChainFile /etc/letsencrypt/live/도메인명/fullchain.pem  

<VirtualHost>

 

이후 아파치 재시작


# /etc/init.d/apachectl stop

AH00526: Syntax error on line 51 of /usr/local/apache/conf/extra/httpd-ssl.conf:

Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration

 

아파치 재시작시 위와 같이 에러발생할경우 아래파일을 열고 주석해제

 

vi /usr/local/apache/conf/httpd.conf

LoadModule ssl_module modules/mod_ssl.so    ->    해당부분 주석해제

 


# /etc/init.d/apachectl stop

AH00526: Syntax error on line 76 of /usr/local/apache/conf/extra/httpd-ssl.conf:

SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).

 

아파치 재시작시 위와 같이 에러발생할경우 아래파일을 열고 주석해제

 

vi /usr/local/apache/conf/httpd.conf

LoadModule socache_shmcb_module modules/mod_socache_shmcb.so        ->    해당부분 주석해제


 

letsencrypt는 3달에 한번씩 갱신해줘야하며, 아래 내용은 도메인 갱신하는 명령어입니다.

 

/usr/local/src/letsencrypt/letsencrypt-auto certonly -a webroot --agree-tos --renew-by-default -w <webrootpath> -d <ssl갱신도메인명> --rsa-key-size 4096

 

위의 내용을 토대로 배시쉘을 하나 만듭니다.

 

vi letscron.sh 

 

#!bin/sh

/usr/local/src/letsencrypt/letsencrypt-auto certonly -a webroot --agree-tos --renew-by-default -w /home/web/ -d marasong.net --rsa-key-size 4096

 

그리고 이 배쉬쉘 파일을 2개월에 한번 실행되도록 크론탭에 등록합니다.

 

/etc/crontab 파일에 아래 내용을 추가합니다.

 

00 00 01 */2 * root /bin/bash /root/bin/letscron.sh

(2로 나눠서 나머지가 0 인 달마다 한번씩 실행, 02월 01일 00시 00분, 04월 01일 00시 00분...)

 


출처 : https://linuxkill.tistory.com/73

 





* 쿠팡 파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있습니다.

위로