본문 바로가기
Synology/Docker(in Synology)

Docker Let's encrypt발급받자(와일드카드 포함)

by kage2k 2023. 11. 24.
728x90
반응형

아래의 Let’s encrypt 발급받기 전에 아래와 같이 폴더 구조를 만들어 줍니다.

├── docker
   └── letsencrypt
       ├── etc
       └── var

시놀로지 SSH 접속을 시도 하고 Root 권한을 얻습니다.

sudo -i

그리고 아래의 내용에서 “도메인주소” 부분에 본인이 구매한 도메인 주소를 넣어줍니다. 그리고 복사 붙여넣기 해서 발급 작업을 진행합니다.

docker run -it --rm --name certbot -v '/volume1/docker/letsencrypt/etc:/etc/letsencrypt' -v '/volume1/docker/letsencrypt/var:/var/lib/letsencrypt' certbot/certbot certonly -d '도메인주소' -d '*.도메인주소' --manual --preferred-challenges dns --server <https://acme-v02.api.letsencrypt.org/director>

  1. 그러면 아래 메시지가 나타납니다.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
dns-01 challenge for
dns-01 challenge for

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o:

여기서 Y를 선택합니다.

  1. 다음으로 아래 메시지가 나타납니다. (절대로 Enter 진행하시면 안됩니다!! 꼭 읽어보고 진행)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.xxxx.com with the following value:

WB2CdMnTElhYBvCtqcYfhQW7_pkvOyFpEGeokqtx0js

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

터미널은 잠시 그대로 두고, 아래로 진행

시놀로지로 돌아와서 이제 DNS 서버에서 위 DNS TXT를 등록합니다.

  1. DNS 서버 - 도메인 선택하고 마우스 우측 클릭 - 리소스 레코드
  2. 생성 - TXT type
  3. 이름에 _acme-challenge 입력, 정보에 WB2CdMnTElhYBvCtqcYfhQW7_pkvOyFpEGeokqtx0js 입력.
  4. 확인을 눌러서 등록합니다.
  5. 약간의 시간이 지난 후에 다른 ssh 콘솔을 열어서 아래 명령을 입력해봅니다.
dig +short -t txt _acme-challenge.도메인명

위 정보에 입력한 문자열이 나타나는지 확인해서 잘 나타나면 2번에 터미널에서 엔터를 누릅니다.

  1. 다시 아래 메시지가 나타납니다.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.도메인명 with the following value:

WGSzkqRPtrLlpn6sx2Vb-7f-amK8kJQx3NLxQEwYABs

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는 절대 삭제하지 않고 놔둡니다.

5번 명령어로 확인해서 두번째 정보코드도 나타나면 다시 엔터를 누릅니다.

  1. 그러면 아래와 같은 메시지가 나타나고 종료됩니다.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/도메인명/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/도메인명/privkey.pem
   Your cert will expire on 2020-11-21. 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>

  1. 정상적으로 발급 되었다면 아까 만든 폴더에 인증서가 저장되어있습니다. 해당인증서는 3달만 유효합니다. 몇일정도 남기고 꼭 재 인증 받으시기 바랍니다.

 

300x250
반응형