Easy DDNS and SSL Certs for Your Domains Under Cloudflare

Cloudflare is a popular DNS and CDN service provider. Being so, it lacks some basic functions like separate API keys for domains. So to mitigate the risk of putting your Global API Key everywhere on untrusted servers, I wrote a simple proxy for Cloudflare API with Rust and Rocket.rs.

Usage is simple: First clone the repo. Install Rust using rustup and compile. Install diesel.rs and setup PostgreSQL. Edit the .env file to provide DB information to the system and diesel setup. And now you are good to go!

Then create a user, a site and give the user privilege:

cargo run --bin new_user

cargo run --bin new_site

cargo run --bin new_priv

And run the web app with:

ROCKET_CFUSER=<CF_EMAIL> ROCKET_CFKEY=<CF_KEY> cargo run

To call the API, simply use curl:

curl --verbose  --header "Content-Type: application/json" \
  --request POST \
  --data '{"user":"<USER>","key":"<API_KEY>","zone":"amayume.net","rec":"py.amayume.net","rectype":"A", "value":"119.44.22.22"}' \
  http://ddns.amayume.net:1337/update

Hope it can be useful for you :)