用于自定义客户端域的 SSL

SSL for custom client domains

我有一个应用程序(托管在 heroku 中),其中客户有一个单独的子域,例如client1.myapp.com, client2.myapp.com 我在这里使用通配符 SSL 证书。

如果客户想要使用他们自己的自定义域,例如CNAME app.client1.com

我如何才能自动为客户端提供 SSL 证书(我猜是使用 Lets Encrypt),而无需他们提供证书以类似于 firebase 等方式上传。为域提供 SSL 证书。

只要 app.client1.com 可以通过 Internet 访问,您就可以自由设置 证书。

如果您的应用程序 运行 在 unix-like 系统上,则 cerbot docs 描述了自动更新的所有步骤。

您基本上必须设置一个 来启动续订命令。 您可以使用命令 crontab -e 编辑 linux 机器中的 cron,并在文件末尾放置如下内容:

0 15 1 * * certbot renew

这将在每个月的第一天 运行 命令并尝试更新您的证书。如果您需要不同的设置,请勾选 crontab.guru

如果您想从自定义脚本调用 cerbot 命令,您可以将此类脚本添加到您的 cronjob(并将输出保存到自定义文件)。

例如:

0 15 1 * * python cert_autorenew.py >> cron.log 2>&1

请记住,如果您想要 app.client1.com 的证书,那么您发送的续订请求必须解析到服务器 app.client1.com。 这就是您向 letsencrypt.

展示对域的控制权的方式

如果您在 Heroku/new 域中托管新应用程序并定向到 Heroku 应用程序,他们会为您处理 SSL 证书,只要您 运行 该应用程序是付费的测功机。您应该将其作为客户的应用程序!

https://devcenter.heroku.com/articles/ssl

Heroku provides free Automated Certificate Management (ACM) for all applications running on paid dynos. With ACM, Heroku automatically provisions and renews SSL certificates for your application. If you prefer to upload your own certificate manually, follow the steps in this article.

您只需在 Heroku 中创建一个应用程序,升级 dyno 并为该应用程序配置自定义域名 (app.client1.com),按照 https://devcenter.heroku.com/articles/custom-domains

中的说明进行操作