Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nhymxu/cf-dns-update-python

Dynamic DNS record update utility for CloudFlare DNS service. Python implemented
https://github.com/nhymxu/cf-dns-update-python

cloudflare ddns-client ddns-updater dns dynamic-dns-client dynamic-dns-script dynamic-dns-updater python

Last synced: about 2 months ago
JSON representation

Dynamic DNS record update utility for CloudFlare DNS service. Python implemented

Awesome Lists containing this project

README

        

# cf-dns-update-python
Dynamic DNS record update utility for CloudFlare DNS service. Python implement

### Requirements

- Linux/macOS (tested with macOS 10.15.1 & Ubuntu 18.04)
- Python 3 ( version >= 3.6 is recommended )

### Download & Setup

#### Download
Download code from Release page.

Link here: [https://github.com/nhymxu/cf-dns-update-python/releases/latest](https://github.com/nhymxu/cf-dns-update-python/releases/latest)

Or

clone repo using git:

```shell
git clone [email protected]:nhymxu/cf-dns-update-python.git
```

#### Create CloudFlare Token

1. Go to CloudFlare dash
2. Click open any domain you have
3. Scroll to bottom, you can see **API** section from right column.
4. Click `Get your API token`
5. Click `Create Token`
6. Enter Token name
7. On `Permissions` section. Choose `Zone` - `DNS` - `Edit`
8. On `Zone resource` section. Choose `Include` - `All zone` or specific zone you want.
9. Click `Continue to Summary`
10. Copy token display on page

#### Setup CloudFlare Token

Copy file `config.ini.sample` to current folder with name `config.ini`

Add CloudFlare token to first section like this

```ini
[common]
CF_API_TOKEN = token_key_here
```

#### Setup record to update

1. Look at step **3** on section `Create CloudFlare Token`
2. Copy `Zone ID`
3. Edit like sample

Notes:
- `@` will be same as `base_domain`
- To proxy a record, include it in both `records` and `proxied_records`

### Auto running

I want my script auto running every `x` minutes. So I need set up cronjob for it.

From server shell, typing:

```shell
crontab -e
```

And add this line to end of file

```text
*/15 * * * * /opt/cf-dns-update-python/run.sh
```

This script will run each 15 minutes.

### Service get public IP

If you want custom what service to get public IP, you can config in `config.ini` file

Sample

```ini
[common]
CHECK_IP_SERVICE = xxx
```

where xxx is service name listed below

| Name | Endpoint |
| ---- | -------- |
| amazonaws | https://checkip.amazonaws.com |
| ifconfig.me | https://ifconfig.me/ip |
| icanhazip | https://icanhazip.com/ |
| ipecho | https://ipecho.net/plain |