dyndnsd 3.0.0 → 3.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +40 -3
- data/lib/dyndnsd.rb +8 -7
- data/lib/dyndnsd/generator/bind.rb +1 -1
- data/lib/dyndnsd/responder/dyndns_style.rb +7 -7
- data/lib/dyndnsd/responder/rest_style.rb +7 -7
- data/lib/dyndnsd/textfile_reporter.rb +2 -2
- data/lib/dyndnsd/updater/zone_transfer_server.rb +2 -2
- data/lib/dyndnsd/version.rb +1 -1
- metadata +8 -9
- data/init.d/debian-6-dyndnsd +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b6bde5e231b0cfaa5f574a8d273a234fe80220e3c1d921f95d4b545f5b79e27
|
4
|
+
data.tar.gz: 44c577daf4ad17e698304b49dda8ca4ba2b9f6009fee4e652c44531a0fff10e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eeacccc297ff9d083ad76c0ecab842e2989f869c0cab83bb902ffe1371787e12919f57aa170dda3af7189f8e037800338b96b3ab17eef042c9df2061956c239
|
7
|
+
data.tar.gz: 8b2fc766f3017e0045dc9e73a94f00281743f3f870a43eff97080dbc3b1e2477bcbf5c2eb3a6be14be87d311da744aa46e2d6fd89579b167503c95e2990def17
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -64,7 +64,42 @@ users:
|
|
64
64
|
|
65
65
|
Run dyndnsd.rb by:
|
66
66
|
|
67
|
-
|
67
|
+
```bash
|
68
|
+
dyndnsd /path/to/config.yml
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
### Docker image
|
73
|
+
|
74
|
+
There is an officially maintained [Docker image for dyndnsd](https://hub.docker.com/r/cmur2/dyndnsd) available at Dockerhub. The goal is to have a minimal secured image available (currently based on Alpine) that works well for the `zone_transfer_server` updater use case.
|
75
|
+
|
76
|
+
Users can make extensions by deriving from the official Docker image or building their own.
|
77
|
+
|
78
|
+
The Docker image consumes the same configuration file in YAML format as the gem, inside the container it needs to be mounted/available as `/etc/dyndnsd/config.yml`. the following YAML should be used as a base and extended with user's settings:
|
79
|
+
|
80
|
+
```yaml
|
81
|
+
host: "0.0.0.0"
|
82
|
+
port: 8080
|
83
|
+
# omit the logfile: option so logging to STDOUT will happen automatically
|
84
|
+
db: "/var/lib/db.json"
|
85
|
+
|
86
|
+
# User's settings for updater and permissions follow here!
|
87
|
+
```
|
88
|
+
|
89
|
+
more ports might be needed depending on if DNS zone transfer is needed
|
90
|
+
|
91
|
+
Run the Docker image exposing the DynDNS-API on host port 8080 via:
|
92
|
+
|
93
|
+
```bash
|
94
|
+
docker run -d --name dyndnsd \
|
95
|
+
-p 8080:8080 \
|
96
|
+
-v /host/path/to/dyndnsd/config.yml:/etc/dyndnsd/config.yml \
|
97
|
+
-v /host/path/to/dyndnsd/db.json:/var/lib/db.json \
|
98
|
+
cmur2/dyndnsd:vX.Y.Z
|
99
|
+
```
|
100
|
+
|
101
|
+
*Note*: You may need to expose more then just port 8080 e.g. if you use the `zone_transfer_server` which can be done by appending additional `-p 5353:5353` flags to the `docker run` command.
|
102
|
+
|
68
103
|
|
69
104
|
|
70
105
|
## Using dyndnsd.rb with any nameserver via DNS zone transfers (AXFR)
|
@@ -187,9 +222,11 @@ If you want to provide an additional IPv6 address as myip6 parameter, the myip p
|
|
187
222
|
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.
|
188
223
|
|
189
224
|
|
190
|
-
###
|
225
|
+
### Startup
|
226
|
+
|
227
|
+
There is a [Dockerfile](docs/Dockerfile) that can be used to build a Docker image for running dyndnsd.rb.
|
191
228
|
|
192
|
-
The [Debian 6 init.d script](
|
229
|
+
The [Debian 6 init.d script](docs/debian-6-init-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.
|
193
230
|
|
194
231
|
|
195
232
|
### Monitoring
|
data/lib/dyndnsd.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'date'
|
3
4
|
require 'etc'
|
4
5
|
require 'logger'
|
5
6
|
require 'ipaddr'
|
@@ -80,7 +81,7 @@ module Dyndnsd
|
|
80
81
|
end
|
81
82
|
|
82
83
|
# @param env [Hash{String => String}]
|
83
|
-
# @return [Array{Integer,Hash{String => String},Array
|
84
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
84
85
|
def call(env)
|
85
86
|
return [422, {'X-DynDNS-Response' => 'method_forbidden'}, []] if env['REQUEST_METHOD'] != 'GET'
|
86
87
|
return [422, {'X-DynDNS-Response' => 'not_found'}, []] if env['PATH_INFO'] != '/nic/update'
|
@@ -134,7 +135,7 @@ module Dyndnsd
|
|
134
135
|
private
|
135
136
|
|
136
137
|
# @param params [Hash{String => String}]
|
137
|
-
# @return [Array
|
138
|
+
# @return [Array<String>]
|
138
139
|
def extract_v4_and_v6_address(params)
|
139
140
|
return [] if !(params['myip'])
|
140
141
|
begin
|
@@ -148,7 +149,7 @@ module Dyndnsd
|
|
148
149
|
|
149
150
|
# @param env [Hash{String => String}]
|
150
151
|
# @param params [Hash{String => String}]
|
151
|
-
# @return [Array
|
152
|
+
# @return [Array<String>]
|
152
153
|
def extract_myips(env, params)
|
153
154
|
# require presence of myip parameter as valid IPAddr (v4) and valid myip6
|
154
155
|
return extract_v4_and_v6_address(params) if params.key?('myip6')
|
@@ -164,8 +165,8 @@ module Dyndnsd
|
|
164
165
|
end
|
165
166
|
|
166
167
|
# @param hostnames [String]
|
167
|
-
# @param myips [Array
|
168
|
-
# @return [Array
|
168
|
+
# @param myips [Array<String>]
|
169
|
+
# @return [Array<Symbol>]
|
169
170
|
def process_changes(hostnames, myips)
|
170
171
|
changes = []
|
171
172
|
Helper.span('process_changes') do |span|
|
@@ -200,7 +201,7 @@ module Dyndnsd
|
|
200
201
|
end
|
201
202
|
|
202
203
|
# @param env [Hash{String => String}]
|
203
|
-
# @return [Array{Integer,Hash{String => String},Array
|
204
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
204
205
|
def handle_dyndns_request(env)
|
205
206
|
params = Rack::Utils.parse_query(env['QUERY_STRING'])
|
206
207
|
|
@@ -245,7 +246,7 @@ module Dyndnsd
|
|
245
246
|
if config['logfile']
|
246
247
|
Dyndnsd.logger = Logger.new(config['logfile'])
|
247
248
|
else
|
248
|
-
Dyndnsd.logger = Logger.new(
|
249
|
+
Dyndnsd.logger = Logger.new($stdout)
|
249
250
|
end
|
250
251
|
|
251
252
|
Dyndnsd.logger.progname = 'dyndnsd'
|
@@ -9,7 +9,7 @@ module Dyndnsd
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# @param env [Hash{String => String}]
|
12
|
-
# @return [Array{Integer,Hash{String => String},Array
|
12
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
13
13
|
def call(env)
|
14
14
|
@app.call(env).tap do |status_code, headers, body|
|
15
15
|
if headers.key?('X-DynDNS-Response')
|
@@ -24,8 +24,8 @@ module Dyndnsd
|
|
24
24
|
|
25
25
|
# @param status_code [Integer]
|
26
26
|
# @param headers [Hash{String => String}]
|
27
|
-
# @param body [Array
|
28
|
-
# @return [Array{Integer,Hash{String => String},Array
|
27
|
+
# @param body [Array<String>]
|
28
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
29
29
|
def decorate_dyndnsd_response(status_code, headers, body)
|
30
30
|
case status_code
|
31
31
|
when 200
|
@@ -37,8 +37,8 @@ module Dyndnsd
|
|
37
37
|
|
38
38
|
# @param status_code [Integer]
|
39
39
|
# @param headers [Hash{String => String}]
|
40
|
-
# @param _body [Array
|
41
|
-
# @return [Array{Integer,Hash{String => String},Array
|
40
|
+
# @param _body [Array<String>]
|
41
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
42
42
|
def decorate_other_response(status_code, headers, _body)
|
43
43
|
case status_code
|
44
44
|
when 400
|
@@ -48,8 +48,8 @@ module Dyndnsd
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
# @param changes [Array
|
52
|
-
# @param myips [Array
|
51
|
+
# @param changes [Array<Symbol>]
|
52
|
+
# @param myips [Array<String>]
|
53
53
|
# @return [String]
|
54
54
|
def get_success_body(changes, myips)
|
55
55
|
changes.map { |change| "#{change} #{myips.join(' ')}" }.join("\n")
|
@@ -9,7 +9,7 @@ module Dyndnsd
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# @param env [Hash{String => String}]
|
12
|
-
# @return [Array{Integer,Hash{String => String},Array
|
12
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
13
13
|
def call(env)
|
14
14
|
@app.call(env).tap do |status_code, headers, body|
|
15
15
|
if headers.key?('X-DynDNS-Response')
|
@@ -24,8 +24,8 @@ module Dyndnsd
|
|
24
24
|
|
25
25
|
# @param status_code [Integer]
|
26
26
|
# @param headers [Hash{String => String}]
|
27
|
-
# @param body [Array
|
28
|
-
# @return [Array{Integer,Hash{String => String},Array
|
27
|
+
# @param body [Array<String>]
|
28
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
29
29
|
def decorate_dyndnsd_response(status_code, headers, body)
|
30
30
|
case status_code
|
31
31
|
when 200
|
@@ -37,8 +37,8 @@ module Dyndnsd
|
|
37
37
|
|
38
38
|
# @param status_code [Integer]
|
39
39
|
# @param headers [Hash{String => String}]
|
40
|
-
# @param _body [Array
|
41
|
-
# @return [Array{Integer,Hash{String => String},Array
|
40
|
+
# @param _body [Array<String>]
|
41
|
+
# @return [Array{Integer,Hash{String => String},Array<String>}]
|
42
42
|
def decorate_other_response(status_code, headers, _body)
|
43
43
|
case status_code
|
44
44
|
when 400
|
@@ -48,8 +48,8 @@ module Dyndnsd
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
# @param changes [Array
|
52
|
-
# @param myips [Array
|
51
|
+
# @param changes [Array<Symbol>]
|
52
|
+
# @param myips [Array<String>]
|
53
53
|
# @return [String]
|
54
54
|
def get_success_body(changes, myips)
|
55
55
|
changes.map { |change| change == :good ? "Changed to #{myips.join(' ')}" : "No change needed for #{myips.join(' ')}" }.join("\n")
|
@@ -94,8 +94,8 @@ module Dyndnsd
|
|
94
94
|
# @param file [String]
|
95
95
|
# @param base_name [String]
|
96
96
|
# @param metric [Object]
|
97
|
-
# @param keys [Array
|
98
|
-
# @param snapshot_keys [Array
|
97
|
+
# @param keys [Array<Symbol>]
|
98
|
+
# @param snapshot_keys [Array<Symbol>]
|
99
99
|
# @return [void]
|
100
100
|
def write_metric(file, base_name, metric, keys, snapshot_keys = [])
|
101
101
|
time = Time.now.to_i
|
@@ -85,7 +85,7 @@ module Dyndnsd
|
|
85
85
|
|
86
86
|
# converts into suitable parameter form for Async::DNS::Resolver or Async::DNS::Server
|
87
87
|
#
|
88
|
-
# @param endpoint_list [Array
|
88
|
+
# @param endpoint_list [Array<String>]
|
89
89
|
# @return [Array{Array{Object}}]
|
90
90
|
def self.parse_endpoints(endpoint_list)
|
91
91
|
endpoint_list.map { |addr_string| addr_string.split('@') }
|
@@ -139,7 +139,7 @@ module Dyndnsd
|
|
139
139
|
|
140
140
|
# @param name [String]
|
141
141
|
# @param resource_class [Resolv::DNS::Resource]
|
142
|
-
#
|
142
|
+
# Since solargraph cannot parse this: param transaction [Async::DNS::Transaction]
|
143
143
|
# @return [void]
|
144
144
|
def process(name, resource_class, transaction)
|
145
145
|
if name != @domain || resource_class != Resolv::DNS::Resource::Generic::Type252_Class1
|
data/lib/dyndnsd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndnsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.1.0.rc1
|
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-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-dns
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metriks
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.89.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: 0.89.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: solargraph
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,7 +207,6 @@ files:
|
|
207
207
|
- LICENSE
|
208
208
|
- README.md
|
209
209
|
- exe/dyndnsd
|
210
|
-
- init.d/debian-6-dyndnsd
|
211
210
|
- lib/dyndnsd.rb
|
212
211
|
- lib/dyndnsd/database.rb
|
213
212
|
- lib/dyndnsd/generator/bind.rb
|
@@ -236,9 +235,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
235
|
version: '2.5'
|
237
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
237
|
requirements:
|
239
|
-
- - "
|
238
|
+
- - ">"
|
240
239
|
- !ruby/object:Gem::Version
|
241
|
-
version:
|
240
|
+
version: 1.3.1
|
242
241
|
requirements: []
|
243
242
|
rubygems_version: 3.1.2
|
244
243
|
signing_key:
|
data/init.d/debian-6-dyndnsd
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#! /bin/sh
|
2
|
-
### BEGIN INIT INFO
|
3
|
-
# Provides: dyndnsd
|
4
|
-
# Required-Start: $remote_fs $syslog
|
5
|
-
# Required-Stop: $remote_fs $syslog
|
6
|
-
# Default-Start: 2 3 4 5
|
7
|
-
# Default-Stop: 0 1 6
|
8
|
-
# Short-Description: Handle dyndnsd.rb gem
|
9
|
-
### END INIT INFO
|
10
|
-
|
11
|
-
# using the system ruby's gem binaries directory
|
12
|
-
DAEMON="/var/lib/gems/1.8/bin/dyndnsd"
|
13
|
-
|
14
|
-
CONFIG_FILE="/opt/dyndnsd/config.yaml"
|
15
|
-
|
16
|
-
DAEMON_OPTS="$CONFIG_FILE"
|
17
|
-
|
18
|
-
test -x $DAEMON || exit 0
|
19
|
-
|
20
|
-
. /lib/lsb/init-functions
|
21
|
-
|
22
|
-
case "$1" in
|
23
|
-
start)
|
24
|
-
log_daemon_msg "Starting dyndnsd.rb" "dyndnsd"
|
25
|
-
start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/dyndnsd.pid" --background --exec $DAEMON -- $DAEMON_OPTS
|
26
|
-
log_end_msg $?
|
27
|
-
;;
|
28
|
-
stop)
|
29
|
-
log_daemon_msg "Stopping dyndnsd.rb" "dyndnsd"
|
30
|
-
start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/dyndnsd.pid"
|
31
|
-
log_end_msg $?
|
32
|
-
;;
|
33
|
-
restart|force-reload)
|
34
|
-
log_daemon_msg "Restarting dyndnsd.rb" "dyndnsd"
|
35
|
-
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "/var/run/dyndsd.pid"
|
36
|
-
start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/dyndnsd.pid" --background --exec $DAEMON -- $DAEMON_OPTS
|
37
|
-
log_end_msg $?
|
38
|
-
;;
|
39
|
-
*)
|
40
|
-
log_action_msg "Usage: $0 {start|stop|restart|force-reload}"
|
41
|
-
exit 2
|
42
|
-
;;
|
43
|
-
esac
|