dns-catalog_zone 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -0
  4. data/.coveralls.yml +2 -0
  5. data/.gitignore +13 -0
  6. data/.rspec +1 -0
  7. data/.travis.yml +11 -0
  8. data/Gemfile +9 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.jp.md +115 -0
  11. data/README.md +113 -0
  12. data/Rakefile +8 -0
  13. data/bin/catz +33 -0
  14. data/certs/mimuret.pem +21 -0
  15. data/dns-catalog_zone.gemspec +33 -0
  16. data/lib/dns/catalog_zone.rb +40 -0
  17. data/lib/dns/catalog_zone/catalog_zone.rb +125 -0
  18. data/lib/dns/catalog_zone/cli.rb +88 -0
  19. data/lib/dns/catalog_zone/config.rb +83 -0
  20. data/lib/dns/catalog_zone/errors.rb +32 -0
  21. data/lib/dns/catalog_zone/helper.rb +98 -0
  22. data/lib/dns/catalog_zone/master.rb +47 -0
  23. data/lib/dns/catalog_zone/output.rb +44 -0
  24. data/lib/dns/catalog_zone/output/base.rb +42 -0
  25. data/lib/dns/catalog_zone/output/file.rb +57 -0
  26. data/lib/dns/catalog_zone/output/stdout.rb +41 -0
  27. data/lib/dns/catalog_zone/prefixes.rb +45 -0
  28. data/lib/dns/catalog_zone/provider.rb +46 -0
  29. data/lib/dns/catalog_zone/provider/base.rb +66 -0
  30. data/lib/dns/catalog_zone/provider/knot.rb +278 -0
  31. data/lib/dns/catalog_zone/provider/nsd.rb +106 -0
  32. data/lib/dns/catalog_zone/provider/yadifa.rb +139 -0
  33. data/lib/dns/catalog_zone/source.rb +47 -0
  34. data/lib/dns/catalog_zone/source/axfr.rb +54 -0
  35. data/lib/dns/catalog_zone/source/base.rb +59 -0
  36. data/lib/dns/catalog_zone/source/file.rb +49 -0
  37. data/lib/dns/catalog_zone/version.rb +27 -0
  38. data/lib/dns/catalog_zone/zone.rb +39 -0
  39. data/share/CatalogZone +24 -0
  40. data/share/knotd-catalog.sh +32 -0
  41. data/share/nsd-catalog.sh +37 -0
  42. data/share/yadifad-catalog.sh +34 -0
  43. metadata +183 -0
  44. metadata.gz.sig +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec0b7a879e6987741edcd46b44d1669ae8a9499d
