You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-30Lines changed: 31 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,57 +7,57 @@
7
7
8
8
PHP DynDNS is a very simple DynDNS service. It allows you to update your DNS server via a simple HTTP request.
9
9
10
-
Authorization is done using HTTP Basic Auth or using the *username* and *password* URL variables.
10
+
Authorization is done using HTTP Basic Auth or using the `username` and `password` URL variables.
11
11
12
-
The full URL looks like *https://dyndns.example.com/?hostname=myhost.example.com* (HTTP Basic Auth) or *https://dyndns.example.com/?hostname=myhost.example.com&username=myuser&password=mypassword* (URL variable auth).
12
+
The full URL looks like `https://dyndns.example.com/?hostname=myhost.example.com` (HTTP Basic Auth) or `https://dyndns.example.com/?hostname=myhost.example.com&username=myuser&password=mypassword` (URL variable auth).
13
13
14
-
You may also specify the IPv4 and IPv6 address using GET variables (myip=your.ipv4.address.here and myipv6=your:ipv6:address:here).
14
+
You may also specify the IPv4 and IPv6 address using GET variables (`myip=your.ipv4.address.here` and `myipv6=your:ipv6:address:here`).
Or use the ready to run Docker image (see section "Installation using Docker")
28
+
Or use the ready to run Docker image (see section [Installation using Docker](#installation-using-docker)).
29
29
30
30
## Installation
31
31
32
32
There are two methods for getting the latest release:
33
33
34
-
* (recommended) Download the [latest release](https://github.com/Programie/PHPDynDNS/releases/latest) and extract it to your web directory from where you want to serve the files (e.g. /var/www/dyndns)
35
-
* Clone this repository to your web directory from where you want to serve the files (e.g. /var/www/dyndns)
34
+
* (recommended) Download the [latest release](https://github.com/Programie/PHPDynDNS/releases/latest) and extract it to your web directory from where you want to serve the files (e.g. `/var/www/dyndns`)
35
+
* Clone this repository to your web directory from where you want to serve the files (e.g. `/var/www/dyndns`)
36
36
37
37
Directly cloning the repository requires you to download the required dependencies using [Composer](https://getcomposer.org): `composer install`
38
38
39
39
Once downloaded, continue with the following steps:
40
40
41
-
* Copy *config.sample.json* to *config.json*
42
-
* Edit config.json to fit your needs (see [Configuration section](#configuration) bellow for details)
41
+
* Copy `config.sample.json` to `config.json`
42
+
* Edit `config.json` to fit your needs (see [Configuration section](#configuration) bellow for details)
43
43
* Configure your DNS server to allow update requests from the webserver (e.g. `allow-update { localhost; }` in bind)
44
44
*[Configure your router](#configure-your-router) to automatically request the URL of your DynDNS service after each reconnect (or create a cronjob with curl/wget).
45
45
46
46
## Installation using Docker
47
47
48
48
PHPDynDNS is also provided as a Docker image. Just pull it from [Docker Hub](https://hub.docker.com/r/programie/phpdyndns).
49
49
50
-
Mount your config.json to */app/config.json*
50
+
Mount your `config.json` to `/app/config.json`
51
51
52
52
Example command to start the container:
53
53
54
-
```
54
+
```bash
55
55
docker run -d --name phpdyndns -p 80:80 -v /path/to/config.json:/app/config.json:ro programie/phpdyndns
56
56
```
57
57
58
58
## Important
59
59
60
-
Make sure the config.json is not readable via HTTP! On Apache this is already done using the *.htaccess* file.
60
+
Make sure the config.json is not readable via HTTP! On Apache this is already done using the `.htaccess` file.
61
61
62
62
## Configuration
63
63
@@ -86,22 +86,22 @@ The configuration is done using JSON stored in the `config.json` file which look
86
86
87
87
### Properties
88
88
89
-
***server**: The DNS server to connect to (default: `localhost`)
90
-
***ttl**: The TTL (time to live) for all DNS entries managed by PHPDynDNS (default: `60`)
91
-
***users**: A map listing all users (the key of each entry is the username)
92
-
***password_hash**: The hashed password of the user (e.g. created with `mkpasswd -m sha-256`)
93
-
***hosts**: A map listing all hosts this user is able to update (the key of each entry is the hostname to update)
94
-
***zone**: The zone which contains this hostname
95
-
***post_process**: A command which should be executed after successfully updating the DNS entry (can contain placeholders, see note below)
89
+
*`server`: The DNS server to connect to (default: `localhost`)
90
+
*`ttl`: The TTL (time to live) for all DNS entries managed by PHPDynDNS (default: `60`)
91
+
*`users`: A map listing all users (the key of each entry is the username)
92
+
*`password_hash`: The hashed password of the user (e.g. created with `mkpasswd -m sha-256`)
93
+
*`hosts`: A map listing all hosts this user is able to update (the key of each entry is the hostname to update)
94
+
*`zone`: The zone which contains this hostname
95
+
*`post_process`: A command which should be executed after successfully updating the DNS entry (can contain placeholders, see note below)
96
96
97
97
### Placeholders for post_process option
98
98
99
99
There are a few placeholders which can be used in the `post_process` option to be replaced on execution.
100
100
101
-
***%username%**: The username
102
-
***%hostname%**: The hostname
103
-
***%ipv4address%**: The new IPv4 address (if available)
104
-
***%ipv6address%**: The new IPv6 address (if available)
101
+
*`%username%`: The username
102
+
*`%hostname%`: The hostname
103
+
*`%ipv4address%`: The new IPv4 address (if available)
104
+
*`%ipv6address%`: The new IPv6 address (if available)
105
105
106
106
## Configure your router
107
107
@@ -120,6 +120,7 @@ Use this variant if your router does not support sending updates to (custom) Dyn
This will update your domain `your.domain.tld` every minute.
124
125
125
126
Replace `your-username`, `your-password` and `your.domain.tld` with your configured username, password and domain.
@@ -128,22 +129,22 @@ Replace `your-username`, `your-password` and `your.domain.tld` with your configu
128
129
129
130
PHP DynDNS can trigger user defined commands after the DynDNS hostname has been updated successfully.
130
131
131
-
A command might be "/opt/reload-iptables.sh" which automatically reloads iptables using the new IP-Address of the DynDNS hostname.
132
+
A command might be `/opt/reload-iptables.sh` which automatically reloads iptables using the new IP-Address of the DynDNS hostname.
132
133
133
-
The postprocessing command can be individually configured for each user in the config.json.
134
+
The post-processing command can be individually configured for each user in the `config.json`.
134
135
135
136
### Example: Dynamic firewall using iptables
136
137
137
138
PHP DynDNS can execute commands after the hostname has been updated successfully. And such a command might reload your iptables rules from a file which also forces iptables to re-lookup your dynamic hostname.
138
139
139
-
The postprocessing script might look like the following:
140
+
The post-processing script might look like the following:
The `iptables.rules` might look like the following:
147
148
148
149
```
149
150
*filter
@@ -172,4 +173,4 @@ The iptables.rules might look like the following:
172
173
COMMIT
173
174
```
174
175
175
-
**Note:** You have to call the script with root permissions (e.g. sudo)! Simply allow the user running the webserver (e.g. www-data) to execute the script as root (e.g. add *www-data ALL=(ALL) NOPASSWD:/opt/scripts/update_dyndns_iptables.sh* to your /etc/sudoers file).
176
+
**Note:** You have to call the script with root permissions (e.g. sudo)! Simply allow the user running the webserver (e.g. www-data) to execute the script as root (e.g. add `www-data ALL=(ALL) NOPASSWD:/opt/scripts/update_dyndns_iptables.sh` to your `/etc/sudoers` file).
0 commit comments