[PR #578] [MERGED] Support cloudflare zone api token #985

Closed
opened 2026-03-03 01:07:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/certimate-go/certimate/pull/578
Author: @fudiwei
Created: 3/31/2025
Status: Merged
Merged: 4/3/2025
Merged by: @usual2970

Base: mainHead: feat/providers


📝 Commits (1)

  • 2f7fd95 feat: cloudflare zone api token

📊 Changes

7 files changed (+30 additions, -5 deletions)

View changed files

📝 internal/applicant/providers.go (+1 -0)
📝 internal/domain/access.go (+2 -1)
📝 internal/pkg/core/applicant/acme-dns-01/lego-providers/cloudflare/cloudflare.go (+2 -0)
📝 ui/src/components/access/AccessFormCloudflareConfig.tsx (+14 -0)
📝 ui/src/domain/access.ts (+1 -0)
📝 ui/src/i18n/locales/en/nls.access.json (+5 -2)
📝 ui/src/i18n/locales/zh/nls.access.json (+5 -2)

📄 Description

该 PR 包含以下内容变更:

  • feat: Cloudflare 授权支持双 API 令牌,以满足更低的权限分配(细节见备注)。

备注

Cloudflare 双 API 令牌

出于安全目的和最小权限原则,用户可能希望在 Cloudflare 中为 API 令牌限制为只允许操作特定域(如 #575)。但上游依赖 go-acme/lego 需要遍历全部域,将域名转换为 ZoneID 来进行后续操作,因此必须可访问全部域

此 PR 提供了一个可行方案:

  1. 创建一个具有 ​Zone/DNS/Edit 权限的 API 令牌(即 DNS API Token),将其范围限定为特定域(Specific zone),该令牌只可读写特定域。
  2. 创建另一个具有 ​Zone/Zone/Read 权限的 API 令牌(即 Zone API Token),将其范围限定为所有域(All zones),该令牌虽可访问全部域,但其只读。

新的 DNS API Token 即原先的 API Token;而新的 Zone API Token 是可选的,仅当 DNS API Token 的范围被限定为特定域时需要填写。


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/certimate-go/certimate/pull/578 **Author:** [@fudiwei](https://github.com/fudiwei) **Created:** 3/31/2025 **Status:** ✅ Merged **Merged:** 4/3/2025 **Merged by:** [@usual2970](https://github.com/usual2970) **Base:** `main` ← **Head:** `feat/providers` --- ### 📝 Commits (1) - [`2f7fd95`](https://github.com/certimate-go/certimate/commit/2f7fd95684bb919aec0b1b4c98ad3d10b7c46d6f) feat: cloudflare zone api token ### 📊 Changes **7 files changed** (+30 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `internal/applicant/providers.go` (+1 -0) 📝 `internal/domain/access.go` (+2 -1) 📝 `internal/pkg/core/applicant/acme-dns-01/lego-providers/cloudflare/cloudflare.go` (+2 -0) 📝 `ui/src/components/access/AccessFormCloudflareConfig.tsx` (+14 -0) 📝 `ui/src/domain/access.ts` (+1 -0) 📝 `ui/src/i18n/locales/en/nls.access.json` (+5 -2) 📝 `ui/src/i18n/locales/zh/nls.access.json` (+5 -2) </details> ### 📄 Description 该 PR 包含以下内容变更: - **feat**: Cloudflare 授权支持双 API 令牌,以满足更低的权限分配(细节见备注)。 --- ## 备注 ### Cloudflare 双 API 令牌 出于安全目的和最小权限原则,用户可能希望在 Cloudflare 中为 API 令牌限制为只允许操作**特定域**(如 #575)。但上游依赖 go-acme/lego 需要遍历全部域,将域名转换为 ZoneID 来进行后续操作,因此必须可访问**全部域**。 此 PR 提供了一个可行方案: 1. 创建一个具有 ​`Zone/DNS/Edit` 权限的 API 令牌(即 `DNS API Token`),将其范围限定为特定域(Specific zone),该令牌只可读写特定域。 2. 创建另一个具有 ​`Zone/Zone/Read` 权限的 API 令牌(即 `Zone API Token`),将其范围限定为所有域(All zones),该令牌虽可访问全部域,但其只读。 新的 `DNS API Token` 即原先的 `API Token`;而新的 `Zone API Token` 是可选的,仅当 `DNS API Token` 的范围被限定为特定域时需要填写。 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 01:07:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/certimate#985
No description provided.