`
* Leave all other fields empty / default
# run as cronjob on a **nix based device
@@ -137,4 +124,4 @@ https://`dyndns.example.com`/update.php?user=`username`&password=`password`&doma
## License
Published under GNU General Public License v3.0
-© Felix Kretschmer, 2021
+Original: © Felix Kretschmer, 2021
diff --git a/data/update.php b/data/update.php
index 24bac06..6f0cac7 100755
--- a/data/update.php
+++ b/data/update.php
@@ -17,4 +17,44 @@ if (!file_exists('.env')) {
$config = parse_ini_file('.env', false, INI_SCANNER_TYPED);
+if (getenv('DDNS_USER') !== false) {
+ $config['username'] = getenv('DDNS_USER');
+}
+if (getenv('DDNS_PASS') !== false) {
+ $config['password'] = getenv('DDNS_PASS');
+}
+if (getenv('NETCUP_APIKEY') !== false) {
+ $config['apiKey'] = getenv('NETCUP_APIKEY');
+}
+if (getenv('NETCUP_APIPASS') !== false) {
+ $config['apiPassword'] = getenv('NETCUP_APIPASS');
+}
+if (getenv('NETCUP_CUSTOMERID') !== false) {
+ $config['customerId'] = getenv('NETCUP_CUSTOMERID');
+}
+if (getenv('DDNS_DEBUG') !== false) {
+ $config['debug'] = getenv('DDNS_DEBUG');
+}
+if (getenv('DDNS_LOG') !== false) {
+ $config['log'] = getenv('DDNS_LOG');
+}
+if (getenv('DDNS_LOGFILE') !== false) {
+ $config['logFile'] = getenv('DDNS_LOGFILE');
+}
+if (getenv('DDNS_RETURNIP') !== false) {
+ $config['returnIp'] = getenv('DDNS_RETURNIP');
+}
+if (getenv('DDNS_ALLOWCREATE') !== false) {
+ $config['allowCreate'] = getenv('DDNS_ALLOWCREATE');
+}
+if (getenv('DDNS_RESTRICTDOMAIN') !== false) {
+ $config['restrictDomain'] = getenv('DDNS_RESTRICTDOMAIN');
+}
+if (getenv('DDNS_FORCEDDOMAIN') !== false) {
+ $config['domain'] = getenv('DDNS_FORCEDDOMAIN');
+}
+if (getenv('DDNS_FORCEDHOST') !== false) {
+ $config['host'] = getenv('DDNS_FORCEDHOST');
+}
+
(new netcup\DNS\API\Handler($config, $_REQUEST))->doRun();
diff --git a/docker-compose.yml b/docker-compose.yml
index 5c3f75f..39616f7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,23 +1,20 @@
-version: "3"
services:
-
- nginx:
- build:
- context: .
- dockerfile: nginx/Dockerfile
+ owndyndns:
+ container_name: dyndns
+ image: niiwiicamo/owndyndns
+ environment:
+ DDNS_USER: changeme
+ DDNS_PASS: changeme
+ NETCUP_APIKEY: 12345asdf
+ NETCUP_APIPASS: asdf12345
+ NETCUP_CUSTOMERID: 01234
+ DDNS_DEBUG: 0 # optional, default: 0
+ DDNS_LOG: 0 # optional, default: 1
+ # DDNS_LOGFILE: log.json # optional, default: log.json
+ DDNS_RETURNIP: 0 # optional, default: 1
+ DDNS_ALLOWCREATE: 1 # optional, default: 0
+ # DDNS_RESTRICTDOMAIN: 0 # optional, default: 0
+ # DDNS_FORCEDDOMAIN: example.net # optional, default empty
+ # DDNS_FORCEDHOST: hostname # optional, default empty
ports:
- - "8180:80"
- volumes:
- - data:/var/www/html
-
- php:
- build:
- context: .
- dockerfile: php/Dockerfile
- depends_on:
- - nginx
- volumes:
- - data:/var/www/html
-
-volumes:
- data:
\ No newline at end of file
+ - 8080:8080
diff --git a/examples/multisite.md b/examples/multisite.md
deleted file mode 100644
index fcbf073..0000000
--- a/examples/multisite.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Multiple Endpoints with separate credentials
-For advanced use you might want to have separate users that can each only update one domain entry.
-
-In that case it might be beneficial to habe multiple endpoints, e.g. `https://dyndns.example.com/endpointN/update.php` where endpointN is any directory name you wish.
-
-## Setting up multiple endpoints
-The directory structure of your webroot might look like this:
-
-├── index.html
-├── src
-│ ├── Config.php
-│ ├── Handler.php
-│ ├── Payload.php
-│ └── Soap.php
-├── fritzbox # this is a subdomain
-│ ├── .env
-│ └── update.php
-├── nas # this is another
-│ ├── .env
-│ └── update.php
-├── examplenet # uses another netcup account
-│ ├── .env
-│ └── update.php
-└── subdomain1 # and another subdomain
- ├── .env
- └── update.php
-
-
-Here the update.php files are copied from the mydomain example directory. All .env files contain different user credentials and may even use different netcup credentials.
-
-## Setting up domain restrictions per .env file
-It is nice to have multiple sets of credentials, but if anyone can update any entry of any domain this defeats the purpose.
-
-That is why you can enable domain restriction per .env file and thereby per set of user credentials.
-
-In these cases you the domain you send in your url will be ignored in favour of the one configured in the .env file. You still need to send a placeholder for validation purposes.
-
-Example .env file for fritzbox.example.com.
-Callable by: `https://dyndns.example.com/fritzbox/update.php?user=fritzbox&password=changeme&domain=placeholder&ipv4=1.2.3.4`
-
-username="fritzbox"
-password="changemeplease"
-apiKey="j1meo213em823jd2q9"
-apiPassword="12345secret"
-customerId="12345"
-debug=false
-log=true
-logFile=/var/log/dnsupdater/fritzbox.json
-restrictDomain=true
-domain=fritzbox.example.com
-
-
-Example .env file for nas.home.example.com.
-Callable by: `https://dyndns.example.com/nas/update.php?user=nas&password=changeme&domain=placeholder&ipv4=1.2.3.4`
-
-username="nas"
-password="changemeplease"
-apiKey="j1meo213em823jd2q9"
-apiPassword="12345secret"
-customerId="12345"
-debug=false
-log=true
-logFile=/var/log/dnsupdater/nas.json
-restrictDomain=true
-domain=example.com # for explicit use of third-level domain
-host=nas.home # we use the optional host parameter
-
\ No newline at end of file
diff --git a/examples/mydomain/.env.dist b/examples/mydomain/.env.dist
deleted file mode 100644
index 9162fbe..0000000
--- a/examples/mydomain/.env.dist
+++ /dev/null
@@ -1,12 +0,0 @@
-username="only-mydomain"
-password="changemeplease"
-apiKey="netcup DNS API Key"
-apiPassword="netcup DNS API Password"
-customerId="netcup customer ID"
-debug=false
-log=true
-logFile=mydomain.json
-returnIp=true
-allowCreate=false
-restrictDomain=true
-domain="mydomain.example.com"
diff --git a/examples/mydomain/update.php b/examples/mydomain/update.php
deleted file mode 100755
index bbb8b8e..0000000
--- a/examples/mydomain/update.php
+++ /dev/null
@@ -1,20 +0,0 @@
-doRun();
diff --git a/examples/nginx-server-block.conf b/examples/nginx-server-block.conf
deleted file mode 100644
index e444040..0000000
--- a/examples/nginx-server-block.conf
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# This assumes you already have the html { block configured
-#
-
-server {
-
- listen 80; # highly recommend to use 443 and ssl, look into using certbot
-
- server_name dyndns.example.com;
- root /var/www/dnydns.example.com;
-
- # if you are using a dedicated site remove everythin except update.php
- # update.php;
- update.php index index.html index.htm index.nginx-debian.html index.php;
-
- # deny all access to any file containing "env", "log" or "json"
- # returns 404 as if file did not exist
- location ~* (env|log|json) {
- deny all;
- return 404;
- }
-
- # deny access to any file .ht* like .htaccess or .htpasswd
- location ~ /\.ht {
- deny all;
- }
-
- # pass PHP scripts to FastCGI server
- location ~ \.php$ {
-
- # FastCGI config, might be in another file that is included
-
- # regex to split $uri to $fastcgi_script_name and $fastcgi_path
- fastcgi_split_path_info ^(.+?\.php)(/.*)$;
-
- # Check that the PHP script exists before passing it
- try_files $fastcgi_script_name =404;
-
- # Bypass the fact that try_files resets $fastcgi_path_info
- # see: http://trac.nginx.org/nginx/ticket/321
- set $path_info $fastcgi_path_info;
- fastcgi_param PATH_INFO $path_info;
-
- fastcgi_index index.php;
- include fastcgi.conf;
-
-
- # With php-fpm (or other unix sockets):
- fastcgi_pass unix:/run/php/php-fpm.sock;
- # With php-cgi (or other tcp sockets):
- # fastcgi_pass 127.0.0.1:9000;
- }
-
-}
\ No newline at end of file
diff --git a/examples/update-dyndns.sh b/examples/update-dyndns.sh
deleted file mode 100755
index de54667..0000000
--- a/examples/update-dyndns.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# you can run this script from **ix bases device to update (different) Records
-
-USER="max_mustermann"
-PASS="s3cr3t"
-DOMAIN="my-home-nas.de"
-#DOMAIN="nas.my-home.de"
-SCRIPT="https:///update.php"
-FORCE=0
-MODE="both" # can be undefined, "@", "*" or "both"
-
-IPV4=$(curl -4 -q v4.ident.me)
-IPV6=$(curl -6 -q v6.ident.me)
-
-echo ${IPV4}
-echo ${IPV6}
-
-# PAYLOAD_IPV4="force=${FORCE}&user=${USER}&password=${PASS}&ipv4=${IPV4}&domain=${DOMAIN}&mode=${MODE}"
-# curl -X POST --data "${PAYLOAD_IPV4}" ${SCRIPT}
-
-# PAYLOAD_IPV6="force=${FORCE}&user=${USER}&password=${PASS}&ipv6=${IPV6}&domain=${DOMAIN}&mode=${MODE"}
-# curl -X POST --data "${PAYLOAD_IPV6}" ${SCRIPT}
-
-PAYLOAD_BOTH="force=${FORCE}&user=${USER}&password=${PASS}&ipv4=${IPV4}&ipv6=${IPV6}&domain=${DOMAIN}&mode=${MODE}"
-curl -X POST --data "${PAYLOAD_BOTH}" ${SCRIPT}
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
deleted file mode 100644
index 7b2361d..0000000
--- a/nginx/Dockerfile
+++ /dev/null
@@ -1,7 +0,0 @@
-FROM nginx:alpine
-RUN mkdir -p /var/www/html/src
-COPY ./nginx/default.conf /etc/nginx/conf.d/
-COPY ./data/src/ /var/www/html/src
-COPY ./data/update.php /var/www/html
-COPY ./data/.env.dist /var/www/html/.env
-VOLUME /var/www/html
diff --git a/nginx/default.conf b/nginx/default.conf
deleted file mode 100644
index 03ad75d..0000000
--- a/nginx/default.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-server {
- listen 0.0.0.0:80;
- root /var/www/html;
- location / {
- return 302 https://github.com/NiiWiiCamo/ownDynDNS;
- }
- location ~ \.php$ {
- include fastcgi_params;
- fastcgi_pass php:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
- }
-}
\ No newline at end of file
diff --git a/php/Dockerfile b/php/Dockerfile
deleted file mode 100644
index 0462875..0000000
--- a/php/Dockerfile
+++ /dev/null
@@ -1,4 +0,0 @@
-FROM php:fpm-alpine
-RUN apk add --no-cache libxml2-dev \
- && docker-php-ext-install soap
-VOLUME /var/www/html
\ No newline at end of file