redzone 0.0.1
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 +15 -0
- data/.gitignore +11 -0
- data/Gemfile +17 -0
- data/LICENSE.md +10 -0
- data/README.md +84 -0
- data/Rakefile +32 -0
- data/bin/redzone +7 -0
- data/lib/redzone/arpa.rb +66 -0
- data/lib/redzone/cli.rb +33 -0
- data/lib/redzone/environment.rb +20 -0
- data/lib/redzone/lifetime.rb +55 -0
- data/lib/redzone/machine.rb +70 -0
- data/lib/redzone/mail_exchange.rb +28 -0
- data/lib/redzone/name_server.rb +24 -0
- data/lib/redzone/record.rb +37 -0
- data/lib/redzone/soa.rb +64 -0
- data/lib/redzone/version.rb +6 -0
- data/lib/redzone/zone.rb +279 -0
- data/lib/redzone/zone_config.rb +28 -0
- data/lib/redzone/zonefile_writer.rb +30 -0
- data/lib/redzone.rb +2 -0
- data/redzone.gemspec +32 -0
- data/redzone.rb +279 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/unit/arpa_spec.rb +40 -0
- data/spec/unit/record_spec.rb +60 -0
- data/zones.yml +74 -0
- metadata +121 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RedZone::Arpa do
|
4
|
+
let (:arpa_ipv4) {
|
5
|
+
described_class.new({
|
6
|
+
:name => '32.12.in-addr.arpa',
|
7
|
+
:network => '12.32.0.0/16',
|
8
|
+
:soa => 'mock_soa'
|
9
|
+
})
|
10
|
+
}
|
11
|
+
let (:arpa_ipv6) {
|
12
|
+
described_class.new(
|
13
|
+
:name => '9.8.7.6.4.3.2.1.1.0.0.2.ip6.arpa',
|
14
|
+
:network => '2001:1234:6789::/48',
|
15
|
+
:soa => 'mock_soa'
|
16
|
+
)
|
17
|
+
}
|
18
|
+
context "ipv4 network" do
|
19
|
+
subject { arpa_ipv4 }
|
20
|
+
its(:name) { should == '32.12.in-addr.arpa'}
|
21
|
+
its(:network) { should == IPAddr.new('12.32.0.0/16') }
|
22
|
+
its ("to_s") { should eq("") }
|
23
|
+
|
24
|
+
end
|
25
|
+
context "ipv6 network" do
|
26
|
+
subject { arpa_ipv6 }
|
27
|
+
its (:name) { should == '9.8.7.6.4.3.2.1.1.0.0.2.ip6.arpa' }
|
28
|
+
its (:network) { should == IPAddr.new('2001:1234:6789::/48') }
|
29
|
+
it { subject.to_s.should eq("") }
|
30
|
+
end
|
31
|
+
it 'should require name option' do
|
32
|
+
expect { described_class.new({:network => '12.32.0.0/16', :soa => 'soa'})}.to raise_error(ArgumentError,':name is required')
|
33
|
+
end
|
34
|
+
it 'should require network option' do
|
35
|
+
expect { described_class.new({:name => '32.12.in-addr.arpa', :soa => 'soa'})}.to raise_error(ArgumentError,':network is required')
|
36
|
+
end
|
37
|
+
it 'should require soa option' do
|
38
|
+
expect { described_class.new({:name => '32.12.in-addr.arpa', :network => '12.32.0.0/16' })}.to raise_error(ArgumentError,':soa is required')
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RedZone::Record do
|
4
|
+
it 'should default to IN class' do
|
5
|
+
result = described_class.new({
|
6
|
+
:name => 'name',
|
7
|
+
:type => 'A',
|
8
|
+
:data => '10.1.0.1'
|
9
|
+
})
|
10
|
+
result.to_s.should == "name IN A 10.1.0.1 \n"
|
11
|
+
end
|
12
|
+
it 'should be commentable' do
|
13
|
+
result = described_class.new({
|
14
|
+
:name => 'name',
|
15
|
+
:type => 'A',
|
16
|
+
:data => '10.1.0.1',
|
17
|
+
:comment => 'Comment'
|
18
|
+
})
|
19
|
+
result.to_s.should == "name IN A 10.1.0.1 ; Comment\n"
|
20
|
+
end
|
21
|
+
it 'should have a TTL' do
|
22
|
+
result = described_class.new({
|
23
|
+
:name => 'name',
|
24
|
+
:type => 'A',
|
25
|
+
:data => '10.1.0.1',
|
26
|
+
:ttl => '1d'
|
27
|
+
})
|
28
|
+
result.to_s.should == "name 86400 IN A 10.1.0.1 \n"
|
29
|
+
end
|
30
|
+
it 'should quote TXT records' do
|
31
|
+
result = described_class.new({
|
32
|
+
:name => 'name',
|
33
|
+
:type => 'TXT',
|
34
|
+
:data => 'hello there'
|
35
|
+
})
|
36
|
+
result.to_s.should == "name IN TXT \"hello there\" \n"
|
37
|
+
end
|
38
|
+
it 'should collapse multi-line text records' do
|
39
|
+
result = described_class.new({
|
40
|
+
:name => 'name',
|
41
|
+
:type => 'TXT',
|
42
|
+
:data => <<-eos
|
43
|
+
Line1
|
44
|
+
Line2
|
45
|
+
Line3
|
46
|
+
Line4
|
47
|
+
eos
|
48
|
+
})
|
49
|
+
result.to_s.should == "name IN TXT \"Line1Line2Line3Line4\"\n"
|
50
|
+
end
|
51
|
+
it 'should require name option' do
|
52
|
+
expect { described_class.new({:type => "A", :data => 'b'})}.to raise_error(ArgumentError,':name is required')
|
53
|
+
end
|
54
|
+
it 'should require type option' do
|
55
|
+
expect { described_class.new({:name => "a", :data => 'b'})}.to raise_error(ArgumentError,':type is required')
|
56
|
+
end
|
57
|
+
it 'should require data option' do
|
58
|
+
expect { described_class.new({:name => "a", :type => 'A'})}.to raise_error(ArgumentError,':data is required')
|
59
|
+
end
|
60
|
+
end
|
data/zones.yml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
---
|
2
|
+
zones:
|
3
|
+
common:
|
4
|
+
hostmaster: hostmaster@redzone.com.
|
5
|
+
lifetimes:
|
6
|
+
refresh: 1H
|
7
|
+
retry: 15M
|
8
|
+
expire: 1W
|
9
|
+
negative: 1H
|
10
|
+
ttl: 1H
|
11
|
+
default: platinum
|
12
|
+
mailservers:
|
13
|
+
mx0:
|
14
|
+
priority: 10
|
15
|
+
machine: gold
|
16
|
+
mx1:
|
17
|
+
priority: 20
|
18
|
+
machine: silver
|
19
|
+
nameservers:
|
20
|
+
ns0: gold
|
21
|
+
ns1: silver
|
22
|
+
aliases:
|
23
|
+
www: platinum
|
24
|
+
cnames:
|
25
|
+
db: gold
|
26
|
+
backup: silver
|
27
|
+
search: www.google.com
|
28
|
+
wildcard: platinum
|
29
|
+
redzone.com:
|
30
|
+
arpa:
|
31
|
+
- name: '32.12.in-addr.arpa'
|
32
|
+
network: '12.32.0.0/16'
|
33
|
+
- name: '9.8.7.6.4.3.2.1.1.0.0.2.ip6.arpa'
|
34
|
+
network: '2001:1234:6789::/48'
|
35
|
+
machines:
|
36
|
+
platinum:
|
37
|
+
ipv4: 12.32.56.1
|
38
|
+
ipv6: 2001:1234:6789::1
|
39
|
+
gold:
|
40
|
+
ipv4: 12.32.56.2
|
41
|
+
ipv6: 2001:1234:6789::2
|
42
|
+
silver:
|
43
|
+
ipv4: 12.32.56.3
|
44
|
+
ipv6: 2001:1234:6789::3
|
45
|
+
records:
|
46
|
+
- name: '@'
|
47
|
+
type: TXT
|
48
|
+
ttl: 1W
|
49
|
+
data: '"v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a -all"'
|
50
|
+
- name: dkim._domainkey
|
51
|
+
type: TXT
|
52
|
+
ttl: 12H
|
53
|
+
data: |
|
54
|
+
v=DKIM1; p=
|
55
|
+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYArsr2BKbdhv9efugByf7LhaK
|
56
|
+
txFUt0ec5+1dWmcDv0WH0qZLFK711sibNN5LutvnaiuH+w3Kr8Ylbw8gq2j0UBok
|
57
|
+
FcMycUvOBd7nsYn/TUrOua3Nns+qKSJBy88IWSh2zHaGbjRYujyWSTjlPELJ0H+5
|
58
|
+
EV711qseo/omquskkwIDAQAB
|
59
|
+
qa.redzone.com:
|
60
|
+
arpa:
|
61
|
+
- name: '1.168.192.in-addr.arpa'
|
62
|
+
network: '192.168.1.0/24'
|
63
|
+
- name: '0.0.0.0.0.0.0.0.0.0.c.f.ip6.arpa'
|
64
|
+
network: 'fc00::/48'
|
65
|
+
machines:
|
66
|
+
platinum:
|
67
|
+
ipv4: 192.168.1.1
|
68
|
+
ipv6: fc00::1:1
|
69
|
+
gold:
|
70
|
+
ipv4: 192.168.1.2
|
71
|
+
ipv6: fc00::1:2
|
72
|
+
silver:
|
73
|
+
ipv4: 192.168.1.3
|
74
|
+
ipv6: fc00::1:3
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redzone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justen Walker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ! 'RedZone is a command-line too that can generate bind zone
|
56
|
+
|
57
|
+
files and configuration from yaml syntax.
|
58
|
+
|
59
|
+
'
|
60
|
+
email:
|
61
|
+
- justen.walker@gmail.com
|
62
|
+
executables:
|
63
|
+
- redzone
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- .gitignore
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE.md
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- bin/redzone
|
73
|
+
- lib/redzone.rb
|
74
|
+
- lib/redzone/arpa.rb
|
75
|
+
- lib/redzone/cli.rb
|
76
|
+
- lib/redzone/environment.rb
|
77
|
+
- lib/redzone/lifetime.rb
|
78
|
+
- lib/redzone/machine.rb
|
79
|
+
- lib/redzone/mail_exchange.rb
|
80
|
+
- lib/redzone/name_server.rb
|
81
|
+
- lib/redzone/record.rb
|
82
|
+
- lib/redzone/soa.rb
|
83
|
+
- lib/redzone/version.rb
|
84
|
+
- lib/redzone/zone.rb
|
85
|
+
- lib/redzone/zone_config.rb
|
86
|
+
- lib/redzone/zonefile_writer.rb
|
87
|
+
- redzone.gemspec
|
88
|
+
- redzone.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
- spec/unit/arpa_spec.rb
|
91
|
+
- spec/unit/record_spec.rb
|
92
|
+
- zones.yml
|
93
|
+
homepage: https://github.com/justenwalker/redzone
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 1.8.7
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.2.0
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: RedZone - Automatically generate BIND zone files
|
117
|
+
test_files:
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
- spec/unit/arpa_spec.rb
|
120
|
+
- spec/unit/record_spec.rb
|
121
|
+
has_rdoc:
|