官方建议一天两次
0 */12 * * * certbot renew --quiet --renew-hook "/etc/init.d/nginx reload"
官方原话
最新发现设置成5天是可以的,通过查看日志文件/var/log/letsencrypt发现,续期命令检测到续期时间小于30天时,会重新请求生成新证书,部分日志文件如下
2017-02-04 04:30:02,138:DEBUG:certbot.main:Root logging level set at 30
2017-02-04 04:30:02,138:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2017-02-04 04:30:02,138:DEBUG:certbot.main:certbot version: 0.9.3
2017-02-04 04:30:02,138:DEBUG:certbot.main:Arguments: ['--quiet', '--renew-hook', '/etc/init.d/nginx reload']
2017-02-04 04:30:02,138:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2017-02-04 04:30:02,150:DEBUG:certbot.storage:Should renew, less than 30 days before certificate expiry 2017-03-06 04:03:00 UTC.
2017-02-04 04:30:02,150:INFO:certbot.renewal:Cert is due for renewal, auto-renewing...
2017-02-04 04:30:02,153:DEBUG:certbot.plugins.selection:Requested authenticator webroot and installer None
2017-02-04 04:30:02,154:DEBUG:certbot.plugins.selection:Single candidate plugin: * webroot
Description: Place files in webroot directory
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot.plugins.webroot:Authenticator
Initialized: <certbot.plugins.webroot.Authenticator object at 0x1fe8c50>
Prep: True
*/1 * * * * echo "$(date)" >>/var/log/datecron.txt
cat /var/log/datecron.txt
cat /var/log/cron #查看crontab日志
crontab -l #查看crontab列表
crontab -e #编辑crontab列表
systemctl status crond.service #查看crontab服务状态
systemctl restart crond.service #重启crontab
[root@centos7 ~]# certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.vvvtimes.com.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal
The following certs are not due for renewal yet:
/etc/letsencrypt/live/www.vvvtimes.com/fullchain.pem (skipped)
No renewals were attempted.
[root@centos7 ~]# cat /var/log/letsencrypt/letsencrypt.log
2016-12-06 00:18:48,448:DEBUG:certbot.main:Root logging level set at 20
2016-12-06 00:18:48,449:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2016-12-06 00:18:48,449:DEBUG:certbot.main:certbot version: 0.9.3
2016-12-06 00:18:48,449:DEBUG:certbot.main:Arguments: []
2016-12-06 00:18:48,449:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2016-12-06 00:18:48,461:INFO:certbot.renewal:Cert not yet due for renewal
2016-12-06 00:18:48,461:DEBUG:certbot.renewal:no renewal failures
certbot revoke --cert-path cert.pem
certbot install --key-path privkey.pem --cert-path cert.pem
certbot renew --renew-hook "/etc/init.d/nginx reload"
发现吊销之后的原来的证书还能用。。。这算什么吊销。。。
cert.pem #公钥
privkey.pem #私钥
chain.pem #中间证书链
fullchain.pem #全证书链