개발노트
목록
Let`s Encrypt 무료 보안서버 인증서 갱신하기 certbot renew
certbotrenew--dry-runcertificates
Server 2024.04.11 49 회 읽음
Server 24.04.11 49



웹 서비스에서 보안 서버 SSL 필수 요건이 되고 있습니다. 운영하는 웹사이트가 안전하지 않다고 표시되는 경우 고객에게 신뢰를 얻을 수 없습니다. 유료 보안 서버를 사용하기 어려운 회사에서는 Let's Encrypt 에서 제공하는 무료 SSL 서비스를 이용할 수 있습니다. 도메인 설정 후 인증서 발급 후 사용하고 나면 만료가 되기 전에 갱신이 필요합니다. 여기에서는 갱신을 위한 명령어와 옵션에 대해서 설명 드리고자 합니다.


인증서 갱신하기 전에 검사하기

검사는 필수는 아니며 사용하지 않는 계정이나 오류가 있는 지와 같은 부분을 체크할 수 있는 명령어 입니다. 아래와 같이 실패 여부를 알려주고 있습니다.

# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/all2k.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for all2k.kr
Failed to renew certificate all2k.kr with error: 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.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/all2korea.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for all2korea.kr
Failed to renew certificate all2korea.kr with error: 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.
All simulated renewals failed. The following certificates could not be renewed:
  /etc/letsencrypt/live/all2k.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/all2korea.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/cgrap.opm.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/chr.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/dutokki.opm.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/e2cast.com/fullchain.pem (failure)
  /etc/letsencrypt/live/e2cast.gtfun.com/fullchain.pem (failure)
  /etc/letsencrypt/live/goodsapp.gtfun.com/fullchain.pem (failure)
  /etc/letsencrypt/live/gtfun.com/fullchain.pem (failure)
  /etc/letsencrypt/live/gtfun.net/fullchain.pem (failure)
  /etc/letsencrypt/live/mininam.opm.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/wagool.net/fullchain.pem (failure)
  /etc/letsencrypt/live/www.all2k.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/www.all2korea.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/www.chr.kr/fullchain.pem (failure)
  /etc/letsencrypt/live/www.e2cast.com/fullchain.pem (failure)
  /etc/letsencrypt/live/www.gtfun.com/fullchain.pem (failure)
  /etc/letsencrypt/live/www.gtfun.net/fullchain.pem (failure)
  /etc/letsencrypt/live/www.wagool.net/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19 renew failure(s), 0 parse failure(s)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.



인증된 인증서 갱신하기

아래 명령어를 통해 아파치에 등록된 도메인에 대한 인증서를 갱신 해 줍니다. 3개월이라는 기간 동안 사용할 수 있는 인증서로 2달이 지난 시점에 미리 해주는 게 좋습니다. 서버 Cron과 같은 스케줄러를 이용하여 자동으로 실행해주면 좋습니다.

# certbot renew

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/img.noteforum.co.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Renewing an existing certificate for img.noteforum.co.kr
Performing the following challenges:
http-01 challenge for img.noteforum.co.kr
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed with reload of apache server; fullchain is
/etc/letsencrypt/live/img.noteforum.co.kr/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/new.noteforum.co.kr.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not yet due for renewal

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following certificates are not due for renewal yet:
  /etc/letsencrypt/live/new.noteforum.co.kr/fullchain.pem expires on 2024-03-05 (skipped)
Congratulations, all renewals succeeded: 
  /etc/letsencrypt/live/img.noteforum.co.kr/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



갱신된 인증서 확인하기

갱신이 완료되었나 명령어를 이용하면 확인할 수 있습니다. 도메인명 + Key Type + Domains + 다음 인증 날짜와 같은 정보를 확인 할 수 있습니다.

# certbot certificates

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: all2k.kr
    Serial Number: 36c052b2552c52ee75ddab770285febd294
    Key Type: RSA
    Domains: all2k.kr
    Expiry Date: 2024-03-02 21:48:51+00:00 (VALID: 60 days)
    Certificate Path: /etc/letsencrypt/live/all2k.kr/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/all2k.kr/privkey.pem



Let`s Encrypt 무료 보안 서버를 개발 서버나 무료로 서비스하고 싶을 때 무료라서 3개월 기한이 있어 주기적으로 업데이트가 필요해서 해당 명령어를 안내 해 드렸습니다. 서버 이전이나 도메인이 종료된 경우에는 삭제가 필요하므로 certbot renew --dry-run 명령어를 통해 주기적으로 계정 상태를 확인하면 좋습니다.

목록