Generate Let’s Encrypt Certificate with Route53

Let’s Encrypt 인증서 생성 및 자동 갱신 가이드

Let’s Encrypt 는 3개월 동안 인증이 가능한 인증서를 무료로 생성해주는 기관이자 인증서 이름입니다. 3개월 마다 재 갱신을 해주어야 하는 번거로움이 크기 때문에 대부분의 사용자들은 자동 갱신이 되도록 스크립트를 작성하여 사용합니다. 이 가이드는 acme.sh 를 이용하여 Let’s Encrypt 인증서를 생성하고 자동으로 갱신 되도록 설정하는 방법에 대해서 작성하였습니다.

의존성 패키지 설치

[root@172-16-11-5 /]# yum install -y socat

acme.sh 설치

[root@172-16-11-5 /]# curl https://get.acme.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   705  100   705    0     0    839      0 --:--:-- --:--:-- --:--:--   839
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  166k  100  166k    0     0   389k      0 --:--:-- --:--:-- --:--:--  390k
[Tue Jan  8 17:49:08 KST 2019] Installing from online archive.
[Tue Jan  8 17:49:08 KST 2019] Downloading https://github.com/Neilpang/acme.sh/archive/master.tar.gz
[Tue Jan  8 17:49:10 KST 2019] Extracting master.tar.gz
[Tue Jan  8 17:49:10 KST 2019] Installing to /root/.acme.sh
[Tue Jan  8 17:49:10 KST 2019] Installed to /root/.acme.sh/acme.sh
[Tue Jan  8 17:49:10 KST 2019] Installing alias to '/root/.bashrc'
[Tue Jan  8 17:49:10 KST 2019] OK, Close and reopen your terminal to start using acme.sh
[Tue Jan  8 17:49:10 KST 2019] Installing alias to '/root/.cshrc'
[Tue Jan  8 17:49:10 KST 2019] Installing alias to '/root/.tcshrc'
[Tue Jan  8 17:49:10 KST 2019] Installing cron job
14 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
[Tue Jan  8 17:49:10 KST 2019] Good, bash is found, so change the shebang to use bash as preferred.
[Tue Jan  8 17:49:10 KST 2019] OK
[Tue Jan  8 17:49:10 KST 2019] Install success!

aws access key 추가

[root@172-16-11-5 /]# export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
[root@172-16-11-5 /]# export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY

acme.sh 실행

[root@172-16-11-5 /]# /root/.acme.sh/acme.sh --issue -d umount.net -d *.umount.net --dns dns_aws
[Tue Jan  8 18:36:53 KST 2019] ===Starting cron===
..
..
[Tue Jan  8 18:36:59 KST 2019] ===End cron===

crontab 확인 및 편집

crontab -e
0 0 * * * /root/.acme.sh/acme.sh --cron --home /root/.acme.sh > /dev/null && systemctl restart nginx

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x