require => File['/etc/sysconfig/iptables'],
}
+ # Redhat 7 selinux user context for /etc/sysconfig/iptables is set to unconfined_u
+ case $::selinux {
+ #lint:ignore:quoted_booleans
+ 'true',true: { $seluser = 'unconfined_u' }
+ #lint:endignore
+ default: { $seluser = undef }
+ }
+
file { '/etc/sysconfig/iptables':
- ensure => present,
- owner => 'root',
- group => 'root',
- mode => '0600',
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0600',
+ seluser => $seluser,
}
}
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
end
end
-end
\ No newline at end of file
+end
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
end
end
-end
\ No newline at end of file
+end
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rule' do
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'finds the chain' do
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'fails to find the chain' do
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'finds the chain' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'should contain the rules' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('ip6tables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
}
EOS
- if fact('selinux') == 'true'
- apply_manifest(pp, :catch_failures => true)
- else
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('ip6tables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('iptables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
}
EOS
- if fact('selinux') == 'true'
- apply_manifest(pp, :catch_failures => true)
- else
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('iptables-save') do |r|
expect(r.stdout).to match(/#{line_match}/)
}
EOS
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'ignores specified rules' do
}
EOS
- if fact('selinux') == 'true'
- apply_manifest(pp, :catch_failures => true)
- else
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'adds managed rules with ignored rules' do
}
EOS
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'ignores specified rules' do
}
EOS
- if fact('selinux') == 'true'
- apply_manifest(pp, :catch_failures => true)
- else
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'adds managed rules with ignored rules' do
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
it 'contains appropriate rules' do
EOS
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('iptables-save -t raw') do |r|
expect(r.stdout).to match(/#{line_match}/)
}
EOS
- if fact('selinux') == 'true'
- apply_manifest(pp, :catch_failures => true)
- else
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
shell('iptables-save -t raw') do |r|
expect(r.stdout).to match(/#{line_match}/)
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
- unless fact('selinux') == 'true'
- apply_manifest(pp, :catch_changes => true)
- end
+ apply_manifest(pp, :catch_changes => true)
end
end