mirror of
https://github.com/fernwerker/ownDynDNS.git
synced 2025-07-11 06:38:02 +02:00
updated examples
This commit is contained in:
parent
0de4252b2d
commit
c1833df127
3 changed files with 67 additions and 0 deletions
67
examples/multisite.md
Normal file
67
examples/multisite.md
Normal file
|
@ -0,0 +1,67 @@
|
|||
# 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:
|
||||
<pre>
|
||||
├── 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
|
||||
</pre>
|
||||
|
||||
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. <b>You still need to send a placeholder for validation purposes.</b>
|
||||
|
||||
Example .env file for fritzbox.example.com.<br>
|
||||
Callable by: `https://dyndns.example.com/fritzbox/update.php?user=fritzbox&password=changeme&domain=placeholder&ipv4=1.2.3.4`
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
Example .env file for nas.home.example.com.<br>
|
||||
Callable by: `https://dyndns.example.com/nas/update.php?user=nas&password=changeme&domain=placeholder&ipv4=1.2.3.4`
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
12
examples/mydomain/.env.dist
Normal file
12
examples/mydomain/.env.dist
Normal file
|
@ -0,0 +1,12 @@
|
|||
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"
|
20
examples/mydomain/update.php
Executable file
20
examples/mydomain/update.php
Executable file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('html_errors', 0);
|
||||
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
|
||||
require_once __DIR__ . '/../src/Soap.php';
|
||||
require_once __DIR__ . '/../src/Config.php';
|
||||
require_once __DIR__ . '/../src/Payload.php';
|
||||
require_once __DIR__ . '/../src/Handler.php';
|
||||
|
||||
if (!file_exists('.env')) {
|
||||
throw new RuntimeException('.env file missing');
|
||||
}
|
||||
|
||||
$config = parse_ini_file('.env', false, INI_SCANNER_TYPED);
|
||||
|
||||
(new netcup\DNS\API\Handler($config, $_REQUEST))->doRun();
|
Loading…
Add table
Add a link
Reference in a new issue