'ssl.conf'에 해당되는 글 1건

  1. letsencrypt 와일드카드(Wildcard) 인증서 생성하기

letsencrypt 와일드카드(Wildcard) 인증서 생성하기

우선 와일드카드(Wildcard) 인증서가 뭔지 보자.

구글에서 "와일드카드 인증서"라고 검색해보면 아래와 같은 내용이 나온다.

와일드카드(Wildcard) 인증서란, 도메인(FQDN) 의 하위 서브 도메인 호스트에 대해서 무제한 적용할수 있는 SSL 인증서 타입 입니다. 최근에 SSL 인증서 발급 약 40% 선이 Wildcard SSL 인증서로 발급이 되고 있으며, 이는 그만큼 효용성이 높다는 것을 증명합니다.

 

이 와일드카드 인증서를 생성하기 위해서는 SSL인증서 발급기관에 의뢰하게 되면 대충 10만원 이상의 비용이 발생한다.

하지만, letsencrypt를 이용하면 무료로 발급할 수 있다.

다만, 3개월에 한번씩 갱신해줘야 하는 단점이 있지만.. 이도 자동으로 갱신 설정을 해놓으면 된다.

 

이제 letsencrypt 로 와일드카드 인증서 생성을 하는 과정을 보자.

 

생성하고자 하는 도메인을 "abcd.com" 이라고 하자.

여기에 *.abcd.com 을 운영을 위해 와일드카드(wildcard) SSL 인증서를 만들어 보자.

[root@svr ~]# certbot certonly --manual --preferred-challenges dns -d "*.abcd.com" -d "abcd.com"

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/abcd.com.conf)

It contains these names: abcd.com

You requested these names for the new certificate: *.abcd.com,
abcd.com.

Do you want to expand and replace this existing certificate with the new
certificate?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(E)xpand/(C)ancel: E
Renewing an existing certificate for *.abcd.com and abcd.com
Performing the following challenges:
dns-01 challenge for abcd.com
dns-01 challenge for abcd.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.abcd.com with the following value:

0l5sfzMfdL7gpoQaEbssassdfaIMqWNdf0o4drAZmmQasdfR9Smd

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

위에서 확인된 DNS TXT값을 도메인관리 기관에서 해당 도메인의 TXT값으로 추가해준다.

호스트값 : _acme-challenge 

값 : 0l5sfzMfdL7gpoQaEbssassdfaIMqWNdf0o4drAZmmQasdfR9Smd

 

위 두개 값으로 dns관리에 추가해준다. 추가 dns에 적용이 된 후 이후 작업을 해야 하니,

아래 url에서 dns txt가 적용이 되었는지 확인을 해본다.
https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.domain.com
위 페이지에 접속해 조회할 도메인 정보를 입력하고 TXT 결과값을 확인해본다.
txt 결과값이 나오면 인증서 신청 화면에서 엔터를 치고,

두번째 TXT값을 확인한다.

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.abcd.com with the following value:

8aOhySsbHUSKTsdfnDa9qwOstslSjlewLRjNx10cpsRqqaW

Before continuing, verify the record is deployed.
(This must be set up in addition to the previous challenges; do not remove,
replace, or undo the previous challenge tasks yet. Note that you might be
asked to create multiple distinct TXT records with the same name. This is
permitted by DNS standards.)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue


첫번째 TXT값과 동일한 등록 작업을 하고, dns txt값이 잘 나오는지 확인한 후 에 엔터를 친다.



IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/abcd.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/abcd.com/privkey.pem
   Your certificate will expire on 2024-03-11. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. 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

letsencrypt wildcard 인증서가 모두 생성이 되면 위와 같은 마지막 메세지가 나온다.

여기에서 위에 붉은색 부분을 이제 웹서버의 ssl vhost 설정에 추가해 주면 된다.


SSLCertificateFile /etc/letsencrypt/live/abcd.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/abcd.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/abcd.com/fullchain.pem

 

ssl vhost의 해당 도메인 부분에 위 인증서 정보를 추가해주고, 웹서버를 재시작 해주면 된다.

 

 

Support EFF's Work on Let's Encrypt

Protect digital privacy and free expression. The Electronic Frontier Foundation's public interest legal work, activism, and software development preserve fundamental rights.  EFF is a U.S. 501(c)(3) nonprofit,...

supporters.eff.org