본문 바로가기
Program/ubuntu Linux

우분투 아파치 에서 Let’s Encrypt 무료 SSL 인증서 발급 방법

by 소중하루 2020. 7. 30.
반응형

우분투 아파치 에서 Let’s Encrypt 무료 SSL 인증서 발급 방법

 



https 보안 프로토콜을 사용하기 위해 SSL 인증서를 적용한다
상업적인 용도라면 유료 SSL 인증서를 사용하는게 보안 이슈나 유효기간 등 신경쓸일이 없지만
단순 블로그 용이니 굳이 유료로 사용할 필요 없이 무료 SSL 인증서를 사용하면된다

무료 SSL 인증서인 Let’s Encrypt SSL 인증서 설치 방법


Let's Encrypt 클라이언트 Certbot 설치

$ apt-get update  
$ apt-get upgrade
$ apt-get install software-properties-common
$ add-apt-repository universe
$ apt-get update
$ apt-get install certbot python3-certbot-apache 


SSL 인증서 발급

Certbot이 Apaceh 구성을 자동으로 편집하여 서비스를 제공하도록 한다

$ certbot --apache

갱신 알림 받을 이메일 입력
 : xxxx@xxxx.com

ACME 서버 등록 여부
 : A

입력한 이메일로 광고 및 뉴스 등 전송 여부
 : N

HTTPS 적용할 도메인 선택(VirtualHost 에 입력된 ServerName 읽어서 적용 도메인 리스트 보여준다. 총 5개 있는 상태)
 : 1 2 3 4 5

HTTP 를 HTTPS로 redirect 하길 원하면 2번 선택
 : 2

 

 

도메인 선택화면에서 자신의 도메인이 정상적으로 나오지 않는다면 아래 명령어를 입력한다

$ certbot --apache -d "[도메인 주소]"

 

인증서 갱신이 정상인지 확인

$ certbot renew --dry-run
$ service apache2 restart

https://[도메인 주소]

 

 

인증서 갱신

$ certbot renew

 

crontab 등록으로 인증서 자동 갱신

$ crontab -e
갱신 명령어 추가 *****

0 0 */15 * * certbot renew --no-self-upgrade >> /var/log/certbot-renew.log
0분 0시 15일 마다 실행

1 0 */15 * * service apache2 restart >> /var/log/cron-apache.log
1분 0시 15일 마다 실행

(왼쪽에서부터 분(0-59), 시(0-23), 일(1-31), 월(1-12), 요일(0-7) 순서대로 입력 요일의 경우 0과 7은 일요일, 1은 월요일, 6은 토요일)


apt-get 등 업데이트 없이 갱신 실행
certbot renew --no-self-upgrade

 

인증서 삭제

$ certbot delete --cert-name [인증서 이름]

 

기존 인증서 삭제 전 Revoke 먼수 수행 후 삭제

 

Revoke 수행 후 apache2/sites-available/000-default-le-ssl.conf 삭제

 

Revoke 는 아래 페이지 참조

https://certbot.eff.org/docs/using.html#revoking-certificates

 

User Guide — Certbot 1.7.0.dev0 documentation

Certbot uses a number of different commands (also referred to as “subcommands”) to request specific actions such as obtaining, renewing, or revoking certificates. The most important and commonly-used commands will be discussed throughout this document;

certbot.eff.org

 

 

 

참고 : 

https://certbot.eff.org/lets-encrypt/ubuntufocal-apache

 

Certbot - Ubuntufocal Apache

a project of the Electronic Frontier Foundation certbot instructions To use Certbot, you'll need... comfort with the command line command line ...and an HTTP website HTTP website that is already online already online with an open port 80 port 80 ...which i

certbot.eff.org

 

 

반응형

댓글