LetsEncrypt证书更新失败

我试图更新我的服务器的证书。 目前的一个已经在1个月前过期了,但是到现在为止我还没有照顾过它。

我尝试使用letsencrypt-auto renew命令,但失败了:

注意:我更改了域/用户/服务器名称。

 user@vps:~/letsencrypt# ./letsencrypt-auto renew Updating letsencrypt and virtual environment dependencies....... Running with virtualenv: sudo /home/user/.local/share/letsencrypt/bin/letsencrypt renew Processing /etc/letsencrypt/renewal/www.example.com.conf 2016-04-02 07:07:00,862:WARNING:letsencrypt.cli:Attempting to renew cert from /etc/letsencrypt/renewal/www.example.com.conf produced an unexpected error: You've asked to renew/replace a seemingly valid certificate with a test certificate (domains: www.example.com, example.com). We will not do that unless you use the --break-my-certs flag!. Skipping. All renewal attempts failed. The following certs could not be renewed: /etc/letsencrypt/live/www.example.com/fullchain.pem (failure) 1 renew failure(s), 0 parse failure(s) 

我用--break-my-certs标志愚蠢地尝试了这个命令:

 user@vps:~/letsencrypt# ./letsencrypt-auto renew --break-my-certs Updating letsencrypt and virtual environment dependencies...You are using pip version 7.1.2, however version 8.1.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. .... Running with virtualenv: /root/.local/share/letsencrypt/bin/letsencrypt renew --break-my-certs Processing /etc/letsencrypt/renewal/www.example.com.conf new certificate deployed with reload of apache server; fullchain is /etc/letsencrypt/live/www.example.com/fullchain.pem Congratulations, all renewals succeeded. The following certs have been renewed: /etc/letsencrypt/live/www.example.com/fullchain.pem (success) 

我以为是这样,但当我试图连接到我的网站,我得到一个错误告诉我,证书是由不受信任的一方发出的。 (但是,有效date是确定的。)

所以我再次尝试了第一个命令:

 user@vps:~/letsencrypt# ./letsencrypt-auto renew Updating letsencrypt and virtual environment dependencies....... Running with virtualenv: /root/.local/share/letsencrypt/bin/letsencrypt renew Processing /etc/letsencrypt/renewal/www.example.com.conf The following certs are not due for renewal yet: /etc/letsencrypt/live/www.example.com/fullchain.pem (skipped) No renewals were attempted. 

但是,正如你所看到的,这是行不通的。

请记住,如果使用letsencrypt-auto 0.4.0或更高版本发布以前的证书,使用letsencrypt-auto的续订过程将只能正常工作。 如果您的证书是使用较老的letsencrypt-auto版本发布的,那么您需要以与第一次相同的方式并使用相同的选项和参数重新颁发证书,之后,letsencrypt-auto renew将按预期工作。

无论如何,您尝试续订域名时收到的第一条消息是:

 You've asked to renew/replace a seemingly valid certificate with a test certificate (domains: www.example.com, example.com). We will not do that unless you use the --break-my-certs flag!. Skipping. 

这意味着您的域名拥有有效的证书,但是续订命令检测到您尝试使用登台服务器而不是生产服务器来续签证书(注意:登台服务器是letsencrypt基础架构的一部分,并且允许testing发布的stream程证书为您的域名,但由假CA发行,如果您检查您的证书,您可以看到发行人是Fake LE Intermediate X1 )。

因此,当您重复更新过程,但使用flag --break-my-certs您现在拥有由伪造的CA颁发的证书,连接到您的站点的任何客户端都不会信任。

我想你在/etc/letsencrypt/cli.{conf,ini}configuration了一些conf,/ /etc/letsencrypt/cli.{conf,ini} / /etc/letsencrypt/renewal/yourdomain.conf或者你用来发布第一个证书的任何configuration文件,并且在某些conf中你指定了标志分期,所以letsencrypt-auto正试图使用​​它来更新您的证书,而不是生产。

对你的更新conf文件执行这个命令:

 grep -E 'server\ =|config_file\ =' /etc/letsencrypt/renewal/yourdomain.conf 

注意:如果您为您的域颁发了多个证书,并且您从证书中包含的FQDN子集添加或删除了域,而不是yourdomain.conf ,则可以使用yourdomain-0001.confyourdomain-0002.conf等。

config_file会显示你是否使用你的域的configuration文件,如果你没有使用任何configuration文件,你将看到无字。

服务器将显示您是否针对暂存或生产服务器颁发证书。

如果它正在升级,你会看到这个:

 server = https://acme-staging.api.letsencrypt.org/directory 

如果是生产,你会看到:

 server = https://acme-v01.api.letsencrypt.org/directory 

如果您看到该服务器正指向分段,请为您的域编辑续订configuration文件并将其更改为生产https://acme-v01.api.letsencrypt.org/directory

此外,如果你有一个config_file,你应该检查该configuration文件,以确保服务器选项指向生产,没有select,如暂存,staging = True,test-cert或test-cert = True

一旦你删除了分段选项,并将服务器更改为config_file和更新configuration文件中的产品,你可以尝试再次更新你的证书。

 ./letsencrypt-auto renew --force-renewal 

如果您最终获得了域名的证书,请注意祝贺信息,该信息会告诉您证书的保存位置,请记住configuration您的Web服务器,邮件服务器,以及正确的证书path。

 IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/yourdomain/fullchain.pem. Your cert will expire on xxxx-xx-xx. To obtain a new version of the certificate in the future, simply run Let's Encrypt again. 

我使用最新的certbot来解决与OP相同的问题。 事实certificate,这根本不是certbot的错 – 完美的工作 – 你只需要记住重新启动/重新加载你的networking服务器,所以它拉动更新的证书! 所以,只要LetsEncryptbuild议在你的cron里放置certbot renew --quiet ,记得在几分钟后重新加载一个web服务器,以防nginx /etc/init.d/nginx reload

我有同样的问题,你必须重新启动您的Web服务器(Apache或Nginx的)。
我用certbot renew --quiet来更新。