@@ -86,29 +86,6 @@ class { '::firewall': }
8686 end
8787 end
8888 end
89-
90- context 'when multiple addrtype fail' , if : ( os [ :family ] == 'redhat' && os [ :release ] . start_with? ( '5' ) ) do
91- pp = <<-PUPPETCODE
92- class { '::firewall': }
93- firewall { '616 - test':
94- proto => tcp,
95- jump => accept,
96- #{ type } => ['LOCAL', '! LOCAL'],
97- protocol => 'IPv6',
98- }
99- PUPPETCODE
100- it 'fails' do
101- apply_manifest ( pp , expect_failures : true ) do |r |
102- expect ( r . stderr ) . to match ( %r{Multiple #{ type } elements are available from iptables version} )
103- end
104- end
105-
106- it 'does not contain the rule' do
107- run_shell ( 'ip6tables-save' ) do |r |
108- expect ( r . stdout ) . not_to match ( %r{-A INPUT -p (tcp|6) -m addrtype --#{ type . tr ( '_' , '-' ) } LOCAL -m addrtype ! --#{ type . tr ( '_' , '-' ) } LOCAL -m comment --comment "616 - test" -j ACCEPT} )
109- end
110- end
111- end
11289 end
11390 end
11491
@@ -139,61 +116,6 @@ class { '::firewall': }
139116 end
140117 end
141118
142- # ipset is hard to test, only testing on ubuntu 14
143- describe 'ipset' , if : ( os [ :family ] == 'redhat' && os [ :release ] . start_with? ( '14' ) ) do
144- before ( :all ) do
145- pp = <<-PUPPETCODE
146- exec { 'hackery pt 1':
147- command => 'service iptables-persistent flush',
148- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
149- }
150- package { 'ipset':
151- ensure => present,
152- require => Exec['hackery pt 1'],
153- }
154- exec { 'hackery pt 2':
155- command => 'service iptables-persistent start',
156- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
157- require => Package['ipset'],
158- }
159- class { '::firewall': }
160- exec { 'create ipset blacklist':
161- command => 'ipset create blacklist hash:ip,port family inet6 maxelem 1024 hashsize 65535 timeout 120',
162- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
163- require => Package['ipset'],
164- }
165- -> exec { 'create ipset honeypot':
166- command => 'ipset create honeypot hash:ip family inet6 maxelem 1024 hashsize 65535 timeout 120',
167- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
168- }
169- -> exec { 'add blacklist':
170- command => 'ipset add blacklist 2001:db8::1,80',
171- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
172- }
173- -> exec { 'add honeypot':
174- command => 'ipset add honeypot 2001:db8::5',
175- path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
176- }
177- firewall { '612 - test':
178- ensure => present,
179- chain => 'INPUT',
180- proto => tcp,
181- jump => drop,
182- ipset => ['blacklist src,dst', '! honeypot dst'],
183- protocol => 'IPv6',
184- require => Exec['add honeypot'],
185- }
186- PUPPETCODE
187- apply_manifest ( pp , catch_failures : true )
188- end
189-
190- it 'contains the rule' do
191- run_shell ( 'ip6tables-save' ) do |r |
192- expect ( r . stdout ) . to match ( %r{-A INPUT -p (tcp|6) -m set --match-set blacklist src,dst -m set ! --match-set honeypot dst -m comment --comment "612 - test" -j DROP} )
193- end
194- end
195- end
196-
197119 describe 'src_range' do
198120 context 'when 2001::db8::1-2001:db8::ff' do
199121 pp = <<-PUPPETCODE
0 commit comments