letsencrypt / certbot升级后失败

时间:2020-03-18 22:51:10

标签: lets-encrypt certbot

我刚收到一封来自Let's Encrypt的电子邮件,内容是:

Beginning June 1, 2020, we will stop allowing new domains to validate using
the ACMEv1 protocol. You should upgrade to an ACMEv2 compatible client before
then, or certificate issuance will fail. For most people, simply upgrading to
the latest version of your existing client will suffice.

我在Debian 9上进行了以下升级:

  • sudo apt-get更新
  • sudo apt-get升级
  • 它继续升级许多软件包,但说certbot被阻止
  • 然后我做了sudo apt-get upgrade certbot
  • 它升级了certbot(以及python3-acme,python3-certbot和python3-certbot-apache)。它还安装了一个新软件包(python3-requests-toolbelt)。
  • 一切似乎都可以正常安装
  • 然后我运行sudo certbot renew --dry-run

在空运行中,我遇到了以下几个错误(由于我不确定是否要在此处发布敏感信息,我已将某些项目删除了):

Attempting to renew cert (mail.example.com) from /etc/letsencrypt/renewal/mail.example.com.conf produced an unexpected error: Failed authorization procedure. mail.example.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mail.example.com/.well-known/acme-challenge/REDACTED_STRING_EXAMPLE [REDACTED HEXADECIMAL ADDRESS]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p". Skipping.

 The following errors were reported by the server:

   Domain: mail.example.com
   Type:   unauthorized
   Detail: Invalid response from
   http://mail.example.com/.well-known/acme-challenge/REDACTED CODE
   [REDACTED HEXADECIMAL ADDRESS]: "<!DOCTYPE HTML PUBLIC
   \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.

是什么原因导致此问题?我的根Web目录中没有.well-known目录。这是我需要添加的新要求吗?如果是这样,我该怎么做才能修复我的certbot,以便我可以正确地更新我的证书?

2 个答案:

答案 0 :(得分:0)

因此,正如我看到的那样,您正在使用Apache,我认为它配置错误,无法正确应对ACME Challenge。

certbot的工作是创建.well-known/acme-challenge/文件夹,然后将其添加到网站(此处为mail.example.com)的Apache配置中。所以我的猜测是:

  • 检查是否在Apache(mail.example.com)中具有/etc/apache2配置。您可以使用诸如apachectl -t -D DUMP_VHOSTS之类的东西来转储当前所有活动的配置。
  • 检查您在Apache中的mail.example.com配置,尤其是:80将要插入代码的certbot部分。

我认为您在这里遇到问题,因为certbot无法使.well-known文件夹可用(通过 HTTP,端口80 )。检查您的配置中的<Directory>标签,以了解Apache将您的流量重定向到何处。

答案 1 :(得分:0)

有时自动验证会失败,尤其是在使用自定义配置的情况下。 如果尚未完成,请签出certbot documentation for HTTP-01 Challenge。重要部分

在使用Webroot插件或手动插件时,请确保 webroot目录存在并且您已正确指定它。如果您设定 将example.com的webroot目录更改为/var/www/example.com,然后将 文件放在 /var/www/example.com/.well-known/acme-challenge/testfile应该出现 在您的网站上 http://example.com/.well-known/acme-challenge/testfile(重定向 到HTTPS是可以的,并且不应阻止挑战。) ...

确保您的Web服务器从该目录正确提供文件 质询文件所在的位置(例如/.well-known/acme-challenge) 到网站上的预期位置,而无需添加标题或 页脚。

This tutorial介绍了如何在apache服务器上允许acme http请求。

简而言之:

为简单起见,您可以将所有针对.well-known / acme-challenge的HTTP请求映射到单个目录/ var / lib / letsencrypt。 因此,您应该预先创建目录。

sudo mkdir -p /var/lib/letsencrypt/.well-known
sudo chgrp www-data /var/lib/letsencrypt
sudo chmod g+s /var/lib/letsencrypt

然后要确保可以访问该文件夹,可以使用以下配置代码段

Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"
<Directory "/var/lib/letsencrypt/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
相关问题