record_store 5.10.0 → 5.11.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: 305f971c2df40732e6ed0a53798af1ef1ffe4bda959454beea2c9f2d4da09ee7
4
- data.tar.gz: 4233420dd7d25ac624d52d643a4326762133f6531784de8174c1de15ca890a57
3
+ metadata.gz: f7a361748d4f6dd8179730ba18eadc60890c4317df58730ffd23dbb15bef6230
4
+ data.tar.gz: b4a3c7ffaeceedde2621a580cd52534fbba8cd4b4052a0f8561008f8718e6d64
5
5
  SHA512:
6
- metadata.gz: 99034b1c2625066dd7c4d32ee33582ef58ad2203197c52650f2a810365799604969b49575699f70ad8a009ee443838cd2de8989e75724dc4dc8967fecfbc6e63
7
- data.tar.gz: 150539a073dc355c83288f0356ba8db15d28287e17977dd7cce882487a439f19cfa614305cd67b3f1ffe1aa21f7359c170a168803248af9d8eb914f5fd844496
6
+ metadata.gz: 95c9e88b0721f53f0212e5b97c852523a0864a6a191045a45083541a4ff3f3d25c5a179814519c651bcba4b4b857a4ab9b34e435ecffadb4f727af9c2f115c32
7
+ data.tar.gz: 6f418902506b12e6a5e58640ddc3efc21a2c790a2d0a315a97b284fa5ae2443bb9d76a6f623d641eae1b24eec2bd6971c3dafb0be5da6454b01a43faef50439c
@@ -803,7 +803,7 @@ Layout/SpaceInsideRangeLiteral:
803
803
  Style/SymbolLiteral:
804
804
  Enabled: true
805
805
 
806
- Layout/Tab:
806
+ Layout/IndentationStyle:
807
807
  Enabled: true
808
808
 
809
809
  Layout/TrailingWhitespace:
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 5.11.0
4
+ - support PTR record type [FEATURE]
5
+
3
6
  ## 5.10.0
4
7
  - add `record-store validate_authority` command to sanity check delegation [FEATURE]
5
8
  - fix handling of NXDOMAIN, etc. when fetching authoritative nameservers [BUGFIX]
@@ -19,6 +19,7 @@ require 'record_store/record/caa'
19
19
  require 'record_store/record/cname'
20
20
  require 'record_store/record/mx'
21
21
  require 'record_store/record/ns'
22
+ require 'record_store/record/ptr'
22
23
  require 'record_store/record/sshfp'
23
24
  require 'record_store/record/txt'
24
25
  require 'record_store/record/spf'
@@ -4,7 +4,7 @@ module RecordStore
4
4
  class Provider::DNSimple < Provider
5
5
  class << self
6
6
  def record_types
7
- super | Set.new(['SSHFP'])
7
+ super | Set.new(%w(PTR SSHFP))
8
8
  end
9
9
 
10
10
  def supports_alias?
@@ -99,6 +99,8 @@ module RecordStore
99
99
  record.merge!(preference: api_record.priority, exchange: api_record.content)
100
100
  when 'NS'
101
101
  record.merge!(nsdname: api_record.content)
102
+ when 'PTR'
103
+ record.merge!(ptrdname: api_record.content)
102
104
  when 'SSHFP'
103
105
  algorithm, fptype, fingerprint = api_record.content.split(' ')
104
106
  record.merge!(
@@ -143,6 +145,8 @@ module RecordStore
143
145
  record_hash[:content] = record.exchange.chomp('.')
144
146
  when 'NS'
145
147
  record_hash[:content] = record.nsdname.chomp('.')
148
+ when 'PTR'
149
+ record_hash[:content] = record.ptrdname.chomp('.')
146
150
  when 'SSHFP'
147
151
  record_hash[:content] = record.rdata_txt
148
152
  when 'SPF', 'TXT'
@@ -41,6 +41,10 @@ module RecordStore
41
41
  end
42
42
 
43
43
  class << self
44
+ def record_types
45
+ super | Set.new(%w(PTR))
46
+ end
47
+
44
48
  def client
45
49
  Provider::NS1::Client.new(api_key: secrets['api_key'])
46
50
  end
@@ -229,6 +233,8 @@ module RecordStore
229
233
  )
230
234
  when 'NS'
231
235
  record.merge!(nsdname: answer.rrdata_string)
236
+ when 'PTR'
237
+ record.merge!(ptrdname: answer.rrdata_string)
232
238
  when 'SPF', 'TXT'
233
239
  record.merge!(txtdata: answer.rrdata_string.gsub(';', '\;'))
234
240
  when 'SRV'
@@ -0,0 +1,42 @@
1
+ module RecordStore
2
+ class Record::PTR < Record
3
+ attr_accessor :ptrdname
4
+
5
+ OCTET_LABEL_SEQUENCE_REGEX = /\A(?:([0-9]|[1-9][0-9]|[1-9][0-9][0-9])\.){1,4}/
6
+ IN_ADDR_ARPA_SUFFIX_REGEX = /in-addr\.arpa\.\z/
7
+ FQDN_FORMAT_REGEX = Regexp.new(OCTET_LABEL_SEQUENCE_REGEX.source + IN_ADDR_ARPA_SUFFIX_REGEX.source)
8
+
9
+ validates_format_of :fqdn, with: FQDN_FORMAT_REGEX
10
+
11
+ validate :validate_fqdn_octets_in_range
12
+ validate :validate_fqdn_is_in_addr_arpa_subzone
13
+
14
+ def initialize(record)
15
+ super
16
+
17
+ @ptrdname = Record.ensure_ends_with_dot(record.fetch(:ptrdname))
18
+ end
19
+
20
+ def rdata
21
+ { ptrdname: ptrdname }
22
+ end
23
+
24
+ def rdata_txt
25
+ ptrdname.to_s
26
+ end
27
+
28
+ def validate_fqdn_octets_in_range
29
+ OCTET_LABEL_SEQUENCE_REGEX.match(fqdn) do |m|
30
+ unless m.captures.all? { |o| o.to_d.between?(0, 255) }
31
+ errors.add(:fqdn, 'octet labels must be within the range 0-255')
32
+ end
33
+ end
34
+ end
35
+
36
+ def validate_fqdn_is_in_addr_arpa_subzone
37
+ unless IN_ADDR_ARPA_SUFFIX_REGEX.match?(fqdn)
38
+ errors.add(:fqdn, 'PTR records may only exist in the in-addr.arpa zone')
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '5.10.0'.freeze
2
+ VERSION = '5.11.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.0
4
+ version: 5.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-15 00:00:00.000000000 Z
12
+ date: 2020-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -369,6 +369,7 @@ files:
369
369
  - lib/record_store/record/cname.rb
370
370
  - lib/record_store/record/mx.rb
371
371
  - lib/record_store/record/ns.rb
372
+ - lib/record_store/record/ptr.rb
372
373
  - lib/record_store/record/spf.rb
373
374
  - lib/record_store/record/srv.rb
374
375
  - lib/record_store/record/sshfp.rb
@@ -411,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
412
  - !ruby/object:Gem::Version
412
413
  version: '0'
413
414
  requirements: []
414
- rubygems_version: 3.0.3
415
+ rubygems_version: 3.0.2
415
416
  signing_key:
416
417
  specification_version: 4
417
418
  summary: Manage DNS using git