#真实案例: [root@ecs-webmanage ~]# certbot certonly --manual --preferred-challenges dns -d *.example.com -d example.com Saving debug log to /var/log/letsencrypt/letsencrypt.log Requesting a certificate for *.example.com and example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please deploy a DNS TXT record under the name:
_acme-challenge.example.com.
with the following value:
lpzeQIa8na7tqaPJGQt-zVS1sv5a0FojFGTPfxepQdw
Before continuing, verify the TXT record has been deployed. Depending on the DNS provider, this may take some time, from a few seconds to multiple minutes. You can check if it has finished deploying with aid of online tools, such as the Google Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.example.com. Look for one or more bolded line(s) below the line ';ANSWER'. It should show the value(s) you've just added.
Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/example.com/privkey.pem This certificate expires on 202x-07-14. These files will be updated when the certificate renews.
NEXT STEPS: - This certificate will not be renewed automatically. Autorenewal of --manual certificates requires the use of an authentication hook script (--manual-auth-hook) but one was not provided. To renew this certificate, repeat this same certbot command before the certificate's expiry date.
#报错 The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping.
可以看到,问题的原因是:An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively. 也就是需要使用--manual-auth-hook参数来指定一个脚本来续签证书。 问题原因 出现这个问题的原因是,第一次申请证书的时候使用的是DNS验证方式,而续签时需要使用脚本来更新DNS记录,如果你想使用脚本来更新的话,可以从github中搜寻相关自动DNS验证脚本,本文将使用另一种方式解决。 问题解决 可以使用standalone命令来解决续签问题,使用该方法的前提是,本机的certbot目录中已存在之前申请过的证书相关资料
certbot certonly --standalone
自动
1 2 3 4 5
# systemctl list-timers NEXT LEFT LAST PASSED UNIT ACTIVATES Tue 202x-04-15 17:20:30 CST 3h 20min left Mon 202x-04-14 17:20:30 CST 20h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service Tue 202x-04-15 18:19:00 CST 4h 18min left n/a n/a snap.certbot.renew.timer snap.certbot.renew.service