Let's Encrypt 인증서 갱신

random-olive·2023년 1월 26일
0

프로젝트 때 사용했던 도메인에 사용된 인증서는 90일 간격으로 갱신을 해줘야 되어서, 이제
갱신을 해야 한다는 메일이 왔다.

Hello,

Your certificate (or certificates) for the names listed below will expire in 6 days (on 01 Feb 23 07:34 +0000). Please make sure to renew your certificate before then, or visitors to your web site will encounter errors.

We recommend renewing certificates automatically when they have a third of their total lifetime left. For Let's Encrypt's current 90-day certificates, that means renewing 30 days before expiration. See https://letsencrypt.org/docs/integration-guide/ for details.

minimiplace.duckdns.org

...

Regards,
The Let's Encrypt Team

1. CertBot 설치 및 갱신

  • CertBot : Let's Encrypt 인증서를 자동으로 발급, 갱신해주는 봇 프로그램

brew install certbot
sudo certbot renew

🟥 갱신 명령어 후 No renewals were attempted.라는 메시지 발생
- Enter email address에 이메일을 입력하고,
- Please read the Terms of Service at ...
- Would you be willing, once you first certificate is successfully issued, ...
에 각각 Y를 한다.
- Please enter the domain name(s) you would like on your certificate... 에는 도메인 이름을 작성

🟥 Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

-> "httpd.conf" 파일의 "ServerName" 등이 신청한 호스트 이름과 맞지 않는 경우 발생하는 오류.

  • EC2 접속 후 수행해야 하는 듯..
    -> AWS 홈페이지 - EC2 - SSH 클라이언트 연결을 참조 :
    터미널에서 pem key 담겨있는 디렉토리 접근 후 명령어로 인스턴스 연결
(인증서 기한 확인)
certbot certificates
  • 🟥 The following error was encountered:
    [Errno 13] Permission denied: '/var/log/letsencrypt/.certbot.lock'
    Either run as root, or set --config-dir, --work-dir, and --logs-dir to writeable paths.
    해결 링크
(인증서 갱신)
certbot renew
🟥 Cert is due for renewal, auto-renewing...
Could not choose appropriate plugin: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',)
Attempting to renew cert (minimiplace.duckdns.org) from /etc/letsencrypt/renewal/minimiplace.duckdns.org.conf produced an unexpected error: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/minimiplace.duckdns.org/fullchain.pem (failure)

-> 초기 인증서 생성을 manual로 해서 auto renew가 안됨

sudo certbot delete 를 통해 인증서 삭제,
certbot certonly -d 도메인 주소  OR
certbot certonly --standalone -d 도메인주소

🟥 Problem binding to port 80: Could not bind to IPv4 or IPv6.

-> 80번 포트를 어디선가 점유중 -> 끄고 인증서 갱신해야 함

sudo netstat -tnlp  (확인 결과)
80번 포트를 docker proxy가 점유중

해결 링크1
해결 링크2
해결 링크3
해결 링크4


80번 점유 확인 후 :
링크링크/링크텍스트를 실행해볼까 하다가

(링크4) nginx stop + restart 하는 과정에서 혹시나 저번처럼 data 소실될까해서 일단은 인증 만료후 페이지가 보이지 않으면 다시 시행할 계획.

(인증서 추가) certbot certonly -d minimiplace.duckdns.org.
(인증서 갱신) certbot renew
(확인) certbot certificates

참조 :
https://cpuu.postype.com/post/376235
https://okimaru.tistory.com/84
https://n2infotech.co.kr/372

https://happist.com/548924/%EC%9B%8C%EB%93%9C%ED%94%84%EB%A0%88%EC%8A%A4-tips-lets-encrypt-%EB%AC%B4%EB%A3%8C-ssl%EC%9D%B8%EC%A6%9D%EC%84%9C-%EB%B0%9C%EA%B8%89-%EB%B0%8F-%EC%9E%90%EB%8F%99-%EA%B0%B1%EC%8B%A0#3_Lets_Encrypteseo_injeungseo_saengseonghagi

profile
Doubts kills more dreams than failure ever will

0개의 댓글