dyndnsd 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +78 -16
- data/lib/dyndnsd.rb +10 -3
- data/lib/dyndnsd/generator/bind.rb +6 -6
- data/lib/dyndnsd/updater/command_with_bind_zone.rb +8 -5
- data/lib/dyndnsd/updater/zone_transfer_server.rb +158 -0
- data/lib/dyndnsd/version.rb +1 -1
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c036941ee751a468f225791fae3b73150db3a8a3e011917e27a9ceb742276c6
|
4
|
+
data.tar.gz: 88217f0be901b27cf7cc018a29c3e5dc56165d4badcecb7d792e36b5f7cbf6fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2fda9af8940e3ce39f0b45e27fd6ac39e9e1168b8bb0fcf38f968bbe61786adb4a073b6da360b62b4f14cafe1b5c08ec8e1b3e66d4fb5a2f51ca6238b5ecd61
|
7
|
+
data.tar.gz: 951ee197de794a9600ab3773f49d71d65a597572dab563af770a2374942c1d4f5fcef4d59fb3ec316990938e28ba6e1244c8c50bf8fc37a5047c5f8452fe9d36
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.3.0 (July 20, 2020)
|
4
|
+
|
5
|
+
IMPROVEMENTS:
|
6
|
+
|
7
|
+
- Allow enabling debug logging
|
8
|
+
- Add updater that uses [DNS zone transfers via AXFR (RFC5936)](https://tools.ietf.org/html/rfc5936) to allow any secondary nameserver(s) to fetch the zone contents after (optionally) receiving a [DNS NOTIFY (RFC1996)](https://tools.ietf.org/html/rfc1996) request
|
9
|
+
|
3
10
|
## 2.2.0 (March 6, 2020)
|
4
11
|
|
5
12
|
IMPROVEMENTS:
|
data/README.md
CHANGED
@@ -4,16 +4,20 @@
|
|
4
4
|
|
5
5
|
A small, lightweight and extensible DynDNS server written with Ruby and Rack.
|
6
6
|
|
7
|
+
|
7
8
|
## Description
|
8
9
|
|
9
|
-
dyndnsd.rb aims to implement a small [DynDNS-compliant](https://help.dyn.com/remote-access-api/) server in Ruby supporting IPv4 and IPv6 addresses. It has an integrated user and hostname database in
|
10
|
+
dyndnsd.rb aims to implement a small [DynDNS-compliant](https://help.dyn.com/remote-access-api/) server in Ruby supporting IPv4 and IPv6 addresses. It has an integrated user and hostname database in its configuration file that is used for authentication and authorization. Besides talking the DynDNS protocol it is able to invoke a so-called *updater*, a small Ruby module that takes care of supplying the current hostname => ip mapping to a DNS server.
|
10
11
|
|
11
|
-
There
|
12
|
+
There are currently two updaters shipped with dyndnsd.rb:
|
13
|
+
- `zone_transfer_server` that uses [DNS zone transfers via AXFR (RFC5936)](https://tools.ietf.org/html/rfc5936) to allow any secondary nameserver(s) to fetch the zone contents after (optionally) receiving a [DNS NOTIFY (RFC1996)](https://tools.ietf.org/html/rfc1996) request
|
14
|
+
- `command_with_bind_zone` that writes out a zone file in BIND syntax onto the current system and invokes a user-supplied command afterwards that is assumed to trigger the DNS server (not necessarily BIND since its zone files are read by other DNS servers, too) to reload its zone configuration
|
12
15
|
|
13
16
|
Because of the mechanisms used, dyndnsd.rb is known to work only on \*nix systems.
|
14
17
|
|
15
18
|
See the [changelog](CHANGELOG.md) before upgrading. The older version 1.x of dyndnsd.rb is still available on [branch dyndnsd-1.x](https://github.com/cmur2/dyndnsd/tree/dyndnsd-1.x).
|
16
19
|
|
20
|
+
|
17
21
|
## General Usage
|
18
22
|
|
19
23
|
Install the gem:
|
@@ -25,14 +29,16 @@ Create a configuration file in YAML format somewhere:
|
|
25
29
|
```yaml
|
26
30
|
# listen address and port
|
27
31
|
host: "0.0.0.0"
|
28
|
-
port:
|
29
|
-
# optional: drop
|
32
|
+
port: 80
|
33
|
+
# optional: drop privileges in case you want to but you may need sudo for external commands
|
30
34
|
user: "nobody"
|
31
35
|
group: "nogroup"
|
32
|
-
# logfile is optional, logs to STDOUT
|
36
|
+
# logfile is optional, logs to STDOUT otherwise
|
33
37
|
logfile: "dyndnsd.log"
|
34
|
-
#
|
38
|
+
# internal database file
|
35
39
|
db: "db.json"
|
40
|
+
# enable debug mode?
|
41
|
+
debug: false
|
36
42
|
# all hostnames are required to be cool-name.example.org
|
37
43
|
domain: "example.org"
|
38
44
|
# configure the updater, here we use command_with_bind_zone, params are updater-specific
|
@@ -60,15 +66,61 @@ Run dyndnsd.rb by:
|
|
60
66
|
|
61
67
|
dyndnsd /path/to/config.yaml
|
62
68
|
|
63
|
-
## Using dyndnsd.rb with [NSD](https://www.nlnetlabs.nl/nsd/)
|
64
69
|
|
65
|
-
|
70
|
+
## Using dyndnsd.rb with any nameserver via DNS zone transfers (AXFR)
|
71
|
+
|
72
|
+
By using [DNS zone transfers via AXFR (RFC5936)](https://tools.ietf.org/html/rfc5936) any secondary nameserver can retrieve the DNS zone contents from dyndnsd.rb and serve them to clients.
|
73
|
+
To speedup propagation after changes dyndnsd.rb can issue a [DNS NOTIFY (RFC1996)](https://tools.ietf.org/html/rfc1996) to inform the nameserver that the DNS zone contents changed and should be fetched even before the time indicated in the SOA record is up.
|
74
|
+
Currently dyndnsd.rb does not support any authentication for incoming DNS zone transfer requests so it should be isolated from the internet on these ports.
|
75
|
+
|
76
|
+
This approach has several advantages:
|
77
|
+
- dyndnsd.rb can be used in *hidden primary* fashion isolated from client's DNS traffic and does not need to implement full nameserver features
|
78
|
+
- any existing, production-grade, caching, geo-replicated nameserver setup can be used to pull DNS zone contents from the *hidden primary* dyndnsd.rb and serve it to clients
|
79
|
+
- any nameserver(s) and dyndnsd.rb do not need to be located on the same host
|
80
|
+
|
81
|
+
Example dyndnsd.rb configuration:
|
82
|
+
|
83
|
+
```yaml
|
84
|
+
host: "0.0.0.0"
|
85
|
+
port: 8245 # the DynDNS.com alternative HTTP port
|
86
|
+
db: "/opt/dyndnsd/db.json"
|
87
|
+
domain: "dyn.example.org"
|
88
|
+
updater:
|
89
|
+
name: "zone_transfer_server"
|
90
|
+
params:
|
91
|
+
# endpoint(s) to listen for incoming zone transfer (AXFR) requests, default 0.0.0.0@53
|
92
|
+
server_listens:
|
93
|
+
- 127.0.0.1@5300
|
94
|
+
# where to send DNS NOTIFY request(s) to on zone content change
|
95
|
+
send_notifies:
|
96
|
+
- '127.0.0.1'
|
97
|
+
# TTL for all records in the zone (in seconds)
|
98
|
+
zone_ttl: 300 # 5m
|
99
|
+
# zone's NS record(s) (at least one)
|
100
|
+
zone_nameservers:
|
101
|
+
- "dns.example.org."
|
102
|
+
# info for zone's SOA record
|
103
|
+
zone_email_address: "admin.example.org."
|
104
|
+
# zone's additional A/AAAA records
|
105
|
+
zone_additional_ips:
|
106
|
+
- "127.0.0.1"
|
107
|
+
users:
|
108
|
+
foo:
|
109
|
+
password: "secret"
|
110
|
+
hosts:
|
111
|
+
- foo.example.org
|
112
|
+
```
|
113
|
+
|
114
|
+
|
115
|
+
## Using dyndnsd.rb with [NSD](https://www.nlnetlabs.nl/projects/nsd/about/)
|
66
116
|
|
67
|
-
|
117
|
+
NSD is a nice, open source, authoritative-only, low-memory DNS server that reads BIND-style zone files (and converts them into its own database) and has a simple configuration file.
|
118
|
+
|
119
|
+
A feature NSD is lacking is the [Dynamic DNS update (RFC2136)](https://tools.ietf.org/html/rfc2136) functionality BIND offers but one can fake it using the following dyndnsd.rb configuration:
|
68
120
|
|
69
121
|
```yaml
|
70
122
|
host: "0.0.0.0"
|
71
|
-
port:
|
123
|
+
port: 8245 # the DynDNS.com alternative HTTP port
|
72
124
|
db: "/opt/dyndnsd/db.json"
|
73
125
|
domain: "dyn.example.org"
|
74
126
|
updater:
|
@@ -88,17 +140,20 @@ users:
|
|
88
140
|
foo:
|
89
141
|
password: "secret"
|
90
142
|
hosts:
|
91
|
-
- foo.example.org
|
143
|
+
- foo.example.org
|
92
144
|
```
|
93
145
|
|
94
146
|
Start dyndnsd.rb before NSD to make sure the zone file exists else NSD complains.
|
95
147
|
|
148
|
+
|
96
149
|
## Using dyndnsd.rb with X
|
97
150
|
|
98
151
|
Please provide ideas if you are using dyndnsd.rb with other DNS servers :)
|
99
152
|
|
153
|
+
|
100
154
|
## Advanced topics
|
101
155
|
|
156
|
+
|
102
157
|
### Update URL
|
103
158
|
|
104
159
|
The update URL you want to tell your clients (humans or scripts ^^) consists of the following
|
@@ -111,10 +166,11 @@ where:
|
|
111
166
|
* USER and PASSWORD are needed for HTTP Basic Auth and valid combinations are defined in your config.yaml
|
112
167
|
* DOMAIN should match what you defined in your config.yaml as domain but may be anything else when using a webserver as proxy
|
113
168
|
* PORT depends on your (webserver/proxy) settings
|
114
|
-
* HOSTNAMES is a required list of comma
|
169
|
+
* HOSTNAMES is a required list of comma-separated FQDNs (they all have to end with your config.yaml domain) the user wants to update
|
115
170
|
* MYIP is optional and the HTTP client's IP address will be used if missing
|
116
171
|
* MYIP6 is optional but if present also requires presence of MYIP
|
117
172
|
|
173
|
+
|
118
174
|
### IP address determination
|
119
175
|
|
120
176
|
The following rules apply:
|
@@ -123,23 +179,26 @@ The following rules apply:
|
|
123
179
|
* use any IP address provided via the X-Real-IP header e.g. when used behind HTTP reverse proxy such as nginx, or
|
124
180
|
* use any IP address used by the connecting HTTP client
|
125
181
|
|
126
|
-
If you want to provide an additional IPv6 address as myip6 parameter the myip parameter containing an IPv4 address has to be present, too! No automatism is applied then.
|
182
|
+
If you want to provide an additional IPv6 address as myip6 parameter, the myip parameter containing an IPv4 address has to be present, too! No automatism is applied then.
|
183
|
+
|
127
184
|
|
128
185
|
### SSL, multiple listen ports
|
129
186
|
|
130
187
|
Use a webserver as a proxy to handle SSL and/or multiple listen addresses and ports. DynDNS.com provides HTTP on port 80 and 8245 and HTTPS on port 443.
|
131
188
|
|
189
|
+
|
132
190
|
### Init scripts
|
133
191
|
|
134
192
|
The [Debian 6 init.d script](init.d/debian-6-dyndnsd) assumes that dyndnsd.rb is installed into the system ruby (no RVM support) and the config.yaml is at /opt/dyndnsd/config.yaml. Modify to your needs.
|
135
193
|
|
194
|
+
|
136
195
|
### Monitoring
|
137
196
|
|
138
197
|
For monitoring dyndnsd.rb uses the [metriks](https://github.com/eric/metriks) framework and exposes several metrics like the number of unauthenticated requests, requests that did (not) update a hostname, etc. By default the most important metrics are shown in the [proctitle](https://github.com/eric/metriks#proc-title-reporter) but you can also configure a [Graphite](https://graphiteapp.org/) backend for central monitoring or the [textfile_reporter](https://github.com/prometheus/node_exporter/#textfile-collector) which outputs Graphite-style metrics that are also compatible with Prometheus to a file.
|
139
198
|
|
140
199
|
```yaml
|
141
200
|
host: "0.0.0.0"
|
142
|
-
port:
|
201
|
+
port: 8245 # the DynDNS.com alternative HTTP port
|
143
202
|
db: "/opt/dyndnsd/db.json"
|
144
203
|
domain: "dyn.example.org"
|
145
204
|
# configure the Graphite backend to be used instead of proctitle
|
@@ -172,14 +231,16 @@ users:
|
|
172
231
|
password: "ihavenohosts"
|
173
232
|
```
|
174
233
|
|
234
|
+
|
175
235
|
### Tracing (experimental)
|
176
236
|
|
177
|
-
For tracing dyndnsd.rb is instrumented using the [OpenTracing](http://opentracing.io/) framework and will emit span tracing data for the most important operations happening during the request/response cycle. Using a middleware for Rack allows handling incoming OpenTracing span information properly.
|
237
|
+
For tracing, dyndnsd.rb is instrumented using the [OpenTracing](http://opentracing.io/) framework and will emit span tracing data for the most important operations happening during the request/response cycle. Using a middleware for Rack allows handling incoming OpenTracing span information properly.
|
238
|
+
|
178
239
|
Currently only one OpenTracing-compatible tracer implementation named [CNCF Jaeger](https://github.com/jaegertracing/jaeger) can be configured to use with dyndnsd.rb.
|
179
240
|
|
180
241
|
```yaml
|
181
242
|
host: "0.0.0.0"
|
182
|
-
port:
|
243
|
+
port: 8245 # the DynDNS.com alternative HTTP port
|
183
244
|
db: "/opt/dyndnsd/db.json"
|
184
245
|
domain: "dyn.example.org"
|
185
246
|
# enable and configure tracing using the (currently only) tracer jaeger
|
@@ -210,6 +271,7 @@ users:
|
|
210
271
|
password: "ihavenohosts"
|
211
272
|
```
|
212
273
|
|
274
|
+
|
213
275
|
## License
|
214
276
|
|
215
277
|
dyndnsd.rb is licensed under the Apache License, Version 2.0. See LICENSE for more information.
|
data/lib/dyndnsd.rb
CHANGED
@@ -13,6 +13,7 @@ require 'rack/tracer'
|
|
13
13
|
|
14
14
|
require 'dyndnsd/generator/bind'
|
15
15
|
require 'dyndnsd/updater/command_with_bind_zone'
|
16
|
+
require 'dyndnsd/updater/zone_transfer_server'
|
16
17
|
require 'dyndnsd/responder/dyndns_style'
|
17
18
|
require 'dyndnsd/responder/rest_style'
|
18
19
|
require 'dyndnsd/database'
|
@@ -56,9 +57,9 @@ module Dyndnsd
|
|
56
57
|
@db.load
|
57
58
|
@db['serial'] ||= 1
|
58
59
|
@db['hosts'] ||= {}
|
60
|
+
@updater.update(@db)
|
59
61
|
if @db.changed?
|
60
62
|
@db.save
|
61
|
-
@updater.update(@db)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -193,8 +194,8 @@ module Dyndnsd
|
|
193
194
|
def update_db
|
194
195
|
@db['serial'] += 1
|
195
196
|
Dyndnsd.logger.info "Committing update ##{@db['serial']}"
|
196
|
-
@db.save
|
197
197
|
@updater.update(@db)
|
198
|
+
@db.save
|
198
199
|
Metriks.meter('updates.committed').mark
|
199
200
|
end
|
200
201
|
|
@@ -249,6 +250,7 @@ module Dyndnsd
|
|
249
250
|
|
250
251
|
Dyndnsd.logger.progname = 'dyndnsd'
|
251
252
|
Dyndnsd.logger.formatter = LogFormatter.new
|
253
|
+
Dyndnsd.logger.level = config['debug'] ? Logger::DEBUG : Logger::INFO
|
252
254
|
end
|
253
255
|
|
254
256
|
# @return [void]
|
@@ -313,7 +315,12 @@ module Dyndnsd
|
|
313
315
|
private_class_method def self.setup_rack(config)
|
314
316
|
# configure daemon
|
315
317
|
db = Database.new(config['db'])
|
316
|
-
|
318
|
+
case config.dig('updater', 'name')
|
319
|
+
when 'command_with_bind_zone'
|
320
|
+
updater = Updater::CommandWithBindZone.new(config['domain'], config.dig('updater', 'params'))
|
321
|
+
when 'zone_transfer_server'
|
322
|
+
updater = Updater::ZoneTransferServer.new(config['domain'], config.dig('updater', 'params'))
|
323
|
+
end
|
317
324
|
daemon = Daemon.new(config, db, updater)
|
318
325
|
|
319
326
|
# configure rack
|
@@ -4,13 +4,13 @@ module Dyndnsd
|
|
4
4
|
module Generator
|
5
5
|
class Bind
|
6
6
|
# @param domain [String]
|
7
|
-
# @param
|
8
|
-
def initialize(domain,
|
7
|
+
# @param updater_params [Hash{String => Object}]
|
8
|
+
def initialize(domain, updater_params)
|
9
9
|
@domain = domain
|
10
|
-
@ttl =
|
11
|
-
@dns =
|
12
|
-
@email_addr =
|
13
|
-
@additional_zone_content =
|
10
|
+
@ttl = updater_params['ttl']
|
11
|
+
@dns = updater_params['dns']
|
12
|
+
@email_addr = updater_params['email_addr']
|
13
|
+
@additional_zone_content = updater_params['additional_zone_content']
|
14
14
|
end
|
15
15
|
|
16
16
|
# @param db [Dyndnsd::Database]
|
@@ -4,16 +4,19 @@ module Dyndnsd
|
|
4
4
|
module Updater
|
5
5
|
class CommandWithBindZone
|
6
6
|
# @param domain [String]
|
7
|
-
# @param
|
8
|
-
def initialize(domain,
|
9
|
-
@zone_file =
|
10
|
-
@command =
|
11
|
-
@generator = Generator::Bind.new(domain,
|
7
|
+
# @param updater_params [Hash{String => Object}]
|
8
|
+
def initialize(domain, updater_params)
|
9
|
+
@zone_file = updater_params['zone_file']
|
10
|
+
@command = updater_params['command']
|
11
|
+
@generator = Generator::Bind.new(domain, updater_params)
|
12
12
|
end
|
13
13
|
|
14
14
|
# @param db [Dyndnsd::Database]
|
15
15
|
# @return [void]
|
16
16
|
def update(db)
|
17
|
+
# do not regenerate zone file (assumed to be persistent) if DB did not change
|
18
|
+
return if !db.changed?
|
19
|
+
|
17
20
|
Helper.span('updater_update') do |span|
|
18
21
|
span.set_tag('dyndnsd.updater.name', self.class.name&.split('::')&.last || 'None')
|
19
22
|
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'resolv'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
require 'async/dns'
|
7
|
+
|
8
|
+
module Dyndnsd
|
9
|
+
module Updater
|
10
|
+
class ZoneTransferServer
|
11
|
+
DEFAULT_SERVER_LISTENS = ['0.0.0.0@53'].freeze
|
12
|
+
|
13
|
+
# @param domain [String]
|
14
|
+
# @param updater_params [Hash{String => Object}]
|
15
|
+
def initialize(domain, updater_params)
|
16
|
+
@domain = domain
|
17
|
+
|
18
|
+
@server_listens = self.class.parse_endpoints(updater_params['server_listens'] || DEFAULT_SERVER_LISTENS)
|
19
|
+
@notify_targets = (updater_params['send_notifies'] || []).map { |e| self.class.parse_endpoints([e]) }
|
20
|
+
|
21
|
+
@zone_rr_ttl = updater_params['zone_ttl']
|
22
|
+
@zone_nameservers = updater_params['zone_nameservers'].map { |n| Resolv::DNS::Name.create(n) }
|
23
|
+
@zone_email_address = Resolv::DNS::Name.create(updater_params['zone_email_address'])
|
24
|
+
@zone_additional_ips = updater_params['zone_additional_ips'] || []
|
25
|
+
|
26
|
+
@server = ZoneTransferServerHelper.new(@server_listens, @domain)
|
27
|
+
|
28
|
+
# run Async::DNS server in background thread
|
29
|
+
Thread.new do
|
30
|
+
@server.run
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param db [Dyndnsd::Database]
|
35
|
+
# @return [void]
|
36
|
+
def update(db)
|
37
|
+
Helper.span('updater_update') do |span|
|
38
|
+
span.set_tag('dyndnsd.updater.name', self.class.name&.split('::')&.last || 'None')
|
39
|
+
|
40
|
+
soa_rr = Resolv::DNS::Resource::IN::SOA.new(
|
41
|
+
@zone_nameservers[0], @zone_email_address,
|
42
|
+
db['serial'],
|
43
|
+
10_800, # 3h
|
44
|
+
300, # 5m
|
45
|
+
604_800, # 1w
|
46
|
+
3_600 # 1h
|
47
|
+
)
|
48
|
+
|
49
|
+
default_options = {ttl: @zone_rr_ttl}
|
50
|
+
|
51
|
+
# array containing all resource records for an AXFR request in the right order
|
52
|
+
rrs = []
|
53
|
+
# AXFR responses need to start with zone's SOA RR
|
54
|
+
rrs << [soa_rr, default_options]
|
55
|
+
|
56
|
+
# return RRs for all of the zone's nameservers
|
57
|
+
@zone_nameservers.each do |ns|
|
58
|
+
rrs << [Resolv::DNS::Resource::IN::NS.new(ns), default_options]
|
59
|
+
end
|
60
|
+
|
61
|
+
# return A/AAAA RRs for all additional IPv4s/IPv6s for the domain itself
|
62
|
+
@zone_additional_ips.each do |ip|
|
63
|
+
rrs << [create_addr_rr_for_ip(ip), default_options]
|
64
|
+
end
|
65
|
+
|
66
|
+
# return A/AAAA RRs for the dyndns hostnames
|
67
|
+
db['hosts'].each do |hostname, ips|
|
68
|
+
ips.each do |ip|
|
69
|
+
rrs << [create_addr_rr_for_ip(ip), default_options.merge({name: hostname})]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# AXFR responses need to end with zone's SOA RR again
|
74
|
+
rrs << [soa_rr, default_options]
|
75
|
+
|
76
|
+
# point Async::DNS server thread's variable to this new RR array
|
77
|
+
@server.axfr_rrs = rrs
|
78
|
+
|
79
|
+
# only send DNS NOTIFY if there really was a change
|
80
|
+
if db.changed?
|
81
|
+
send_dns_notify
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# converts into suitable parameter form for Async::DNS::Resolver or Async::DNS::Server
|
87
|
+
#
|
88
|
+
# @param endpoint_list [Array{String}]
|
89
|
+
# @return [Array{Array{Object}}]
|
90
|
+
def self.parse_endpoints(endpoint_list)
|
91
|
+
endpoint_list.map { |addr_string| addr_string.split('@') }
|
92
|
+
.map { |addr_parts| [addr_parts[0], addr_parts[1].to_i || 53] }
|
93
|
+
.map { |addr| [:tcp, :udp].map { |type| [type] + addr } }
|
94
|
+
.flatten(1)
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
# creates correct Resolv::DNS::Resource object for IP address type
|
100
|
+
#
|
101
|
+
# @param ip_string [String]
|
102
|
+
# @return [Resolv::DNS::Resource::IN::A,Resolv::DNS::Resource::IN::AAAA]
|
103
|
+
def create_addr_rr_for_ip(ip_string)
|
104
|
+
ip = IPAddr.new(ip_string).native
|
105
|
+
|
106
|
+
if ip.ipv6?
|
107
|
+
Resolv::DNS::Resource::IN::AAAA.new(ip.to_s)
|
108
|
+
else
|
109
|
+
Resolv::DNS::Resource::IN::A.new(ip.to_s)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# https://tools.ietf.org/html/rfc1996
|
114
|
+
#
|
115
|
+
# @return [void]
|
116
|
+
def send_dns_notify
|
117
|
+
Async::Reactor.run do
|
118
|
+
@notify_targets.each do |notify_target|
|
119
|
+
target = Async::DNS::Resolver.new(notify_target)
|
120
|
+
|
121
|
+
# assemble DNS NOTIFY message
|
122
|
+
request = Resolv::DNS::Message.new(SecureRandom.random_number(2**16))
|
123
|
+
request.opcode = Resolv::DNS::OpCode::Notify
|
124
|
+
request.add_question("#{@domain}.", Resolv::DNS::Resource::IN::SOA)
|
125
|
+
|
126
|
+
_response = target.dispatch_request(request)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
class ZoneTransferServerHelper < Async::DNS::Server
|
133
|
+
attr_accessor :axfr_rrs
|
134
|
+
|
135
|
+
def initialize(endpoints, domain)
|
136
|
+
super(endpoints, logger: Dyndnsd.logger)
|
137
|
+
@domain = domain
|
138
|
+
end
|
139
|
+
|
140
|
+
# @param name [String]
|
141
|
+
# @param resource_class [Resolv::DNS::Resource]
|
142
|
+
# @param transaction [Async::DNS::Transaction]
|
143
|
+
# @return [void]
|
144
|
+
def process(name, resource_class, transaction)
|
145
|
+
if name != @domain || resource_class != Resolv::DNS::Resource::Generic::Type252_Class1
|
146
|
+
transaction.fail!(:NXDomain)
|
147
|
+
return
|
148
|
+
end
|
149
|
+
|
150
|
+
# https://tools.ietf.org/html/rfc5936
|
151
|
+
transaction.append_question!
|
152
|
+
@axfr_rrs.each do |rr|
|
153
|
+
transaction.add([rr[0]], rr[1])
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
data/lib/dyndnsd/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndnsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Nicolai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: async-dns
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: jaeger-client
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +114,14 @@ dependencies:
|
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.7.0
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.7.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rack-test
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +170,14 @@ dependencies:
|
|
156
170
|
requirements:
|
157
171
|
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
173
|
+
version: 0.81.0
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
180
|
+
version: 0.81.0
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: solargraph
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +216,7 @@ files:
|
|
202
216
|
- lib/dyndnsd/responder/rest_style.rb
|
203
217
|
- lib/dyndnsd/textfile_reporter.rb
|
204
218
|
- lib/dyndnsd/updater/command_with_bind_zone.rb
|
219
|
+
- lib/dyndnsd/updater/zone_transfer_server.rb
|
205
220
|
- lib/dyndnsd/version.rb
|
206
221
|
homepage: https://github.com/cmur2/dyndnsd
|
207
222
|
licenses:
|
@@ -225,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
240
|
- !ruby/object:Gem::Version
|
226
241
|
version: '0'
|
227
242
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
243
|
+
rubygems_version: 3.1.2
|
229
244
|
signing_key:
|
230
245
|
specification_version: 4
|
231
246
|
summary: dyndnsd.rb
|