aboutsummaryrefslogtreecommitdiff
path: root/spec/defines
diff options
context:
space:
mode:
authorRehan Mahmood <rehanone@gmail.com>2020-05-04 14:11:05 -0400
committerRehan Mahmood <rehanone@gmail.com>2020-05-07 00:27:49 -0400
commit6be13799d8a2ee49c3af88ffd7a474c39f1475e3 (patch)
tree77bc411088472f3e6db4e5095857d7cc550e0cb8 /spec/defines
parent6362585d53490ff9e837af1359d8e80f8053d0fc (diff)
downloadpuppet-ferm-6be13799d8a2ee49c3af88ffd7a474c39f1475e3.tar.gz
puppet-ferm-6be13799d8a2ee49c3af88ffd7a474c39f1475e3.tar.bz2
Allow adding custom ferm dsl for subchains. This is important for using complex iptable rules that are currently not supported by this module or would be very hard to manage just using puppet.
Diffstat (limited to 'spec/defines')
-rw-r--r--spec/defines/chain_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/defines/chain_spec.rb b/spec/defines/chain_spec.rb
index 1a6bb44..52cc88c 100644
--- a/spec/defines/chain_spec.rb
+++ b/spec/defines/chain_spec.rb
@@ -70,6 +70,34 @@ describe 'ferm::chain', type: :define do
it { is_expected.to compile.and_raise_error(%r{Can only set a default policy for builtin chains}) }
end
+
+ context 'with custom chain FERM-DSL using content parameter' do
+ let(:title) { 'FERM-DSL' }
+ let :params do
+ {
+ content: 'mod rpfilter invert DROP;'
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_concat__fragment('filter-FERM-DSL-config-include') }
+ it do
+ is_expected.to contain_concat__fragment('filter-FERM-DSL-custom-content'). \
+ with_content(%r{mod rpfilter invert DROP;})
+ end
+ it do
+ is_expected.not_to contain_concat__fragment('filter-FERM-DSL-policy')
+ end
+ it do
+ is_expected.not_to contain_concat__fragment('filter-FERM-DSL-footer')
+ end
+ if facts[:os]['name'] == 'Debian'
+ it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-FERM-DSL.conf') }
+ else
+ it { is_expected.to contain_concat('/etc/ferm.d/chains/filter-FERM-DSL.conf') }
+ end
+ it { is_expected.to contain_ferm__chain('FERM-DSL') }
+ end
end
end
end