Change README.md
This commit is contained in:
66
README.md
66
README.md
@@ -198,6 +198,7 @@ notify_change = []
|
||||
| ipv6 (IPv6 address) | myip6, ipv6, ip6 |
|
||||
| username | username, user |
|
||||
| password | password, pass, token |
|
||||
| notify_change | notify_change |
|
||||
|
||||
## CLI Usage
|
||||
|
||||
@@ -280,7 +281,7 @@ ddns-service --daemon --debug
|
||||
### Request
|
||||
|
||||
```
|
||||
GET /update?hostname=mypc.dyn.example.com[&myip=1.2.3.4][&myip6=2001:db8::1]
|
||||
GET /update?hostname=mypc.dyn.example.com[&myip=1.2.3.4][&myip6=2001:db8::1][¬ify_change=1]
|
||||
Authorization: Basic base64(username:password)
|
||||
```
|
||||
|
||||
@@ -289,6 +290,8 @@ Authentication can also be provided as query parameters:
|
||||
GET /update?hostname=mypc.dyn.example.com&username=myuser&password=secret
|
||||
```
|
||||
|
||||
Set `notify_change=1` to receive an email notification when the IP address changes. Requires email to be enabled and a change notification template configured.
|
||||
|
||||
### IP Detection
|
||||
|
||||
- If `myip` and/or `myip6` provided: use those values
|
||||
@@ -324,6 +327,11 @@ With explicit IP:
|
||||
curl -u "username:password" "https://ddns.example.com/update?hostname=mypc.dyn.example.com&myip=1.2.3.4"
|
||||
```
|
||||
|
||||
With change notification:
|
||||
```bash
|
||||
curl -u "username:password" "https://ddns.example.com/update?hostname=mypc.dyn.example.com¬ify_change=1"
|
||||
```
|
||||
|
||||
### wget
|
||||
|
||||
```bash
|
||||
@@ -352,9 +360,63 @@ Set `expiry_ttl = 0` to disable expiration entirely for a hostname.
|
||||
|
||||
When a hostname expires:
|
||||
1. DNS records (A and/or AAAA) are deleted
|
||||
2. Email notification is sent to the user
|
||||
2. Email notification is sent to the user (if configured)
|
||||
3. Records can be restored by sending a new update request
|
||||
|
||||
## Email Notifications
|
||||
|
||||
Two types of email notifications are supported:
|
||||
|
||||
- **Change notifications**: Sent when IP address changes, if client includes `notify_change=1` parameter
|
||||
- **Expiry notifications**: Sent automatically when hostname expires due to inactivity
|
||||
|
||||
### Configuration
|
||||
|
||||
Enable email and configure templates in `[email]` section:
|
||||
|
||||
```toml
|
||||
[email]
|
||||
enabled = true
|
||||
smtp_host = "localhost"
|
||||
from_address = "ddns@example.com"
|
||||
change_notification_template = "/etc/ddns-service/change_notification.j2"
|
||||
expiry_notification_template = "/etc/ddns-service/expiry_notification.j2"
|
||||
```
|
||||
|
||||
Example templates are provided in the `files/` directory.
|
||||
|
||||
### Template Variables
|
||||
|
||||
Templates use Jinja2 syntax. Available variables:
|
||||
|
||||
**Change notification:**
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| hostname | Hostname (without zone) |
|
||||
| zone | DNS zone |
|
||||
| fqdn | FQDN (hostname.zone) |
|
||||
| ipv4_changed | Boolean, IPv4 changed |
|
||||
| ipv4 | Current IPv4 address |
|
||||
| last_ipv4_update | Last IPv4 update time |
|
||||
| ipv6_changed | Boolean, IPv6 changed |
|
||||
| ipv6 | Current IPv6 address |
|
||||
| last_ipv6_update | Last IPv6 update time |
|
||||
| expiry_ttl | Expiry TTL in seconds |
|
||||
|
||||
**Expiry notification:**
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| hostname | Hostname (without zone) |
|
||||
| zone | DNS zone |
|
||||
| fqdn | FQDN (hostname.zone) |
|
||||
| ipv4_expired | Boolean, IPv4 expired |
|
||||
| last_ipv4 | Last IPv4 address |
|
||||
| last_ipv4_update | Last IPv4 update time |
|
||||
| ipv6_expired | Boolean, IPv6 expired |
|
||||
| last_ipv6 | Last IPv6 address |
|
||||
| last_ipv6_update | Last IPv6 update time |
|
||||
| expiry_ttl | Expiry TTL in seconds |
|
||||
|
||||
## Logging
|
||||
|
||||
The daemon supports stdout, syslog, and file logging targets.
|
||||
|
||||
Reference in New Issue
Block a user