티스토리 뷰

LiNuX

Let's Encrypt - certbot 명령

freecatz 2021. 10. 27. 15:58

1. 인증서 유효 기간 확인

root@freecatz-web:~# certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: freecatz.pe.kr
    Domains: freecatz.pe.kr zabbix.freecatz.pe.kr
    Expiry Date: 2022-01-18 03:14:40+00:00 (VALID: 82 days)
    Certificate Path: /etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/freecatz.pe.kr/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

 

 

2. 인증서 갱신 테스트

root@freecatz-web:~# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/freecatz.pe.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator nginx, Installer nginx
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for freecatz.pe.kr
http-01 challenge for zabbix.freecatz.pe.kr
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed with reload of nginx server; fullchain is
/etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates below have not been saved.)

Congratulations, all renewals succeeded. The following certs have been renewed:
  /etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

 

 

3. 인증서 갱신

root@freecatz-web:~# certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/freecatz.pe.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not yet due for renewal

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The following certs are not due for renewal yet:
  /etc/letsencrypt/live/freecatz.pe.kr/fullchain.pem expires on 2022-01-18 (skipped)
No renewals were attempted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

* 위의 결과에서는 아직 갱신 기간이 남아서 인증서 갱신을 건너뜀.

 

 

 

4. 인증서 갱신시 옵션 파라메터

파라메터 설명 예제
--pre-hook 인증서 갱신 전에 실행할 명령 # certbot renew --pre-hook="service nginx stop"
--renew-hook 인증서 갱신 후 실행할 명령 # certbot renew --renew-hook="service nginx start"

 

아래과 같이 --pre-hook 과 --renew-hook 둘다 한번에 사용 할 수 있다.

root@freecatz-web:~# certbot renew --pre-hook="service nginx stop" --renew-hook="service nginx start"

 

 

 

 

 

5. crontab 에 등록

root@freecatz-web:~# vi /etc/crontab 
0  0    1 * *   root    /usr/bin/certbot renew --pre-hook="service nginx stop" --renew-hook="service nginx start"

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함