auth_dns_check 0.1.0 → 0.2.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 +4 -4
- data/README.md +12 -6
- data/docker-compose.yml +3 -0
- data/lib/auth_dns_check/client.rb +20 -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: 2ce2d9f93dd5a2d8201b420bd5b7bf570dc019a8aa55206263787871d1c60052
|
4
|
+
data.tar.gz: 0cc5585ba4a40af75e6eed17cb8188195616d7d4b500f7da4b566f3a8f008f3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfa7db53ed72044c4d8c3a09315875b9496836ca35eac53ebcda6e43d631b0b1322d3f82b1d9a61b59b6c0db528d7103e07885c842504d18b3e48d245b181cdc
|
7
|
+
data.tar.gz: da427b2d7d45597983596664749a0a42fafcd92a73fac24d668c366578c3c444bc9eb480d4180e30e8c654b5d970d013480be6e31b4cc234efb2702e76ea4f0b
|
data/README.md
CHANGED
@@ -33,6 +33,17 @@ Example:
|
|
33
33
|
```
|
34
34
|
require "auth_dns_check"
|
35
35
|
|
36
|
+
# Check that the authoritative name servers for peculiardomain.com
|
37
|
+
# agree that changed.peculiardomain.com has the address 192.168.1.1
|
38
|
+
# and no other addresses.
|
39
|
+
#
|
40
|
+
client = AuthDnsCheck.client
|
41
|
+
client.has_ip?("changed.peculiardomain.com", "192.168.1.1")
|
42
|
+
|
43
|
+
# Ignore the NS records for peculiardomain.com and check that
|
44
|
+
# 192.168.0.253 and 192.168.0.252 both know about and agree on
|
45
|
+
# any and all records for newhost.peculiardomain.com.
|
46
|
+
#
|
36
47
|
client = AuthDnsCheck.client(
|
37
48
|
overrides: {
|
38
49
|
:default => [
|
@@ -41,12 +52,7 @@ client = AuthDnsCheck.client(
|
|
41
52
|
]
|
42
53
|
}
|
43
54
|
)
|
44
|
-
|
45
|
-
# Ignore the NS records for peculiardomain.com and check that
|
46
|
-
# 192.168.0.253 and 192.168.0.252 both know about and agree on
|
47
|
-
# 4acf8ea915b7.peculiardomain.com.
|
48
|
-
#
|
49
|
-
client.all?("4acf8ea915b7.example.com")
|
55
|
+
client.all?("newhost.peculiardomain.com")
|
50
56
|
```
|
51
57
|
|
52
58
|
## Development
|
data/docker-compose.yml
CHANGED
@@ -8,14 +8,31 @@ module AuthDnsCheck
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def all?(fqdn)
|
11
|
-
answers =
|
12
|
-
map { |x| x.getaddresses(fqdn) }.
|
13
|
-
map { |x| x.collect(&:to_s).sort }
|
11
|
+
answers = get_addresses(fqdn)
|
14
12
|
answers.all? { |x| x.any? and x == answers.first }
|
15
13
|
end
|
16
14
|
|
15
|
+
def has_ip?(fqdn, ip)
|
16
|
+
answers = get_addresses(fqdn)
|
17
|
+
answers.all? do |x|
|
18
|
+
x.any? and x.all? { |i| i == ip }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
17
22
|
private
|
18
23
|
|
24
|
+
def get_addresses(fqdn)
|
25
|
+
get_authoritatives(fqdn).
|
26
|
+
map { |x| x.getaddresses(fqdn) }.
|
27
|
+
map { |x| x.collect(&:to_s).sort }
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_authoritatives(fqdn)
|
31
|
+
authoritatives_for(fqdn).tap do |auths|
|
32
|
+
auths.any? or raise(Error, "no name servers found for #{fqdn}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
19
36
|
def authoritatives_for(fqdn)
|
20
37
|
zone = fqdn.gsub(/\A[^.]+\./, '')
|
21
38
|
overridden_authoritatives_for(zone) || overridden_authoritatives_for(:default) || default_authoritatives_for(zone)
|
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.2.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-05-
|
11
|
+
date: 2020-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|