Skip to content

[Feature] 支持Fastly CDN部署 #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
willow-god opened this issue May 21, 2025 · 4 comments
Open
1 task

[Feature] 支持Fastly CDN部署 #715

willow-god opened this issue May 21, 2025 · 4 comments
Labels
backlog Todo enhancement New feature or request good first issue Good for newcomers

Comments

@willow-god
Copy link

功能描述 / Description

希望可以支持部署Fastly CDN,部署到证书夹中:

Image

请求动机 / Motivation

Fastly CDN是和CloudFlare一样的国外cdn,但是每个月有500GB流量,支持cname接入,优化后国内速度比Cloudflare更快,但是证书仅仅支持2个免费续签证书,后面就需要付费或者自己上传了,希望可以支持Fastly CDN证书的部署。

其他 / Miscellaneous

首先,我不清楚开发者您是否用过Fastly CDN,所以我找了一篇写的比较全面的使用教程供您参考:
https://blog.ihwx.cn/archives/1745499509105

对于API部分,有官网API如下:https://www.fastly.com/documentation/reference/api/tls/platform/

几乎所有的api都在如下地址中提供:https://www.fastly.com/documentation/reference/api/

为了让您能更加方便的查看,我还找到了一个接口文档:https://www.postman.com/fastly/fastly-developer-hub/request/uqqucdq/update-a-certificate

希望能够帮助到作者适配,感谢作者的贡献,很喜欢您的项目!

贡献 / Contribution

  • 我乐意为此贡献代码! / I am interested in contributing to this issue!
@willow-god willow-god added the enhancement New feature or request label May 21, 2025
@fudiwei fudiwei added good first issue Good for newcomers backlog Todo labels May 21, 2025
@fudiwei
Copy link
Collaborator

fudiwei commented May 21, 2025

已经给 Fastly 预留提供商类型很久了,迟迟没动手的原因是它的接口文档我没看明白…… 😂

为了让您能更加方便的查看,我还找到了一个接口文档:https://www.postman.com/fastly/fastly-developer-hub/request/uqqucdq/update-a-certificate

正常来说一个 SSL 证书是包含证书和私钥两部分的,但你贴的这个接口里,它只上传证书,私钥去哪儿了?

@willow-god
Copy link
Author

您好开发者,感谢您的回复和开发,我查阅了一下资料,Fastly的密钥和证书是分开的,首先通过:
https://www.fastly.com/documentation/reference/api/tls/custom-certs/private-keys/
接口上传密钥,成功后,会得到一个密钥ID,然后再凭借这个密钥ID,上传证书,通过:
https://www.fastly.com/documentation/reference/api/tls/custom-certs/certificates/
接口,如果一切正常,则会获得一个certificate_id,然后再凭借这个ID,再找到一个证书和域名的绑定(fastly似乎是将绑定单独了一个页面),部署到某个域名中,完成所有的过程。

Image

控制台上传证书也是这个流程

@fudiwei
Copy link
Collaborator

fudiwei commented May 22, 2025

您好开发者,感谢您的回复和开发,我查阅了一下资料,Fastly的密钥和证书是分开的,首先通过: https://www.fastly.com/documentation/reference/api/tls/custom-certs/private-keys/ 接口上传密钥,成功后,会得到一个密钥ID,然后再凭借这个密钥ID,上传证书,通过: https://www.fastly.com/documentation/reference/api/tls/custom-certs/certificates/ 接口,如果一切正常,则会获得一个certificate_id,然后再凭借这个ID,再找到一个证书和域名的绑定(fastly似乎是将绑定单独了一个页面),部署到某个域名中,完成所有的过程。

可上传证书的接口里并不需要传密钥 ID 😂 我就很好奇它俩咋关联在一起的?难道是 Fastly 分别从证书和私钥里提取出公钥,自动完成关联的?

@willow-god
Copy link
Author

我这边本来尝试写个python脚本测试一下,但是他提示说需要绑定银行卡才能够使用证书这部分的api

{
  "errors": [
    {
      "title": "Can't create resource",
      "detail": "In order to perform this action, your account needs to be upgraded. Please add a credit 
card or reach out to [email protected]"
    }
  ]
}

所以不太清楚了,我搜索chatgpt他是说在请求中添加一个realtionships,如下:

"data": {
            "type": "tls_certificate",
            "attributes": {
                "cert_blob": cert_pem,
                "name": "My Certificate"
            },
            "relationships": {
                "tls_private_key": {
                    "data": {
                        "type": "tls_private_key",
                        "id": private_key_id
                    }
                }
            }
        }

如果您开通了的话可以试试,我这边没有海外信用卡可能没法开呜,无论如何还是感谢开发者啦!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Todo enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants