|
| 1 | +# cfddns (Cloudflare DDNS tool) |
| 2 | +This is a script to use Cloudflare as DDNS. |
| 3 | +This works on Linux only. |
| 4 | + |
| 5 | +## How to use |
| 6 | + |
| 7 | +### 1. Get a Cloudflare Zone ID and a Service key |
| 8 | +Access your Cloudflare dashboard of your domain. |
| 9 | +On "API" section, you can find "Zone ID". |
| 10 | +Next, access [API Tokens page](https://dash.cloudflare.com/profile/api-tokens), and create new API Token. |
| 11 | +You should grant permissions "Zone/DNS/Read" and "Zone/DNS/Edit". |
| 12 | +Also, you should add your domain to "Zone Resources". |
| 13 | +I recommend select "Include/Specific zone/[domain]" because token is saved on the text file. |
| 14 | + |
| 15 | +### 2. Edit configuration file |
| 16 | +The configuration file format is written below. |
| 17 | + |
| 18 | +### 3. Execute cfddns |
| 19 | +You should install Python 3 to execute cfddns. |
| 20 | +You can execute cfddns with command line, but I recommend use systemd. |
| 21 | +The example is written below. |
| 22 | + |
| 23 | +## Configuration file format |
| 24 | +``` |
| 25 | +# cfddns config |
| 26 | +zone_id=[Zone ID] |
| 27 | +service_key=[API Token] |
| 28 | +domains=[a.example.com],[b.example.com] |
| 29 | +ipv6=[yes/no] |
| 30 | +``` |
| 31 | + |
| 32 | +## Example of systemd unit file |
| 33 | +``` |
| 34 | +[Unit] |
| 35 | +Description = Cloudflare DDNS Service |
| 36 | +
|
| 37 | +[Service] |
| 38 | +ExecStart = /usr/local/sbin/cfddns |
| 39 | +Restart = always |
| 40 | +Type = simple |
| 41 | +StandardOutput = journal |
| 42 | +StandardError = journal |
| 43 | +
|
| 44 | +[Install] |
| 45 | +WantedBy = multi-user.target |
| 46 | +``` |
| 47 | + |
| 48 | +## Known issues |
| 49 | +- If domain is not A or AAAA record, cfddns will crash. |
| 50 | +- If record has other records (ex. MX, TXT) as same name, cfddns will crash. |
| 51 | +- Is is not able to set both A and AAAA record. |
| 52 | +- Only one zone can be set. |
| 53 | +- Configuration file format is too strict. |
0 commit comments