Last active
August 11, 2024 17:08
-
-
Save syxolk/307a3c02677386bc747577680de74b10 to your computer and use it in GitHub Desktop.
FRITZ!Box DynDNS via Cloudflare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ldap | |
version: "3.1" | |
services: | |
dns-service: | |
image: dns-service | |
networks: | |
- web | |
ports: | |
- "8180:80" | |
deploy: | |
labels: | |
- "traefik.backend=ldap-admin" | |
- "traefik.docker.network=web" | |
- "traefik.enable=true" | |
- "traefik.frontend.rule=Host:127.0.0.1" | |
- "traefik.port=80" | |
restart_policy: | |
condition: on-failure | |
networks: | |
web: | |
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.3.0-apache | |
COPY . /var/www/html/ | |
WORKDIR /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
FRITZ!Box DynDNS Howto: | |
Update-URL: http://your-domain.tld/filename.php?user=<username>&pass=<pass>&hostname=<domain>&myip=<ipaddr> | |
Domainname: dyndns.your-domain.tld | |
Username: your-cloudflare-email-address | |
Password: your-cloudflare-api-token | |
*/ | |
// static config: | |
$cfZoneId = "..."; //put your CloudFlare Zone ID here | |
$cfDnsId = "..."; // put your CloudFlare DNS Identifier here | |
// dynamic config | |
$cfEmail = $_GET['user']; | |
$cfApikey = $_GET['pass']; | |
$updateDomain = $_GET['hostname']; | |
$ipAddr = $_GET['myip']; | |
$cfUrl = "https://api.cloudflare.com/client/v4/zones/".$cfZoneId."/dns_records/".$cfDnsId; | |
$data = array( | |
"type" => "A", | |
"name" => "{$updateDomain}", | |
"content" => "{$ipAddr}", | |
"ttl" => 120, | |
"proxied" => false, | |
); | |
$curl = curl_init($cfUrl); | |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); | |
curl_setopt($curl, CURLOPT_HEADER, false); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json',"X-Auth-Email: $cfEmail","X-Auth-Key: $cfApikey")); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); | |
$response = curl_exec($curl); | |
if (!$response) { | |
die("Connection failure."); | |
}else{ | |
var_dump($response); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment