||3 years ago|
|.gitignore||7 years ago|
|.htaccess||7 years ago|
|LICENSE||7 years ago|
|README.md||6 years ago|
|config.cfg.sample||7 years ago|
|index.html||7 years ago|
|screen-inwx-id.png||7 years ago|
|update.api||7 years ago|
|update.php||7 years ago|
|update.sh||3 years ago|
|users.db.sample||7 years ago|
Snap DynDNS Server using INWX domains
Snap DynDNS Server enables you to set up your own simple Dynamic DNS service. It requires you to use domains managed by the registrar InterNetworX (inwx.de) and their API. This server may be simply customised to be able to work with other domain sellers and their specific APIs.
It can set the IP of any existing domain entry, may it be IPv4 or IPv6 (and theoretically all kinds INWX supports). All domains of the clients have to be part of the same INWX account.
The idea of the service is to enable compatibility with as many client devices as possible. So clients only would need to send a GET or POST request to your service which contains their individual user data (which you can create freely) and their desired IP address for their domain.
This server has a client application as counterpart, named Snap DynDNS client. Using the latter, you will be able to retrieve the IP of your computer and send it to this service which in return updates the domain for you.
The installation requires the possibility to execute PHP and Bash files. It also requires curl to be installed. There's no need for a database to be installed as everything is handled by flat text files.
The code has been tested with PHP 5.5, CentOS 7, and Apache 2.2.15. Please be aware to migrate the
.htaccess file if you use other webservers so the sensitive files like
users.db are safe.
Clone the git repository to your server and move them to a public web-accessible folder of your choice. Now rename/copy the files
users.db respectively. Open them in an editor and modify the settings so they match your data.
In this file you have to put your inwx.de username and password. It is needed to login to the API and update the IP of your domain entry.
In this file you can create users which can use your service. Unauthorized requests which do not match any of the content here will not work. Each line matches one existing single domain entry in your INWX account. It is not necessary the DynDNS domain names to be part of the same domain (
example.com), they can also be different ones – they just have to be part of the same INWX account (please tell me if you need this to be improved, it shouldn't be a big deal).
Gather INWX domain ID
Given you own the domain example.com which you can administrate in your INWX account. For each client, you can create a subdomain, in this example
user2.example.com. For INWX, each domain has a unique ID. To find out this ID, you will have to use a tool like Firebug or the in-built web inspector tools by Firefox or Chromium. Use the inspect element feature, hover over the subdomain line in your nameserver/DNS settings (where you can define the IPs, currently on
https://www.inwx.de/de/nameserver2), and in the id attribute of the
<div>-element you should find a string with around 9 numbers. This number is the domain entry's ID. Please see the screenshot for how it should look like.
users.db, type in the domain name (
user1.example.com) and its INWX ID. For username and password, you can freely create one and give to your users. Each request to your service requires the correct domain name, a username and a password. Only if all three match, the IP change request will be executed.
Please feel free to use Snap DynDNS client which is the perfect combination for this server application.
Please note: You cannot define whether it shall be an A, AAAA or whatever record. You would have to do that in the INWX webpanel once, the ID should stay the same.
You can use curl with a POST request:
curl -X POST -d "domain=user1.example.com&user=myuser&pass=mypassword&ip=18.104.22.168" "https://yourdyndnsservice.net/update.php"
You can also use GET requests which is not recommended. The advantage of POST requests is that the request is encrypted via SSL if you use a HTTPS domain. GET requests can be intercepted quite easily which is bad because you send sensitive data. A GET request would look like this
curl -d "domain=user1.example.com&user=myuser&pass=mypassword&ip=22.214.171.124" "https://yourdyndnsservice.net/update.php"
This will send following data to your Snap DynDNS server which is running under the domain
https://yourdyndnsservice.net in this example:
domain=user1.example.com: This is the client's personal DynDNS domain
user=myuser: This is the client's username which you can define freely
pass=mypassword: This is the client's personal password which you can define freely.
ip=126.96.36.199: This is the IP which shall be set to this single domain
In the AVM Fritz!Boxes you can choose a custom DynDNS provider. In order to connect it with your Snap DynDNS server, use following data:
Update-URL: yourdyndnsservice.net/update.php?domain=<domain>&user=<username>&pass=<pass>&ip=<ipaddr> Domainname: user1.example.com Username: myuser Password: mypassword
Be sure to not add an URI scheme like
https://, the device will throw an error. The IP address is set automatically by the device. Note that you can also set your IPv6 address by using
<ip6addr> in the URL.