让我们加密失败的DVSNI挑战

时间:2016-01-08 08:09:31

标签: ssl-certificate lets-encrypt

我正在尝试在可公开访问的服务器上配置Let's Encrypt certificates。最初,服务器隐藏在路由器后面,但我已经转发了端口80和443。

证书似乎已完成大部分安装过程,但失败并显示消息:Failed to connect to host for DVSNI challenge

完整堆栈跟踪:

Updating letsencrypt and virtual environment dependencies......
    Requesting root privileges to run with virtualenv: sudo /bin/letsencrypt certonly --standalone -d example.net -d www.example.net
    Failed authorization procedure. example.net (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Failed to connect to host for DVSNI challenge

IMPORTANT NOTES:
 - The following 'urn:acme:error:connection' errors were reported by
   the server:

   Domains: example.net
   Error: The server could not connect to the client to verify the
   domain

非常感谢任何支持!

我环顾四周寻找解决方案而且没有太多运气。大多数其他类似情况通过转发端口443解决,但我确信此端口已经转发并打开,尽管当前没有服务正在运行。

它不应该有所作为,但我正在尝试配置此证书以在Raspberry Pi上与Node JS一起使用。

6 个答案:

答案 0 :(得分:12)

我终于弄清楚发生了什么。我发现--manual标志以交互方式逐步完成身份验证过程。

流程中的每个阶段都会显示类似于以下内容的提示:

Make sure your web server displays the following content at
http://www.example.net/.well-known/acme-challenge/twJCKQm9SbPEapgHpyU5TdAR1ErRaiCyxEB5zhhw0w8 before continuing:

twJCKQm9SbPEapgHpyU5TdAR1ErRaiCyxEB5zhhw0w8.t7J7DDTbktMGCCu2KREoIHv1zwkvwGfJTAkJrnELb4U

If you don't have HTTP server configured, you can run the following
command on the target server (as root):

mkdir -p /tmp/letsencrypt/public_html/.well-known/acme-challenge
cd /tmp/letsencrypt/public_html
printf "%s" twJCKQm9SbPEapgHpyU5TdAR1ErRaiCyxEB5zhhw0w8.t7J7DDTbktMGCCu2KREoIHv1zwkvwGfJTAkJrnELb4U > .well-known/acme-challenge/twJCKQm9SbPEapgHpyU5TdAR1ErRaiCyxEB5zhhw0w8
# run only once per server:
$(command -v python2 || command -v python2.7 || command -v python2.6) -c \
"import BaseHTTPServer, SimpleHTTPServer; \
s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
s.serve_forever()"

Press ENTER to continue

正如我发现的那样,尽管以root身份运行,但该进程没有启动挑战服务器本身的权限。当然,这可能是API中的一个错误。

在提示中运行脚本会直接产生以下错误:

$(command -v python2 || command -v python2.7 || command -v python2.6) -c \
> "import BaseHTTPServer, SimpleHTTPServer; \
> s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
> s.serve_forever()"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 13] Permission denied

但是以root身份运行它(如提示本身所述)正确地启动了服务器,并且可以在外部服务器查询它以完成挑战时对其进行监控:

sudo $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; \
s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
s.serve_forever()"

66.133.109.36 - - [08/Jan/2016 21:25:10] "GET /.well-known/acme-challenge/SZ88SorxBGXBtSZCTn4FX2g7u5XjnPFOOV3f5S5DuXB HTTP/1.1" 200 -
66.133.109.36 - - [08/Jan/2016 21:25:10] "GET /.well-known/acme-challenge/twJCKQm9SbPEapgHpyU5TdAR1ErRaiCyxEB5zhhw0w8 HTTP/1.1" 200 -

此错误需要一段时间才能诊断,因为许多事情可能会阻止挑战失败,并且生成的服务器在后台默默地失败。

答案 1 :(得分:8)

如果您在网站前使用Cloudflare DNS,请记住将DNS A,AAAA记录直接指向您的网站,直到续订完成。

答案 2 :(得分:2)

我通过在我的Ubuntu 14.04计算机上为Apache 2.4禁用IPv6解决了这个问题,因为我的服务器没有真正的IPv6地址。 (https://community.letsencrypt.org/t/how-to-resolve-the-correct-zname-not-found-for-tls-sni-challenge-error-when-i-try-renew-certificate/9405/43上的原帖)

为实现此目的,我在/etc/apache2/ports.conf

中明确设置了IP地址
Listen <IP>:80
Listen <IP>:443

并且在所有vhosts中:

<VirtualHost <IP>:80>

而不是:

<VirtualHost *:80>

完成这些更改后,netstat -lnp | egrep ":443|:80"会在第一列显示tcp而不是tcp6

然后,cerbot renew就像一个魅力。

答案 3 :(得分:2)

我打了几个小时,在我的日志中输出相同的输出。我甚至跟进了本页面上的所有建议。我偶然发现了我的答案。我从另一个webconfig粘贴了一些代码,它已经有一个<virtual host _._._._:443>部分。删除该443部分后,sudo certbot-auto --apache -d example.com运行没有错误,我有一个工作站点。

我只根据我的经验得出结论:确保您只有端口80的虚拟主机。我在阅读的文档中没有提到这个问题,但似乎certbot对于网站可用的配置文件并不好用已包含443个虚拟主机部分。

答案 4 :(得分:1)

我想你们所有人都已经检查了这一点。在续订过程中向我提出了同样的错误。我将流量从443重定向到8443(使用iptables)。解决方案是从iptables中删除条目,停止tomcat,然后执行更新过程就像一个魅力。脚本看起来像这样。

/etc/init.d/tomcat7 stop
iptables -t nat -D PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443

$letsencryptdir/letsencrypt-auto renew --standalone --standalone-supported-challenges tls-sni-01 --renew-by-default --email <my_email> --verbose --text  --agree-tos

iptables -t nat -I PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443
/etc/init.d/tomcat7 start

答案 5 :(得分:0)

尝试时遇到同样的错误:

./letsencrypt-auto --apache  -d example.com -d www.example.com

但它适用于:

./letsencrypt-auto certonly --webroot -w /var/www/html -d example.com -d www.example.com

之后,您需要在apache .conf文件(default-ssl.conf)中更改证书路径并重新启动apache。