【问题标题】:Letsencrypt add domain to existing certificate [closed]Letsencrypt将域添加到现有证书[关闭]
【发布时间】:2016-11-13 03:10:53
【问题描述】:

我只是想将域 test.example.com 添加到已存在的 example.com 证书中。如何将域添加到现有证书并替换旧证书?

这几个命令我都试过了

./letsencrypt-auto certonly --cert-path /etc/letsencrypt/archive/example.com --expand -d test.example.com

./letsencrypt-auto certonly -d example.com --expand -d test.example.com

结果:两者都在新文件夹 test.example.com-0001 中创建了一个全新的证书

./letsencrypt-auto certonly --renew-by-default  --expand -d test.example.com

结果:错误文件夹 test.example.com 已存在。

./letsencrypt-auto renew --expand -d orange.fidka.com

结果:错误,我只能在我的证书过期时续订。

【问题讨论】:

标签: ssl ssl-certificate lets-encrypt


【解决方案1】:

您需要指定所有名称,包括已注册的名称。

我最初使用以下命令注册一些证书:

/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ \
--email me@example.com \
--expand -d example.com,www.example.com

...刚才我成功地使用了以下命令来扩展我的注册以包含一个新的子域作为 SAN:

/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ \
--expand -d example.com,www.example.com,click.example.com

来自documentation

--expand "如果现有证书涵盖了所请求名称的某些子集,请始终扩展并用其他名称替换它。"

如果您正在运行 nginx,请不要忘记重新启动服务器以加载新证书。

【讨论】:

  • 命令稍微改成certbot-auto certonly -a webroot ...
  • 独立插件能用吗?
  • 当我使用上述内容时,它会自行创建一个新证书,最后带有 -001
  • 在生产中运行它,扩展似乎不需要任何可见的停机时间。我使用了 certbot-auto
  • @simon-hampel 扩展 SSL 证书时,是否会延长列表中定义的所有域的到期日期。
【解决方案2】:

Ubuntu 上的 Apache,使用 Apache 插件:

sudo certbot certonly --cert-name example.com -d m.example.com,www.m.example.com

上面的命令在Certbot user guide on changing a certificate's domain names中有生动的解释。请注意,更改证书域名的命令也适用于添加新域名。

编辑

如果运行上面的命令给你错误信息

具有当前选定身份验证器的客户端不支持满足 CA 的任何挑战组合。

关注these instructions from the Let's Encrypt Community

【讨论】:

  • 文档中可能提到过,但如果您只是添加到现有域,则需要再次添加现有域 - 否则它将被删除
  • 他们也有 --expand 选项,您最初认为它允许您在保留现有域的同时添加,但它并没有这样做(facepalm)。我真的不喜欢他们的选项或文档。
【解决方案3】:

这就是我注册域名的方式:

sudo letsencrypt --apache -d mydomain.com

然后可以对其他域使用相同的命令并按照说明进行操作:

sudo letsencrypt --apache -d mydomain.com,x.mydomain.com,y.mydomain.com

【讨论】:

  • 我刚刚用./certbot-auto 替换了letsencrypt 并且它有效!命令./certbot-auto --nginx -d domain1.com,domain2.com 询问我是否要扩展现有证书并完成这项工作。
  • 谢谢。它节省了我的时间。我跑./letsencrypt-auto --debug -d new-domain.com -d new-alias.com
【解决方案4】:

您可以通过使用 ./certbot-auto certonly 再次运行 certbot 来替换证书

如果您尝试为现有证书已覆盖的域生成证书,系统将提示您:

-------------------------------------------------------------------------------
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/<domain>.conf)

It contains these names: <domain>

You requested these names for the new certificate: <domain>,
<the domain you want to add to the cert>.

Do you want to expand and replace this existing certificate with the new
certificate?
-------------------------------------------------------------------------------

只需选择Expand 并替换它。

【讨论】:

    【解决方案5】:

    通过使用--cert-name--expand 选项,我能够为一个域和多个子域设置 SSL 证书。

    请参阅https://certbot.eff.org/docs/using.html 的官方 certbot-auto 文档

    例子:

    certbot-auto certonly --cert-name mydomain.com.br \
    --renew-by-default -a webroot -n --expand \
    --webroot-path=/usr/share/nginx/html \
    -d mydomain.com.br \
    -d www.mydomain.com.br \
    -d aaa1.com.br \
    -d aaa2.com.br \
    -d aaa3.com.br
    

    【讨论】:

      【解决方案6】:

      这对我有用

       sudo letsencrypt certonly -a webroot --webroot-path=/var/www/html -d
       domain.com -d www.domain.com
      

      【讨论】:

        猜你喜欢
        • 2017-07-11
        • 1970-01-01
        • 2017-08-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多