4
+ data.tar.gz: bd89245cee2b584b38bb2ca53e156d34e4296c75
5
+ SHA512:
6
+ metadata.gz: d22ec544b8e6d803d3541473de194d39ecc57e2de5697125562bf9840e11f71c01b943debac8997b523911b6d4c73c72d0b72e7ce1393113d9b28c2e37e7e878
7
+ data.tar.gz: c04edbf61524e3374dadeaefc1e9a4d882846324b4678e8da732ff6316cd52eca009f29e6b0267250eef64c99acf92d883de400ffa2be6eacc0f06d34f2c3096
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ��{��'?Y���U=A�������Q���kue1C��l�v`}�]�������D�vӼҦ���#�~�G��,��
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+ repo_token: Q0UP5sLFpl56uOFsDyP5uFSPhoYanQYKh
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/
11
+ /CatalogZone
12
+ *.gem
13
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ dist: trusty
3
+ cache: bundler
4
+ sudo: false
5
+ script: "bundle exec rake test"
6
+ rvm:
7
+ - 2.1.10
8
+ - 2.2.6
9
+ - 2.3.3
10
+ - 2.4.0
11
+ - ruby-head
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dns-catalog_zone.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'coveralls', require: false
8
+ gem 'minitest', '>5'
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Manabu Sonoda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.jp.md ADDED
@@ -0,0 +1,115 @@
1
+ # Dns::CatalogZone
2
+ [![Build Status](https://travis-ci.org/mimuret/dns-catalog_zone.svg?branch=master)](https://travis-ci.org/mimuret/dns-catalog_zone)
3
+ [![Coverage Status](https://coveralls.io/repos/github/mimuret/dns-catalog_zone/badge.svg?branch=master)](https://coveralls.io/github/mimuret/dns-catalog_zone?branch=master)
4
+
5
+ PoC of catalog zone (draft-muks-dnsop-dns-catalog-zones)
6
+ [README in English](https://github.com/mimuret/dns-catalog_zone/blob/master/README.md)
7
+
8
+ ## supported name server softwares
9
+ * NSD4 (default)
10
+ * Knot dns
11
+ * YADIFA
12
+
13
+ ## インストール方法
14
+
15
+ ```bash
16
+ $ git clone https://github.com/mimuret/dns-catalog_zone
17
+ $ cd dns-catalog_zone
18
+ $ bundle install --path=vendor/bundle
19
+ ```
20
+
21
+ ## 使い方
22
+
23
+ + configuration
24
+
25
+ CatalogZoneファイルを生成します。
26
+
27
+ ```bash
28
+ $ bundle exec catz init
29
+ $ cat CatalogZone
30
+ ```
31
+
32
+ CatalogZoneの中身
33
+ ```ruby
34
+ setting("catalog.example.jp") do |s|
35
+ s.software="nsd"
36
+ s.source="file"
37
+ s.zonename="catalog.example.jp"
38
+ s.zonefile="/etc/nsd/catalog.example.jp.zone"
39
+ end
40
+ ````
41
+
42
+ + name server config生成
43
+
44
+ ```bash
45
+ $ bundle exec catz make
46
+ ```
47
+
48
+ 各実装の反映用のscriptはshare dirにあります。
49
+
50
+ ## Settings attribute
51
+ | name | value | default | description |
52
+ |:-----------|------------|:------------|:------------|
53
+ |zonename|string(domain name)|catalog.example| catalog zone domain name |
54
+ |software|string|nsd|software module name|
55
+ |source|string|file|source module name|
56
+ |output|string|stdout|output module name|
57
+
58
+ ### source modules
59
+ #### file module
60
+ | name | value | required |
61
+ |:-----------|:------------|:------------|
62
+ |source|file|true|
63
+ |zonefile|path|true|
64
+
65
+ #### axfr module
66
+ | name | value | default |required |
67
+ |:-----------|:------------|:------------|:------------|
68
+ |source|axfr||true|
69
+ |server|ip or hostname||true|
70
+ |port|int|53|false|
71
+ |tsig|string||false|
72
+ |src_address|ip||false|
73
+ |timeout|int|30|false|
74
+
75
+ ### software modules
76
+ #### nsd module
77
+ | name | value | required |
78
+ |:-----------|:------------|:------------|
79
+ |software|nsd||
80
+
81
+ #### knot module
82
+ | name | value | required |
83
+ |:-----------|:------------|:------------|
84
+ |software|knot||
85
+
86
+ #### yadifa module
87
+ | name | value | required |
88
+ |:-----------|:------------|:------------|
89
+ |software|yadifa||
90
+
91
+ ### output modules
92
+ #### stdout module
93
+ | name | value | required |
94
+ |:-----------|:------------|:------------|
95
+ |output|stdout||
96
+
97
+ #### file module
98
+ | name | value | required |
99
+ |:-----------|:------------|:------------|
100
+ |output|file||
101
+ |output_path|path|true|
102
+
103
+ ## Contributing
104
+
105
+ バグレポートとプルリクエストはGitHub(https://github.com/mimuret/dns-catalog_zone)まで
106
+
107
+ 対応するソフトウェアを増やしたい場合はプルリクエストしてマージするか、
108
+
109
+ Dns::CatalogZone::Provider::(作りたい実装名)のクラスを作ってLOAD_PATHにおいてください。
110
+
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
115
+
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Dns::CatalogZone
2
+ [![Build Status](https://travis-ci.org/mimuret/dns-catalog_zone.svg?branch=master)](https://travis-ci.org/mimuret/dns-catalog_zone)
3
+ [![Coverage Status](https://coveralls.io/repos/github/mimuret/dns-catalog_zone/badge.svg?branch=master)](https://coveralls.io/github/mimuret/dns-catalog_zone?branch=master)
4
+
5
+ PoC of catalog zone (draft-muks-dnsop-dns-catalog-zones)
6
+ [README in Japanese](https://github.com/mimuret/dns-catalog_zone/blob/master/README.jp.md)
7
+
8
+ ## supported name server softwares
9
+ * NSD4 (default)
10
+ * Knot dns
11
+ * YADIFA
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ $ git clone https://github.com/mimuret/dns-catalog_zone
17
+ $ cd dns-catalog_zone
18
+ $ bundle install --path=vendor/bundle
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ + configuration
24
+
25
+ make CatalogZone file.
26
+
27
+ ```bash
28
+ $ bundle exec catz init
29
+ $ cat CatalogZone
30
+ ```
31
+
32
+ CatalogZone below
33
+ ```ruby
34
+ setting("catalog.example.jp") do |s|
35
+ s.software="nsd"
36
+ s.source="file"
37
+ s.zonename="catalog.example.jp"
38
+ s.zonefile="/etc/nsd/catalog.example.jp.zone"
39
+ end
40
+ ````
41
+
42
+ + make name server config
43
+
44
+ config output to stdout
45
+ ```bash
46
+ $ bundle exec catz make
47
+ ```
48
+
49
+
50
+ ## Settings attribute
51
+ | name | value | default | description |
52
+ |:-----------|------------|:------------|:------------|
53
+ |zonename|string(domain name)|catalog.example| catalog zone domain name |
54
+ |software|string|nsd|software module name|
55
+ |source|string|file|source module name|
56
+ |output|string|stdout|output module name|
57
+
58
+ ### source modules
59
+ #### file module
60
+ | name | value | required |
61
+ |:-----------|:------------|:------------|
62
+ |source|file|true|
63
+ |zonefile|path|true|
64
+
65
+ #### axfr module
66
+ | name | value | default |required |
67
+ |:-----------|:------------|:------------|:------------|
68
+ |source|axfr||true|
69
+ |server|ip or hostname||true|
70
+ |port|int|53|false|
71
+ |tsig|string||false|
72
+ |src_address|ip||false|
73
+ |timeout|int|30|false|
74
+
75
+ ### software modules
76
+ #### nsd module
77
+ | name | value | required |
78
+ |:-----------|:------------|:------------|
79
+ |software|nsd||
80
+
81
+ #### knot module
82
+ | name | value | required |
83
+ |:-----------|:------------|:------------|
84
+ |software|knot||
85
+
86
+ #### yadifa module
87
+ | name | value | required |
88
+ |:-----------|:------------|:------------|
89
+ |software|yadifa||
90
+
91
+ ### output modules
92
+ #### stdout module
93
+ | name | value | required |
94
+ |:-----------|:------------|:------------|
95
+ |output|stdout||
96
+
97
+ #### file module
98
+ | name | value | required |
99
+ |:-----------|:------------|:------------|
100
+ |output|file||
101
+ |output_path|path|true|
102
+
103
+ ## Contributing
104
+
105
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mimuret/dns-catalog_zone.
106
+
107
+ OR make Dns::CatalogZone::Provider::(Software) gem
108
+
109
+
110
+ ## License
111
+
112
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
113
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |test|
5
+ test.libs << 'test'
6
+ test.test_files = Dir['test/**/t_*.rb']
7
+ test.verbose = true
8
+ end
data/bin/catz ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2016 Manabu Sonoda
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ begin
26
+ require 'dns/catalog_zone'
27
+ require 'dns/catalog_zone/cli'
28
+
29
+ Dns::CatalogZone::Cli.start
30
+ rescue Dns::CatalogZone::ConfigNotFound
31
+ puts 'config file not found. please run [catz init]'
32
+ exit 1
33
+ end
data/certs/mimuret.pem ADDED
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MRAwDgYDVQQDDAdtaW11
3
+ cmV0MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNjb20w
4
+ HhcNMT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96bhASHLL7EqN4g2QTOIu42jX
20
+ DKPIX0hHK6LpcHPQEP8FyQ==
21
+ -----END CERTIFICATE-----
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dns/catalog_zone/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'dns-catalog_zone'
8
+ spec.version = Dns::CatalogZone::VERSION
9
+ spec.authors = ['Manabu Sonoda']
10
+ spec.email = ['mimuret@gmail.com']
11
+
12
+ spec.summary = 'create zone config from catalog zone file.'
13
+ spec.description = 'create zone config from catalog zone file.'
14
+ spec.homepage = 'https://github.com/mimuret/dns-catalog_zone'
15
+ spec.license = 'MIT'
16
+
17
+ spec.cert_chain = ['certs/mimuret.pem']
18
+ spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME.end_with?('gem')
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
+ spec.required_ruby_version = ">= 2.2.2"
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.12'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_runtime_dependency 'dnsruby', '~> 1.60', '>= 1.60.1'
31
+ spec.add_runtime_dependency 'thor', '~> 0'
32
+ spec.add_runtime_dependency 'camelizable', '~> 0'
33
+ end
@@ -0,0 +1,40 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2016 Manabu Sonoda
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require 'dns/catalog_zone/version'
24
+ require 'dns/catalog_zone/helper'
25
+ require 'dns/catalog_zone/errors'
26
+ require 'dns/catalog_zone/output'
27
+ require 'dns/catalog_zone/provider'
28
+ require 'dns/catalog_zone/source'
29
+ require 'dns/catalog_zone/config'
30
+ require 'dns/catalog_zone/zone'
31
+ require 'dns/catalog_zone/master'
32
+ require 'dns/catalog_zone/prefixes'
33
+ require 'dns/catalog_zone/catalog_zone'
34
+ require 'dnsruby'
35
+
36
+ module Dns
37
+ # Dns::CatalogZone
38
+ module CatalogZone
39
+ end
40
+ end