auth_dns_check 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -6
- data/README.md +1 -0
- data/docker/dns1-internal.domain.db +6 -0
- data/docker/dns2-internal.domain.db +6 -0
- data/lib/auth_dns_check/client.rb +30 -3
- data/lib/auth_dns_check/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d338d45de300e876947fadfa4d22ecf87425725afdd04319b88be77561acd16f
|
4
|
+
data.tar.gz: eedb01a8bd545c05dc46b5a4d75e58ca45b68e9d0c79d01c4c45395f27fc6a4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35938d0b0510dc6e2122fb30b164f28144758374aaa407f38f71e24319a7d058d5cdca4bcb3a0ad5c933252670ef9d67e6a613320439a8dae29270c3bb47c999
|
7
|
+
data.tar.gz: 284e37fcf048fff46f974c1c3f648553a6b4b5d93d398b7333dfbb21a1d7973e23c11437a457ee30700d541b5b15be74efe37df3ccaed3c533716d4351d8fc43
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[![Gem](https://img.shields.io/gem/v/auth_dns_check.svg?style=flat)](https://rubygems.org/gems/auth_dns_check "View this project in Rubygems")
|
2
|
+
[![CI](https://travis-ci.org/starjuice/auth_dns_check.svg?branch=master)](https://travis-ci.org/github/starjuice/auth_dns_check "View this project in Travis CI")
|
2
3
|
|
3
4
|
# AuthDnsCheck
|
4
5
|
|
@@ -5,6 +5,9 @@ module AuthDnsCheck
|
|
5
5
|
# @todo IPv6 not supported
|
6
6
|
class Client
|
7
7
|
|
8
|
+
# Default record types for checks like +all?+
|
9
|
+
DEFAULT_TYPES = ["A"] unless defined?(DEFAULT_TYPES)
|
10
|
+
|
8
11
|
# authoritative name server overrides
|
9
12
|
attr_reader :overrides
|
10
13
|
|
@@ -29,9 +32,15 @@ module AuthDnsCheck
|
|
29
32
|
# @return [Boolean] whether all authoritative agree that +fqdn+ has the same non-empty set of records
|
30
33
|
# @raise [Error] if authoritative name servers could not be found
|
31
34
|
# @todo Records of types other than A not yet supported
|
32
|
-
def all?(fqdn)
|
33
|
-
|
34
|
-
|
35
|
+
def all?(fqdn, types: DEFAULT_TYPES)
|
36
|
+
non_empty_set = false
|
37
|
+
types.all? { |type|
|
38
|
+
resources = get_resources(fqdn, type: type)
|
39
|
+
resources.all? do |x|
|
40
|
+
non_empty_set = true unless x.empty?
|
41
|
+
x == resources.first
|
42
|
+
end
|
43
|
+
} && non_empty_set
|
35
44
|
end
|
36
45
|
|
37
46
|
# Check authoritative agreement for the specific address for a name
|
@@ -49,6 +58,24 @@ module AuthDnsCheck
|
|
49
58
|
|
50
59
|
private
|
51
60
|
|
61
|
+
def get_resources(fqdn, type:)
|
62
|
+
type_class = Resolv::DNS::Resource::IN::const_get(type)
|
63
|
+
get_authoritatives(fqdn).
|
64
|
+
map { |x| x.getresources(fqdn, type_class) }.
|
65
|
+
map { |x| x.collect { |r| resource_to_s(r, type) }.sort }
|
66
|
+
end
|
67
|
+
|
68
|
+
def resource_to_s(r, type)
|
69
|
+
case type
|
70
|
+
when "A"
|
71
|
+
r.address.to_s
|
72
|
+
when "TXT"
|
73
|
+
r.data
|
74
|
+
else
|
75
|
+
raise "unsupported record type #{type}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
52
79
|
def get_addresses(fqdn)
|
53
80
|
get_authoritatives(fqdn).
|
54
81
|
map { |x| x.getaddresses(fqdn) }.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_dns_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Hearn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|