Letsencrypt将域添加到现有证书

Jef*_*ort 109 ssl ssl-certificate lets-encrypt

我只是简单地尝试将域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
Run Code Online (Sandbox Code Playgroud)

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

./letsencrypt-auto certonly --renew-by-default  --expand -d test.example.com
Run Code Online (Sandbox Code Playgroud)

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

./letsencrypt-auto renew --expand -d orange.fidka.com
Run Code Online (Sandbox Code Playgroud)

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

Sim*_*pel 122

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

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

/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ \
--email me@example.com \
--expand -d example.com,www.example.com
Run Code Online (Sandbox Code Playgroud)

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

/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ \
--expand -d example.com,www.example.com,click.example.com
Run Code Online (Sandbox Code Playgroud)

文档:

--expand"如果现有证书涵盖了所请求名称的某些子集,请始终展开并将其替换为其他名称."

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

  • 命令稍微更改为`certbot-auto certonly -a webroot ...` (2认同)

emb*_*mbe 30

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

sudo letsencrypt --apache -d mydomain.com
Run Code Online (Sandbox Code Playgroud)

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

sudo letsencrypt --apache -d mydomain.com,x.mydomain.com,y.mydomain.com
Run Code Online (Sandbox Code Playgroud)

  • 我刚用`./ certbot-auto`替换了`letsencrypt`,它的确有效!命令`./certbot-auto --nginx -d domain1.com,domain2.com`询问我是否要扩展现有的证书并完成工作. (3认同)

che*_*zeh 26

Ubuntu上的Apache,使用Apache插件:

sudo certbot certonly --cert-name example.com -d m.example.com,www.m.example.com
Run Code Online (Sandbox Code Playgroud)

有关更改证书域名Certbot用户指南中生动地说明了上述命令.请注意,更改证书域名的命令也适用于添加新域名.

编辑

如果运行上面的命令,则会显示错误消息

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

按照Let's Encrypt社区中的这些说明操作

  • 它可能在文档中提到,但如果您只是添加到现有域,则需要再次添加现有域 - 否则它将被删除 (3认同)

Ahm*_*mad 5

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

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

-------------------------------------------------------------------------------
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?
-------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

只需选择Expand并替换它。


new*_*ewx 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
Run Code Online (Sandbox Code Playgroud)