smart_proxy_dns_infoblox 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93913c19fdbb004b2265f61341b782c234eb4b7d
|
4
|
+
data.tar.gz: 063e1118acfb2a85593c2b774d382663239493dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd8344ceffca0e6344b0ba7c2b86fd540df89fc2089f51e32d11e3179092f6dcf5137b46673c9a8e73a53acadd644bdc275bb8a32ca9412b661d64c22fea612
|
7
|
+
data.tar.gz: 90300ea7cc4e2083ed376fe7138c93e00352287847494ab020bbd0cc0eda8668d1be9138631cfc2d9c28fc03c049d00e19e30c5463dcdc68198ecb113e6e855b
|
data/bundler.d/dns_infoblox.rb
CHANGED
@@ -8,51 +8,74 @@ module Proxy::Dns::Infoblox
|
|
8
8
|
super(host, ttl)
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
when 0 then
|
16
|
-
return nil
|
17
|
-
else
|
18
|
-
do_create(Infoblox::Arecord, :connection => connection, :name => fqdn, :ipv4addr => ip)
|
19
|
-
end
|
11
|
+
def do_create(name, value, type)
|
12
|
+
method = "ib_create_#{type.downcase}_record".to_sym
|
13
|
+
raise(Proxy::Dns::Error, "Creation of #{type} records not implemented") unless respond_to?(method, true)
|
14
|
+
send(method, name, value)
|
20
15
|
end
|
21
16
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
when 0 then
|
27
|
-
return nil
|
28
|
-
else
|
29
|
-
do_create(Infoblox::Ptr, :connection => connection, :ptrdname => fqdn, :ipv4addr => ptr_to_ip(ptr))
|
30
|
-
end
|
31
|
-
# FIXME: add a reverse 'PTR' record with ip, fqdn
|
17
|
+
def do_remove(name, type)
|
18
|
+
method = "ib_remove_#{type.downcase}_record".to_sym
|
19
|
+
raise(Proxy::Dns::Error, "Deletion of #{type} records not implemented") unless respond_to?(method, true)
|
20
|
+
send(method, name)
|
32
21
|
end
|
33
22
|
|
34
|
-
|
35
|
-
|
23
|
+
private
|
24
|
+
|
25
|
+
def ib_create_a_record(fqdn, address)
|
26
|
+
ib_create(Infoblox::Arecord, :name => fqdn, :ipv4addr => address)
|
36
27
|
end
|
37
28
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
ptr_record.ipv6addr = nil
|
42
|
-
ptr_record.view = nil
|
43
|
-
end
|
29
|
+
def ib_remove_a_record(fqdn)
|
30
|
+
ib_delete(Infoblox::Arecord, :name => fqdn)
|
31
|
+
end
|
44
32
|
|
45
|
-
|
46
|
-
|
33
|
+
def ib_create_aaaa_record(fqdn, address)
|
34
|
+
ib_create(Infoblox::AAAArecord, :name => fqdn, :ipv6addr => address)
|
47
35
|
end
|
48
36
|
|
49
|
-
def
|
50
|
-
|
37
|
+
def ib_remove_aaaa_record(fqdn)
|
38
|
+
ib_delete(Infoblox::AAAArecord, :name => fqdn)
|
51
39
|
end
|
52
40
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
41
|
+
def ib_create_cname_record(fqdn, target)
|
42
|
+
ib_create(Infoblox::Cname, :name => fqdn, :canonical => target)
|
43
|
+
end
|
44
|
+
|
45
|
+
def ib_remove_cname_record(fqdn)
|
46
|
+
ib_delete(Infoblox::Cname, :name => fqdn)
|
47
|
+
end
|
48
|
+
|
49
|
+
def ib_create_ptr_record(ptr, fqdn)
|
50
|
+
ip = IPAddr.new(ptr_to_ip(ptr))
|
51
|
+
|
52
|
+
params = {
|
53
|
+
:ptrdname => fqdn,
|
54
|
+
:name => ptr
|
55
|
+
}
|
56
|
+
params["ipv#{ip.ipv4? ? 4 : 6}addr".to_sym] = ip.to_s
|
57
|
+
|
58
|
+
ib_create(Infoblox::Ptr, params)
|
59
|
+
end
|
60
|
+
|
61
|
+
def ib_remove_ptr_record(ptr)
|
62
|
+
ip = IPAddr.new(ptr_to_ip(ptr))
|
63
|
+
|
64
|
+
params = {}
|
65
|
+
params["ipv#{ip.ipv4? ? 4 : 6}addr".to_sym] = ip.to_s
|
66
|
+
|
67
|
+
ib_delete(Infoblox::Ptr, params)
|
68
|
+
end
|
69
|
+
|
70
|
+
def ib_create(clazz, params)
|
71
|
+
clazz.new({ :connection => connection }.merge(params)).post
|
72
|
+
end
|
73
|
+
|
74
|
+
def ib_delete(clazz, params)
|
75
|
+
record = clazz.find(connection, params.merge(:_max_results => 1)).first
|
76
|
+
|
77
|
+
raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}" if record.nil?
|
78
|
+
record.delete || (raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}")
|
56
79
|
end
|
57
80
|
end
|
58
81
|
end
|
data/test/infoblox_test.rb
CHANGED
@@ -10,35 +10,31 @@ class InfobloxTest < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def setup
|
13
|
-
@
|
14
|
-
@record = DummyRecord.new
|
15
|
-
@provider = Proxy::Dns::Infoblox::Record.new('a_host', @connection, 999)
|
13
|
+
@provider = Proxy::Dns::Infoblox::Record.new('a_host', nil, 999)
|
16
14
|
end
|
17
15
|
|
18
16
|
def test_create_a
|
19
17
|
fqdn = 'test.example.com'
|
20
18
|
ip = '10.1.1.1'
|
21
19
|
|
22
|
-
@provider.expects(:
|
23
|
-
@provider.
|
24
|
-
|
25
|
-
@provider.create_a_record(fqdn, ip)
|
20
|
+
@provider.expects(:ib_create).with(Infoblox::Arecord, :name => fqdn, :ipv4addr => ip)
|
21
|
+
@provider.do_create(fqdn, ip, 'A')
|
26
22
|
end
|
27
23
|
|
28
|
-
def
|
24
|
+
def test_create_aaaa
|
29
25
|
fqdn = 'test.example.com'
|
30
|
-
ip = '
|
26
|
+
ip = '2002:fc80::2'
|
31
27
|
|
32
|
-
@provider.expects(:
|
33
|
-
|
28
|
+
@provider.expects(:ib_create).with(Infoblox::AAAArecord, :name => fqdn, :ipv6addr => ip)
|
29
|
+
@provider.do_create(fqdn, ip, 'AAAA')
|
34
30
|
end
|
35
31
|
|
36
|
-
def
|
32
|
+
def test_create_cname
|
37
33
|
fqdn = 'test.example.com'
|
38
|
-
|
34
|
+
target = 'test-2.example.com'
|
39
35
|
|
40
|
-
@provider.expects(:
|
41
|
-
|
36
|
+
@provider.expects(:ib_create).with(Infoblox::Cname, :name => fqdn, :canonical => target)
|
37
|
+
@provider.do_create(fqdn, target, 'CNAME')
|
42
38
|
end
|
43
39
|
|
44
40
|
def test_create_ptr
|
@@ -46,70 +42,53 @@ class InfobloxTest < Test::Unit::TestCase
|
|
46
42
|
ptr = '1.1.1.10.in-addr.arpa'
|
47
43
|
ip = '10.1.1.1'
|
48
44
|
|
49
|
-
@provider.expects(:
|
50
|
-
@provider.
|
51
|
-
|
52
|
-
@provider.create_ptr_record(fqdn, ptr)
|
45
|
+
@provider.expects(:ib_create).with(Infoblox::Ptr, :name => ptr, :ptrdname => fqdn, :ipv4addr => ip)
|
46
|
+
@provider.do_create(ptr, fqdn, 'PTR')
|
53
47
|
end
|
54
48
|
|
55
|
-
def
|
49
|
+
def test_create_ptr_v6
|
56
50
|
fqdn = 'test.example.com'
|
57
|
-
ptr = '
|
58
|
-
ip = '
|
51
|
+
ptr = '8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.ip6.arpa'
|
52
|
+
ip = '1:2:3:4:5:6:7:8'
|
59
53
|
|
60
|
-
@provider.expects(:
|
61
|
-
|
54
|
+
@provider.expects(:ib_create).with(Infoblox::Ptr, :name => ptr, :ptrdname => fqdn, :ipv6addr => ip)
|
55
|
+
@provider.do_create(ptr, fqdn, 'PTR')
|
62
56
|
end
|
63
57
|
|
64
|
-
def
|
58
|
+
def test_remove_a
|
65
59
|
fqdn = 'test.example.com'
|
66
|
-
ptr = '1.1.1.10.in-addr.arpa'
|
67
|
-
ip = '10.1.1.1'
|
68
60
|
|
69
|
-
@provider.expects(:
|
70
|
-
|
61
|
+
@provider.expects(:ib_delete).with(Infoblox::Arecord, :name => fqdn)
|
62
|
+
@provider.do_remove(fqdn, 'A')
|
71
63
|
end
|
72
64
|
|
73
|
-
def
|
65
|
+
def test_remove_aaaa
|
74
66
|
fqdn = 'test.example.com'
|
75
|
-
Infoblox::Arecord.expects(:find).with(@connection, :name => fqdn, :_max_results => 1).returns([@record])
|
76
|
-
@record.expects(:delete).returns(true)
|
77
|
-
@provider.remove_a_record(fqdn)
|
78
|
-
end
|
79
67
|
|
80
|
-
|
81
|
-
fqdn
|
82
|
-
Infoblox::Arecord.expects(:find).with(@connection, :name => fqdn, :_max_results => 1).returns([])
|
83
|
-
assert_raises(Proxy::Dns::NotFound) { @provider.remove_a_record(fqdn) }
|
68
|
+
@provider.expects(:ib_delete).with(Infoblox::AAAArecord, :name => fqdn)
|
69
|
+
@provider.do_remove(fqdn, 'AAAA')
|
84
70
|
end
|
85
71
|
|
86
|
-
def
|
72
|
+
def test_remove_cname
|
87
73
|
fqdn = 'test.example.com'
|
88
|
-
|
89
|
-
@
|
90
|
-
|
74
|
+
|
75
|
+
@provider.expects(:ib_delete).with(Infoblox::Cname, :name => fqdn)
|
76
|
+
@provider.do_remove(fqdn, 'CNAME')
|
91
77
|
end
|
92
78
|
|
93
79
|
def test_remove_ptr
|
94
80
|
ptr = '1.1.1.10.in-addr.arpa'
|
95
81
|
ip = '10.1.1.1'
|
96
|
-
Infoblox::Ptr.expects(:find).with(@connection, :ipv4addr => ip, :_max_results => 1).returns([@record])
|
97
|
-
@record.expects(:delete).returns(true)
|
98
|
-
@provider.remove_ptr_record(ptr)
|
99
|
-
end
|
100
82
|
|
101
|
-
|
102
|
-
ptr
|
103
|
-
ip = '10.1.1.1'
|
104
|
-
Infoblox::Ptr.expects(:find).with(@connection, :ipv4addr => ip, :_max_results => 1).returns([])
|
105
|
-
assert_raises(Proxy::Dns::NotFound) { @provider.remove_ptr_record(ptr) }
|
83
|
+
@provider.expects(:ib_delete).with(Infoblox::Ptr, :ipv4addr => ip)
|
84
|
+
@provider.do_remove(ptr, 'PTR')
|
106
85
|
end
|
107
86
|
|
108
|
-
def
|
109
|
-
ptr = '
|
110
|
-
ip = '
|
111
|
-
|
112
|
-
@
|
113
|
-
|
87
|
+
def test_remove_ptr_v6
|
88
|
+
ptr = '8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.ip6.arpa'
|
89
|
+
ip = '1:2:3:4:5:6:7:8'
|
90
|
+
|
91
|
+
@provider.expects(:ib_delete).with(Infoblox::Ptr, :ipv6addr => ip)
|
92
|
+
@provider.do_remove(ptr, 'PTR')
|
114
93
|
end
|
115
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_dns_infoblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Nicholson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Infoblox DNS provider plugin for Foreman's smart proxy
|
14
14
|
email:
|
@@ -29,9 +29,9 @@ files:
|
|
29
29
|
- test/configuration_test.rb
|
30
30
|
- test/infoblox_test.rb
|
31
31
|
- test/test_helper.rb
|
32
|
-
homepage: https://github.com/
|
32
|
+
homepage: https://github.com/theforeman/smart_proxy_dns_infoblox
|
33
33
|
licenses:
|
34
|
-
-
|
34
|
+
- GPL-3.0
|
35
35
|
metadata: {}
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options: []
|
@@ -49,11 +49,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
52
|
+
rubygems_version: 2.6.12
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Infoblox DNS provider plugin for Foreman's smart proxy
|
56
56
|
test_files:
|
57
|
-
- test/configuration_test.rb
|
58
57
|
- test/infoblox_test.rb
|
59
58
|
- test/test_helper.rb
|
59
|
+
- test/configuration_test.rb
|