목차
설치
백 포트 리파지토리 활성화 없이 설치한다.
nginx플러그인을 설치한다.
서비스 유닛도 추가된다. (데비안 계열의 경우 /lib/systemd/system/certbot.service, /lib/systemd/system/certbot.timer )
$ sudo apt-get install certbot python-certbot-nginx
certbot.timer에 의해 하루2회 인증서를 자동갱신한다.
설정
nginx설정을 자동화한다.(nginx에 certbot 인증관련 설정을 업데이트한다.)
설치 후 1회 실행한다.
$ sudo certbot --nginx
인증서만 갱신하는 경우 다음 명령을 사용한다.
$ sudo certbot --nginx certonly
화면 출력없이 인증서를 갱신하려면 다음 명령을 사용한다.
$ sudo certbot renew
인증서 보기
$ sudo certbot certificates
에러
와일드카드(*.example.com) 플러그인 에러
에러메시지
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',)
원인
$ certbot-auto renew 명령시 참조하는 설정파일 (/etc/letsencrypt/renewal/xxxxxx.conf)에서
--------------------------------------------------------------------------------
[renewalparams]
authenticator = manual
--------------------------------------------------------------------------------
수동으로 되어 있는 경우는 certbot-auto renew 명령으로 갱신되지 않는다.
해결방법
다음 명령으로 수동으로 실행해줘야 한다.
$ sudo certbot certonly --manual --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory -d *.example.com
명령 수행중에 다음과 같은 메시지가 나오는데,
--------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.example.com with the following value:
--------------------------------------------------------------------------------
DNS레코드를 갱신해 주어야 한다.
DNS레코드는 바로 갱신되지 않으므로 host명령으로 DNS가 갱신되었는지 확인하여야 한다.
갱신완료 메시지
다음과 같은 메시지가 나왔다면 성공적으로 갱신된 것이다.
--------------------------------------------------------------------------------
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
--------------------------------------------------------------------------------