NPM에서 Wildcard SSL을 자동으로 갱신하는게 안먹네요.
NPM은 자동으로 SSL 인증서가 갱신되지 않는다고 합니다. 그래서 밑의 글 참고하면서 SSL을 자동으로 갱신하도록 하고 있던 도중 오류가 생겨 질문합니다.
https://mans-daily.tistory.com/entry/%EC%8B%9C%EB%86%80%EB%A1%9C%EC%A7%80%EB%A6%AC%EB%88%85%EC%8A%A4Nginx-Proxy-Manager-NPM%EC%9C%BC%EB%A1%9C-%EC%84%A4%EC%A0%95%ED%95%9C-SSL-%EC%9E%90%EB%8F%99-%EA%B0%B1%EC%8B%A0%ED%95%98%EA%B8%B0Feat-crontab
대충 보니 docker exec -it [컨테이너 명] /usr/bin/certbot renew 를 쉘 스크립트로 만든다음 crontab으로 주기적으로 자동 실행하는 것 같더군요.
잘 동작하나 확인하던 중에 오류가 발생해서 확인하던 중 cli로 바로 입력해도 오류가 발생한다는 것을 확인했습니다. 아래는 실행 시 나타나는 오류입니다.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/npm-1.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Renewal configuration file /etc/letsencrypt/renewal/npm-1.conf (cert: npm-1) produced an unexpected error: 'Namespace' object has no attribute 'dns_cloudflare_credentials'. Skipping.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
No renewals were attempted.
Additionally, the following renewal configurations were invalid:
/etc/letsencrypt/renewal/npm-1.conf (parsefail)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 renew failure(s), 1 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.
보니까 CloudFlare의 DNS 챌린지를 사용한게 문제가 된 것 같습니다. 그런데 디렉터리에서 확인해보니 정상적으로 DNS API Token이 있는 것을 확인했습니다. chmod 775로 npm-1.conf와 dns_cloudflare_credentials 관련 파일은 chmod 775로 변경도 해보고 docker-compose에 user: "0:0"으로도 해봤지만 계속 실패하네요.
그래서 추가적으로 컨테이너 내부의 /var/log/letsencrypt/letsencrypt.log를 확인해봤습니다. 저 위의 내용가 크게 다른건 없었습니다. dns_cloudflare_credentials의 객체가 없다.
그래서 dns_cloudflare_credentials를 확인해봤습니다.
dns_cloudflare_api_token = Bb~~~~~
이런식으로 되어있습니다. dns_cloudflare_api_token을 뭔가 바꿔야할 것 같은데 어떻게 해야할지 모르겠습니다.
뭐가 문제일까요?
cmt alert