nixos/services/cloudflare-ddns.md

24 lines
769 B
Markdown
Raw Normal View History

## Store your API key securely
2026-02-15 06:24:20 +00:00
Create a file outside your /etc/nixos directory to store your Cloudflare API token:
```bash
sudo mkdir -p /var/secrets
2026-02-15 06:24:20 +00:00
sudo nano /var/secrets/cloudflare-token
sudo chmod 600 /var/secrets/cloudflare-token
2026-02-15 06:24:20 +00:00
sudo chown root:root /var/secrets/cloudflare-token
```
This token is shared by both `cloudflare-ddns.nix` (DDNS updates) and `nginx.nix` (ACME wildcard cert via DNS-01 challenge).
## Get your Cloudflare API Token
Go to Cloudflare Dashboard → My Profile → API Tokens and create a token with:
2026-02-15 06:24:20 +00:00
- **Zone : Zone : Read**
- **Zone : DNS : Edit**
2026-02-15 06:24:20 +00:00
Both permissions are required — Zone:Read for ACME to locate the zone, DNS:Edit for DDNS updates and ACME challenge TXT records.
2026-02-15 06:24:20 +00:00
Copy the token to `/var/secrets/cloudflare-token`.