본문 바로가기
카테고리 없음

certbot 사용법 및 ssl 설정

by 아카이sun 2023. 2. 17.

certbot을 이용해 open ssl을 설치하고 관리 

 

certbot 설치 

yum install certbot certbot-nginx

certbot 인증서 발행

certbot certonly -d example.com -d www.example.com --manual --preferred-challenges dns

nginx를 통한 certbot 인증서 설치

# 다수의 도메인 인증
$ certbot --nginx -d example.com -d www.example.com

# 와일드카드 인증
$ certbot --nginx -d example.com -d *example.com

certbot 만료일자 확인

certbot certificates

certbot 인증서 삭제

certbot delete

또는

certbot delete --cert-name example.com

cerbot 인증서 갱신

# 수동갱신
certbot renew --dry-run

# 자동갱신
# 매월 1일 1시에 크론탭실행
0 1 1 * * /usr/bin/certbot renew --quiet --renew-hook "service nginx reload"

nginx에 인증서 추가 

server {
 	...
 
 	ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
 	ssl_certificate_key /etc/letsencrypt/live/example.com//privkey.pem;

}

 

* NXDOMAIN looking up TXT for _acme-challenge 오류

서브 도메인 포함 각 도메인은 SSL에 등록하기 위해서는 TXT레코드를 등록하여 인증해야한다.

해당 TXT레코드를 찾을수 없어서 나는 오류이다.

아래는 디지털오션의 설정페이지이다.

이미지를 참고하여 _acme-challenge로 시작하는 hostname을 제공되는 VALUE와 함께 TXT레코드에 등록한다.

digital ocean의 DNS 설정 페이지

 

추가
 A 레코드는 root domain이다.  예를들어 test.com과 같다.
CNAME 레코드는 도메인의 별칭 값인데 흔히 알고 있는 sub domain이다.   
예를들어 www.test.com이나 blog.test.com과  같은 것이다.   
TXT레코드는 임의의 문자열로 구성된 값으로 소유한 도메인이 유효한 도메인인지를 판단한다.

 

 

댓글