在共享服务器上自动安装 LetsEncrypt 证书

Automating LetsEncrypt Certificate Installation on shared server

是否可以使用一些开源工具或 PHP 以编程方式在共享服务器上安装 LetsEncrypt 证书。目前我正在 windows 机器上使用 "letsencrypt-win-simple" 工具生成证书,W 选项使用 webdav 来验证服务器。证书是在我的 windows 机器上本地生成的,我每个月都必须通过 cpanel 手动配置它。

这个证书安装过程是否有任何可能的自动化?

你应该看看 windows "sheduled tasks"

https://sites.google.com/site/ballif1073/windows/taches-planifiees

命令行示例,不确定它是否正常工作,因为我是从我的 linux 系统上的文档中编写的 :)(每月 运行 任务):

C:\>SCHTASKS /Create /SC MONTHLY /TR C:\path\to\letsencrypt-win-simple.exe

您可以使用 Cpanel 的 API 安装新证书。这是一个 Linux 示例,但 Windows 也存在 curl。不过,您需要更改此脚本中的路径:

domain='example.org'
ledir="/etc/letsencrypt/live/$domain"
cabundle="$ledir/chain.pem"
crt="$ledir/cert.pem"
key="$ledir/privkey.pem"

cpanel_host='cpanel.example.com:2083'
cpanel_user=''

curl -u "$cpanel_user"\
 "$cpanel_host/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SSL&cpanel_jsonapi_func=installssl&cpanel_jsonapi_user=$cpanel_user"\
 -d "domain=$domain" --data-urlencode "cabundle@$cabundle" --data-urlencode "crt@$crt" --data-urlencode "key@$key"

这仍会询问您的密码。但也可以为 Curl 提供密码:curl -u "user:password" ...