assert_zone 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 +13 -7
- data/exe/assert_zone +9 -3
- data/lib/assert_zone/version.rb +1 -1
- data/lib/assert_zone.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0ffd6f47f0c8ca157e80874169820de36d3aab
|
4
|
+
data.tar.gz: e556bf0c5d46eca4db28a64cd97fde1cb17c4902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce624793f4c312c70237e5eff306a32b878ef9f7d24236023e21e01e43064bf0b1b3441f63a93f2f6692e022837b5d347382637db40660c1a54384d3695d4a57
|
7
|
+
data.tar.gz: c51a633907b983b39d2adb97e9ae499ffcbd87ffe49504cbb6f0d822cade7e63fb4eb44ba03d56309acacea1564d2dcdb2f1dab27ac08d4e2464ca6ca810cf89
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# assert_zone
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This small utility will help you verify that a DNS server is responding with the correct information, based on a zone file.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,16 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
It's simple: `assert_zone ZONE_FILE [NAMESERVER] [options]`
|
24
|
+
|
25
|
+
Assuming you have a zone file named `zone.txt` in the current directory, you can run `assert_zone zone.txt` to verify that each record in the zone file matches what the nameserver responds with.
|
26
|
+
|
27
|
+
By default, it will use the nameserver listed in the SOA record in the zone file. You can also specify a custom nameserver: `assert_zone zone.txt ns1.example.com`.
|
28
|
+
|
29
|
+
There are a few option flags you can add to the command:
|
30
|
+
|
31
|
+
* `--color` will display the results in color
|
32
|
+
* `--use-local-resolver` will not specify a nameserver and will use your system settings
|
26
33
|
|
27
34
|
## Development
|
28
35
|
|
@@ -32,10 +39,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
39
|
|
33
40
|
## Contributing
|
34
41
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dwradcliffe/assert_zone.
|
36
43
|
|
37
44
|
|
38
45
|
## License
|
39
46
|
|
40
47
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/exe/assert_zone
CHANGED
@@ -4,12 +4,18 @@ require 'bundler/setup'
|
|
4
4
|
require 'assert_zone'
|
5
5
|
require 'optparse'
|
6
6
|
|
7
|
-
|
7
|
+
options = {
|
8
|
+
rspec_flags: [],
|
9
|
+
use_local_resolver: false
|
10
|
+
}
|
8
11
|
|
9
12
|
OptionParser.new do |opts|
|
10
13
|
opts.banner = "Usage: assert_zone ZONE_FILE [NAMESERVER] [options]"
|
11
14
|
opts.on('--color', 'Use color') do |v|
|
12
|
-
|
15
|
+
options[:rspec_flags] << '--color'
|
16
|
+
end
|
17
|
+
opts.on('--use-local-resolver', 'Use local resolver settings instead of explicit nameserver') do |v|
|
18
|
+
options[:use_local_resolver] = true
|
13
19
|
end
|
14
20
|
opts.on_tail('-h', '--help', 'Show this message') do
|
15
21
|
puts opts
|
@@ -21,4 +27,4 @@ OptionParser.new do |opts|
|
|
21
27
|
end
|
22
28
|
end.parse!
|
23
29
|
|
24
|
-
AssertZone.run(ARGV[0], ARGV[1],
|
30
|
+
AssertZone.run(ARGV[0], nameserver: ARGV[1], rspec_flags: options[:rspec_flags], use_local_resolver: options[:use_local_resolver])
|
data/lib/assert_zone/version.rb
CHANGED
data/lib/assert_zone.rb
CHANGED
@@ -4,16 +4,23 @@ require 'rspec'
|
|
4
4
|
require 'rspec-dns'
|
5
5
|
|
6
6
|
module AssertZone
|
7
|
-
def self.run(filename, nameserver
|
7
|
+
def self.run(filename, nameserver: nil, rspec_flags: [], use_local_resolver: false)
|
8
8
|
ns_config = {}
|
9
9
|
ns_config[:nameserver] = nameserver if nameserver
|
10
10
|
|
11
11
|
zone = DNS::Zone.load(File.read(filename))
|
12
12
|
|
13
|
+
unless use_local_resolver
|
14
|
+
# default to nameserver from SOA in zone
|
15
|
+
ns_config[:nameserver] ||= zone.soa.nameserver
|
16
|
+
# output the custom nameserver
|
17
|
+
puts "Using nameserver: #{ns_config[:nameserver]}"
|
18
|
+
end
|
19
|
+
|
13
20
|
zone.records.each do |record|
|
14
21
|
next if ['SOA', 'NS'].include?(record.type)
|
15
22
|
|
16
|
-
fqdn = record.label == '@' ? zone.origin : "#{record.label}.#{zone.origin}"
|
23
|
+
fqdn = record.label == '@' ? zone.origin : "#{record.label}.#{zone.origin}".chomp('.')
|
17
24
|
|
18
25
|
describe fqdn do
|
19
26
|
if record.is_a?(DNS::Zone::RR::A)
|