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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b67c4c48580887dc15c4149ee49c91d803c1e187a7dee25a5e930ff7efd4086
4
- data.tar.gz: a0090df181a91d797e7eb65c18f5d76c68cebcfbfa976319bc37d7dc227ca6e0
3
+ metadata.gz: 9b6bde5e231b0cfaa5f574a8d273a234fe80220e3c1d921f95d4b545f5b79e27
4
+ data.tar.gz: 44c577daf4ad17e698304b49dda8ca4ba2b9f6009fee4e652c44531a0fff10e6
5
5
  SHA512:
6
- metadata.gz: 636cd3cb95d49f5a84e43c82d29a271c40686bae24609e5781c052d5454ceec6431bb3e470cf7aa665de8ccbee9285dab8000e7b264c0c265e3361a4cf9b9f17
7
- data.tar.gz: da40bc71a2b92481977ad3820643a19b3ce6ff9b9d1ed5e22328796bd42e0aa8a44b015407642651e8e6b4215a4a4dd60797a60f6cb929c18595814000027acf
6
+ metadata.gz: 0eeacccc297ff9d083ad76c0ecab842e2989f869c0cab83bb902ffe1371787e12919f57aa170dda3af7189f8e037800338b96b3ab17eef042c9df2061956c239
7
+ data.tar.gz: 8b2fc766f3017e0045dc9e73a94f00281743f3f870a43eff97080dbc3b1e2477bcbf5c2eb3a6be14be87d311da744aa46e2d6fd89579b167503c95e2990def17
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0
4
+
5
+ IMPROVEMENTS:
6
+
7
+ - Add officially maintained [Docker image for dyndnsd](https://hub.docker.com/r/cmur2/dyndnsd)
8
+
3
9
  ## 3.0.0 (July 29, 2020)
4
10
 
5
11
  IMPROVEMENTS:
data/README.md CHANGED
@@ -64,7 +64,42 @@ users:
64
64
 
65
65
  Run dyndnsd.rb by:
66
66
 
67
- dyndnsd /path/to/config.yaml
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
- ### Init scripts
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](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.
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
@@ -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{String}}]
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{String}]
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{String}]
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{String}]
168
- # @return [Array{Symbol}]
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{String}}]
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(STDOUT)
249
+ Dyndnsd.logger = Logger.new($stdout)
249
250
  end
250
251
 
251
252
  Dyndnsd.logger.progname = 'dyndnsd'
@@ -27,7 +27,7 @@ module Dyndnsd
27
27
  ips.each do |ip|
28
28
  ip = IPAddr.new(ip).native
29
29
  type = ip.ipv6? ? 'AAAA' : 'A'
30
- name = hostname.chomp('.' + @domain)
30
+ name = hostname.chomp(".#{@domain}")
31
31
  out << "#{name} IN #{type} #{ip}"
32
32
  end
33
33
  end
@@ -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{String}}]
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{String}]
28
- # @return [Array{Integer,Hash{String => String},Array{String}}]
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{String}]
41
- # @return [Array{Integer,Hash{String => String},Array{String}}]
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{Symbol}]
52
- # @param myips [Array{String}]
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{String}}]
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{String}]
28
- # @return [Array{Integer,Hash{String => String},Array{String}}]
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{String}]
41
- # @return [Array{Integer,Hash{String => String},Array{String}}]
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{Symbol}]
52
- # @param myips [Array{String}]
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{Symbol}]
98
- # @param snapshot_keys [Array{Symbol}]
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{String}]
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
- # @param transaction [Async::DNS::Transaction]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dyndnsd
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.0.rc1'
5
5
  end
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.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-07-28 00:00:00.000000000 Z
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.10.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.10.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.88.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.88.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: '0'
240
+ version: 1.3.1
242
241
  requirements: []
243
242
  rubygems_version: 3.1.2
244
243
  signing_key:
@@ -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