跳到正文

Caddy DNS Cloudflare

维护中
caddy-dns/cloudflare

用于通过 Cloudflare 管理 DNS 记录的 Caddy 模块。

在 GitHub 查看
星标
1014
Fork
121
关注
1014
未关闭 Issue
13

该介绍目前仅提供英文版本。

Caddy DNS Cloudflare is a DNS provider module for Caddy that enables automatic DNS record management with Cloudflare. It’s particularly useful for automating SSL certificate management through ACME DNS challenges.

Key Features

  • Automatic DNS record management for Cloudflare
  • Support for ACME DNS challenges
  • Flexible authentication options
  • Secure API token management
  • Easy integration with Caddy server

Configuration Options

This module provides two ways to configure API tokens:

  1. Separate Zone and DNS Tokens

    • Zone Token: Zone.Zone:Read permission for All zones
    • DNS Token: Zone.DNS:Edit permission for specific domains
  2. Single API Token

    • API Token: Zone.Zone:Read and Zone.DNS:Edit permissions for All zones

Quick Start

JSON Configuration

{
    "module": "acme",
    "challenges": {
        "dns": {
            "provider": {
                "name": "cloudflare",
                "api_token": "{env.CF_API_TOKEN}"
            }
        }
    }
}

Caddyfile Configuration

Using Dual Keys

tls {
    dns cloudflare {
        zone_token {env.CF_ZONE_TOKEN}
        api_token {env.CF_API_TOKEN}
    }
}

Using Single Key

tls {
    dns cloudflare {env.CF_API_TOKEN}
}

Troubleshooting

Common Issues

  1. Invalid request headers

    • Ensure your API token is properly set in the environment variables
    • Verify the token has the correct permissions
  2. DNS propagation timeout

    • Check if the _acme-challenge TXT record is created in Cloudflare
    • Consider using Cloudflare’s DNS resolver (1.1.1.1)
    {
        "resolvers": ["1.1.1.1"]
    }

Documentation

For more detailed information, please refer to the Caddy Documentation.

Contributing

Contributions are welcome! Please ensure:

  1. Code follows Go standard formatting
  2. Tests are added for new features
  3. Documentation is updated accordingly

License

This project is licensed under the Apache License 2.0.

按共同分类和标签排序的同类开源项目。

全部 DevOps 项目 →