dyndnsd 3.11.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b42d2f705687808d249c527376a3aadd9475530fd2d63504ea84af8af648c19
4
- data.tar.gz: 5e8b830c3f7b5e8cbdfdaa430aab6afdb8ca73af0e94e76fa639075f812e5430
3
+ metadata.gz: 1291b6722535928edf7d305db50ffe5045b211b2a03425218f97fd6d6648ec4b
4
+ data.tar.gz: 6f9f5611f347d5f3e4dee4a0c9dd8d6fe85c6b21a36919bf39a68f872ae51e25
5
5
  SHA512:
6
- metadata.gz: 4e2ab7c620f0bec2677a52a6821cdaa6a22dec7f290f6097cecee76afc033845be12fd52d3e993d07c08960c3c396f33c419359be68f71cf711613f85cfbbc2c
7
- data.tar.gz: e82dd2c0df92b44b3d885537af20c87046cb64be584ff77652194d59b46510738c077e7e190766aa2ec60164ed93823360bd8da82808f8dfd867e2f690fb25f8
6
+ metadata.gz: c42f9a7bc3aece580177ffe50cfdcda3f7a7bc3f4ee978c3986f1abfd4cf6756f01f1c8606a852d76eb217da805c6633fa4a3df7ee76d7b95417cdb3dd8dd702
7
+ data.tar.gz: 1735e786ae2e77b1be0a2eb1bcb45d667836f71d9adf0268433c067296831af66674525db8c0fc961a398731d51fa7a0c3d9ff7967dd2ba326788d64e393700b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.12.0 (December 4th, 2025)
4
+
5
+ IMPROVEMENTS:
6
+
7
+ - regex instead of hosts list can be used for hostname ownership
8
+
3
9
  ## 3.11.0 (October 2nd, 2025)
4
10
 
5
11
  IMPROVEMENTS:
data/README.md CHANGED
@@ -307,6 +307,37 @@ users:
307
307
  ```
308
308
 
309
309
 
310
+ ### Matching with a regular expression
311
+
312
+ Instead of relying on `hosts`, you can use `regex` to employ a regular expression, which is very useful for avoiding having to repeatedly edit the configuration file to register a new host name.
313
+
314
+ ```yaml
315
+ host: "0.0.0.0"
316
+ port: 5354
317
+ username: "dyndnsd"
318
+ group: "dyndnsd"
319
+ db: "/dyndnsd/db.json"
320
+ debug: false
321
+ domain: "dyn.dc-air.home.arpa"
322
+ updater:
323
+ name: "command_with_bind_zone"
324
+ params:
325
+ zone_file: "/nsd/zones/static/dyn.dc-air.home.arpa.zone"
326
+ command: "doas service nsd reload"
327
+ ttl: "5m"
328
+ dns: "ns.dc-air.home.arpa."
329
+ email_addr: "admin.example.org"
330
+ users:
331
+ myuser:
332
+ password: "superhypermegas3kurepassword1234"
333
+ regex: '^[a-z][0-9]\.dyn\.dc\-air\.home\.arpa$'
334
+ ```
335
+
336
+ However, when using `regex`, `hosts` is simply ignored if defined, so you must choose one or the other. Recommendation: use `regex` for scripts or programs and `hosts` for regular users.
337
+
338
+ **Note**: Please note that when dyndnsd evaluates the regular expression, the `Regexp::EXTENDED` and `Regexp::IGNORECASE` options are used.
339
+
340
+
310
341
  ## License
311
342
 
312
343
  dyndnsd.rb is licensed under the Apache License, Version 2.0. See LICENSE for more information.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dyndnsd
4
- VERSION = '3.11.0'
4
+ VERSION = '3.12.0'
5
5
  end
data/lib/dyndnsd.rb CHANGED
@@ -218,9 +218,22 @@ module Dyndnsd
218
218
  # we can trust this information since user was authorized by middleware
219
219
  user = env['REMOTE_USER']
220
220
 
221
- # check for hostnames that the user does not own
222
- forbidden_hostnames = hostnames - @users[user].fetch('hosts', [])
223
- return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
221
+ if @users[user].key?('regex')
222
+ pattern = @users[user].fetch('regex')
223
+ begin
224
+ regex = Regexp.new(pattern, Regexp::IGNORECASE | Regexp::EXTENDED)
225
+ rescue RegexpError => e
226
+ Dyndnsd.logger.warn "Invalid regex pattern '#{pattern}': #{e.message}"
227
+ return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []]
228
+ end
229
+ # check for hostnames that match the regex
230
+ matches = hostnames.any? { |str| regex.match?(str) }
231
+ return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if !matches
232
+ else
233
+ # check for hostnames that the user does not own
234
+ forbidden_hostnames = hostnames - @users[user].fetch('hosts', [])
235
+ return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
236
+ end
224
237
 
225
238
  if params['offline'] == 'YES'
226
239
  myips = []
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.11.0
4
+ version: 3.12.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: 2025-10-02 00:00:00.000000000 Z
11
+ date: 2025-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -274,14 +274,14 @@ dependencies:
274
274
  requirements:
275
275
  - - "~>"
276
276
  - !ruby/object:Gem::Version
277
- version: 3.7.0
277
+ version: 3.8.0
278
278
  type: :development
279
279
  prerelease: false
280
280
  version_requirements: !ruby/object:Gem::Requirement
281
281
  requirements:
282
282
  - - "~>"
283
283
  - !ruby/object:Gem::Version
284
- version: 3.7.0
284
+ version: 3.8.0
285
285
  - !ruby/object:Gem::Dependency
286
286
  name: solargraph
287
287
  requirement: !ruby/object:Gem::Requirement