Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssl Letsencrypt将域添加到现有证书_Ssl_Ssl Certificate_Lets Encrypt - Fatal编程技术网

Ssl Letsencrypt将域添加到现有证书

Ssl Letsencrypt将域添加到现有证书,ssl,ssl-certificate,lets-encrypt,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

我只是想把域
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

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

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

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

/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
从:

--expand“若现有证书包含请求名称的某个子集,请始终展开并用其他名称替换它。”


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

这就是我注册域的方式:

sudo letsencrypt --apache -d mydomain.com
然后可以对其他域使用相同的命令,并按照说明操作:

sudo letsencrypt --apache -d mydomain.com,x.mydomain.com,y.mydomain.com
这对我有用

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

您只需使用
/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?
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
您拥有一个现有证书,该证书包含您所访问的域的一部分
请求(ref:/etc/letsencrypt/renewal/.conf)
它包含以下名称:
您为新证书请求了以下名称:,
.
是否要扩展此现有证书并将其替换为新证书
证明书
-------------------------------------------------------------------------------

只需选择
扩展
并将其替换。

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

请参阅官方certbot自动文档,网址为

例如:

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

Ubuntu上的Apache,使用Apache插件:

sudo certbot certonly --cert-name example.com -d m.example.com,www.m.example.com
上述命令在中得到了生动的解释。请注意,更改证书域名的命令也适用于添加新域名

编辑

如果运行上述命令,将显示错误消息

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


follow

该命令略微更改为
certbot auto certonly-a webroot…
它是否适用于独立插件?当我使用上述命令时,它会自己创建一个新的证书,最后有一个
-001
。在生产环境中运行它,expand似乎不需要任何可见的停机时间。我用了certbot-auto@simon-汉佩尔:当SSL证书被扩展时,它是否会延长列表中定义的所有域的过期日期。我刚刚用
/certbot auto
替换了
letsencrypt
,它就工作了!Command
/certbot auto--nginx-d domain1.com,domain2.com
询问我是否要扩展现有的cert并执行此任务。谢谢。这节省了我的时间。我运行
/letsencrypt auto--debug-d new-domain.com-d new alias.com
,文档中可能会提到它,但如果您只是添加到现有域,则需要再次添加现有域,否则它将被删除此问题已在超级用户上重新打开:对于现在查看此问题的任何人:我建议查看这个它使用了
certbot--expand
,这更接近于这个问题的要求