【问题标题】:Failed Let's Encrypt standalone authorization procedureLet's Encrypt 独立授权过程失败
【发布时间】:2018-10-02 09:31:27
【问题描述】:

首先,感谢所有可能会或可能不会尝试帮助我的人。 我的问题:我正在尝试使用 Let's Encrypt 创建一个 ssl 证书。已经安装了文档中提到的所有内容。我决定使用 certbot / 因为它似乎是满足我需求的最简单方法。

我们已经释放了 80 和 443 端口,到达其中一个端口的每个请求都被重定向到我的 Ubuntu 18.04 机器的内部 IP 地址。

这台机器上没有配置,所以在端口 80 或 443 上没有任何监听,正如您在我的 netstat 命令中看到的那样:

tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      895/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1211/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      1211/sshd   

创建证书后,我将运行一个 Spring Boot 应用程序,它应该使用该证书。

据我从文档中了解到,不需要让正在运行的应用程序监听这些端口。应该可以使用独立参数创建证书。所以我猜 certbot 创建了一个小型应用程序,它自己监听其中一个端口,以验证我就是我声称的那个人。对吧?

placeholder.example.com 就像您将假定为占位符一样。我认为在打开端口 80 和 443 时,为什么我不发布我的域名很明显。

root@urlaub:/# certbot certonly --standalone --preferred-challenges http -d placeholder.example.com

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for placeholder.example.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. placeholder.example.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://placeholder.example.com/.well-known/acme-challenge/jCJ4waxV0aYPxjqDI3OcBXXPReNSrse1kd6piK9Dwdo: Connection refused

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: placeholder.example.com
   Type:   connection
   Detail: Fetching
   http://placeholder.example.com/.well-known/acme-challenge/jCJ4waxV0aYPxjqDI3OcBXXPReNSrse1kd6piK9Dwdo:
   Connection refused

   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. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

编辑:我已经尝试了很多次,但都没有成功。现在 /etc/letsencrypt/keys 中有 13 个 .pem 文件 我可以将它们转换为 .p12 文件以在 Spring Boot 应用程序中使用它吗?

【问题讨论】:

  • "placeholder.mydomain.com 是您将假定的占位符。"然后使用placeholder.example.com,因为mydomain.com肯定不是占位符,它是在线存在的。
  • 已编辑。不过不明白使用 placeholder.mydomain.com 有什么奇怪的地方。
  • 简单:你认为mydomain.com今天在互联网上存在并且被某人积极使用吗?如果没有,请仔细检查。如果是,这是您的域名吗?如果不是,想象一下真正的所有者发生了什么。有关所有详细信息,请阅读 RFC 2606:rfc-editor.org/rfc/rfc2606.txt 另一个示例:.MAIL TLD 永远不会真正存在,因为它已被许多文档(ab)使用,这使得它现在无法在不破坏的情况下使用多人配置。
  • “我认为我不公开我的域名的原因很明显”这是默默无闻的安全性(这不起作用):除了使任何人的故障排除变得更加复杂之外,您是否知道域列表名字,特别是.COM 的名字,是公共数据,所以任何人都可以在某个时候找到你的......

标签: spring spring-boot ssl lets-encrypt


【解决方案1】:

重定向到我的服务器机器时出现问题。所以上面使用的命令可以正常工作,我能够创建一个证书。如果有人想使用它:去吧。

我的意图是在 Spring Boot 应用程序中使用它,并且需要一个 pkcs12 文件。我能够使用以下命令将 certbot 创建的 .pem 文件转换为 .p12 文件:

openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -name tomcat -CAfile chain.pem -caname tomcat

在您的 application.properties 中,您必须输入以下内容:

server.port: PORTNUMBER
server.ssl.key-store:/etc/letsencrypt/live/<YOURDOMAIN>/keystore.p12
server.ssl.key-store-password: <PASSWORD YOU WERE PROMPTED WHEN CREATING THE CERTIFICATE>
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: tomcat

【讨论】:

    【解决方案2】:

    如果您使用 HTTP 验证,使用 Let's Encrypt,您将需要一个服务器在端口 80 (HTTP) 上为 placeholder.mydomain.com 提供请求,以便 Let's Encrypt 服务器可以下载文件 .well-known/acme-challenge/jCJ4waxV0aYPxjqDI3OcBXXPReNSrse1kd6piK9Dwdo。这就是 Let's Encrypt 验证您对域具有控制权的方式。注意:该文件名是动态生成的,每次您尝试验证时都会有所不同。

    我使用的另一个选项是使用 DNS 验证,然后在我的 DNS 服务器中创建特殊记录。然后,您可以在桌面上为需要该域名的 SSL 的任何服务创建证书。

    【讨论】:

    • 为什么我需要一个在端口 80 上提供请求的服务器?正如我在帖子中提到的那样,我正在尝试使用 certbot 获得证书。 Cerbot 会自己创建一个小型 http 服务器进行验证,那我为什么需要这样做呢?
    • 报错信息显示80端口上没有运行服务器。
    • 没错。但是,standalone 参数告诉 certbot,机器上没有运行任何 http 服务器或任何应用程序。 Certbot 启动一个小型 http 服务器并在端口 80 上提供服务,并创建一个文件以使 Letencrypt 检查给定域成为可能。如果letsencrypt可以使用域成功连接到机器上并且可以找到文件,则表明我是域所有者,我将获得证书。
    • 报错信息显示80端口上没有运行服务器。
    • 如果有DNS记录重定向http到https:会导致连接被拒绝吗?
    猜你喜欢
    • 2017-07-05
    • 2020-12-31
    • 2018-12-21
    • 2021-11-24
    • 1970-01-01
    • 1970-01-01
    • 2022-06-25
    • 2018-04-23
    • 1970-01-01
    相关资源
    最近更新 更多