mirror of
https://github.com/unifi-utilities/unifios-utilities.git
synced 2024-08-30 18:32:21 +00:00
Add Cloudflare DDNS (#80)
This commit is contained in:
parent
acd0cd5daa
commit
129af44d57
@ -42,6 +42,10 @@ Run NextDNS on your UDM with podman.
|
||||
|
||||
Run AdguardHome on your UDM with podman.
|
||||
|
||||
### Cloudflare DDNS
|
||||
|
||||
Update your cloudflare domains from your UDM with podman.
|
||||
|
||||
## Cool projects you can use with this
|
||||
|
||||
### multicast-relay
|
||||
@ -65,3 +69,4 @@ Provision and renew LetsEncrypt SSL certs from your UDM/P
|
||||
### OpenConnect VPN
|
||||
<https://github.com/shuguet/openconnect-udm>
|
||||
OpenConnect VPN Client for the UniFi Dream Machine Pro (Unofficial)
|
||||
|
||||
|
46
cloudflare-ddns/README.md
Normal file
46
cloudflare-ddns/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Cloudflare Dynamic DNS
|
||||
|
||||
## Features
|
||||
|
||||
- Update Multiple Subdomains
|
||||
- Proxy your traffic through cloudflare
|
||||
- Set a ttl
|
||||
|
||||
Complete feature list and documentation can be found [here](https://github.com/timothymiller/cloudflare-ddns)
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
1. You have successfully setup the on boot script described [here](https://github.com/boostchicken/udm-utilities/tree/master/on-boot-script)
|
||||
2. You must have a cloudflare profile with at least one domain.
|
||||
3. You must have a valid cloudflare api token with correct permissions (see [complete documentation](https://github.com/timothymiller/cloudflare-ddns) for details)
|
||||
|
||||
## Customization
|
||||
|
||||
Update [config.json](configs/config.json) with the following options:
|
||||
- your cloudflare api token
|
||||
- your zone id
|
||||
- each subdomain you'd like to point at your udm-pro
|
||||
- Set the proxied flag if you'd like cloudflare to proxy the records
|
||||
- Set the ttl value you'd like for your records
|
||||
|
||||
## Steps
|
||||
|
||||
2. Make a directory for your configuration
|
||||
|
||||
```sh
|
||||
mkdir -p /mnt/data/cloudflare-ddns
|
||||
```
|
||||
|
||||
3. Create a [cloudflare-ddns configuration](configs/config.json) in `/mnt/data/cloudflare-ddns` and update the configuration to meet your needs.
|
||||
4. Copy [30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh) to `/mnt/data/on_boot.d`.
|
||||
5. Execute /mnt/data/on_boot.d/[30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh)
|
||||
7. Execute `podman logs cloudflare-ddns` to verify the continer is running without error (ipv6 warnings are normal).
|
||||
|
||||
### Useful commands
|
||||
|
||||
```sh
|
||||
# view cloudflare-ddns logs to verify the continer is running without error (ipv6 warnings are normal).
|
||||
podman logs cloudflare-ddns
|
||||
```
|
||||
|
20
cloudflare-ddns/configs/config.json
Normal file
20
cloudflare-ddns/configs/config.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"cloudflare": [
|
||||
{
|
||||
"authentication": {
|
||||
"api_token": "cloudflare_api_token_here",
|
||||
"api_key": {
|
||||
"api_key": "api_key_if_you_don't_have_a_token",
|
||||
"account_email": "your_email_here_if_you_don't_have_a_token"
|
||||
}
|
||||
},
|
||||
"zone_id": "your_zone_id_here",
|
||||
"subdomains": [
|
||||
"each",
|
||||
"subdomain"
|
||||
],
|
||||
"proxied": false,
|
||||
"ttl": 120
|
||||
}
|
||||
]
|
||||
}
|
15
cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh
Normal file
15
cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
CONTAINER=cloudflare-ddns
|
||||
|
||||
# Starts a cloudflare ddns container that is deleted after it is stopped.
|
||||
# All configs stored in /mnt/data/cloudflare-ddns
|
||||
if podman container exists "$CONTAINER"; then
|
||||
podman start "$CONTAINER"
|
||||
else
|
||||
podman run -i -d --rm \
|
||||
--net=host \
|
||||
--name "$CONTAINER" \
|
||||
--security-opt=no-new-privileges \
|
||||
-v /mnt/data/cloudflare-ddns/config.json:/config.json \
|
||||
timothyjmiller/cloudflare-ddns:latest
|
||||
fi
|
Loading…
Reference in New Issue
Block a user