Skip to content

Commit 3d79441

Browse files
committed
Update readme
1 parent 6c12d66 commit 3d79441

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

README.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,57 @@
77

88
PHP DynDNS is a very simple DynDNS service. It allows you to update your DNS server via a simple HTTP request.
99

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.
1111

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).
1313

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`).
1515

1616
Examples:
1717

18-
* IPv4 only: https://dyndns.example.com/?hostname=myhost.example.com&myip=79.206.99.18
19-
* IPv6 only: https://dyndns.example.com/?hostname=myhost.example.com&myipv6=2003:66:ef5d:9300:5899:991b:8542:b19f
20-
* IPv4 + IPv6: https://dyndns.example.com/?hostname=myhost.example.com&myip=79.206.99.18&myipv6=2003:66:ef5d:9300:5899:991b:8542:b19f
18+
* IPv4 only: `https://dyndns.example.com/?hostname=myhost.example.com&myip=79.206.99.18`
19+
* IPv6 only: `https://dyndns.example.com/?hostname=myhost.example.com&myipv6=2003:66:ef5d:9300:5899:991b:8542:b19f`
20+
* IPv4 + IPv6: `https://dyndns.example.com/?hostname=myhost.example.com&myip=79.206.99.18&myipv6=2003:66:ef5d:9300:5899:991b:8542:b19f`
2121

2222
## Requirements
2323

2424
* A domain
2525
* A web server running PHP 7.2 or newer
2626
* A DNS server (e.g. bind)
2727

28-
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)).
2929

3030
## Installation
3131

3232
There are two methods for getting the latest release:
3333

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`)
3636

3737
Directly cloning the repository requires you to download the required dependencies using [Composer](https://getcomposer.org): `composer install`
3838

3939
Once downloaded, continue with the following steps:
4040

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)
4343
* Configure your DNS server to allow update requests from the webserver (e.g. `allow-update { localhost; }` in bind)
4444
* [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).
4545

4646
## Installation using Docker
4747

4848
PHPDynDNS is also provided as a Docker image. Just pull it from [Docker Hub](https://hub.docker.com/r/programie/phpdyndns).
4949

50-
Mount your config.json to */app/config.json*
50+
Mount your `config.json` to `/app/config.json`
5151

5252
Example command to start the container:
5353

54-
```
54+
```bash
5555
docker run -d --name phpdyndns -p 80:80 -v /path/to/config.json:/app/config.json:ro programie/phpdyndns
5656
```
5757

5858
## Important
5959

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.
6161

6262
## Configuration
6363

@@ -86,22 +86,22 @@ The configuration is done using JSON stored in the `config.json` file which look
8686

8787
### Properties
8888

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)
9696

9797
### Placeholders for post_process option
9898

9999
There are a few placeholders which can be used in the `post_process` option to be replaced on execution.
100100

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)
105105

106106
## Configure your router
107107

@@ -120,6 +120,7 @@ Use this variant if your router does not support sending updates to (custom) Dyn
120120
```
121121
* * * * * curl https://your.domain/path/to/phpdyndns?username=your-username&password=your-password&hostname=your.domain.tld
122122
```
123+
123124
This will update your domain `your.domain.tld` every minute.
124125

125126
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
128129

129130
PHP DynDNS can trigger user defined commands after the DynDNS hostname has been updated successfully.
130131

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.
132133

133-
The post processing 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`.
134135

135136
### Example: Dynamic firewall using iptables
136137

137138
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.
138139

139-
The post processing script might look like the following:
140+
The post-processing script might look like the following:
140141

141142
```sh
142143
#! /bin/sh
143144
/sbin/iptables-restore < /path/to/your/iptables.rules
144145
```
145146

146-
The iptables.rules might look like the following:
147+
The `iptables.rules` might look like the following:
147148

148149
```
149150
*filter
@@ -172,4 +173,4 @@ The iptables.rules might look like the following:
172173
COMMIT
173174
```
174175

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

Comments
 (0)