aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2019-09-12 15:01:58 +0200
committerTim Meusel <tim@bastelfreak.de>2019-09-12 22:54:38 +0200
commit221c45769e56ffda0ac82bd035e0ef5f37706836 (patch)
treea28cc8e9d862abac0491b4d2cfd412461567a05c /spec
parent439e71b110e769d8164c4491a6662ac6f2b089db (diff)
downloadpuppet-ferm-221c45769e56ffda0ac82bd035e0ef5f37706836.tar.gz
puppet-ferm-221c45769e56ffda0ac82bd035e0ef5f37706836.tar.bz2
readd Debian 9/10 support
Diffstat (limited to 'spec')
-rw-r--r--spec/acceptance/ferm_spec.rb20
-rw-r--r--spec/classes/ferm_spec.rb6
-rw-r--r--spec/defines/chain_spec.rb2
-rw-r--r--spec/defines/rule_spec.rb2
4 files changed, 22 insertions, 8 deletions
diff --git a/spec/acceptance/ferm_spec.rb b/spec/acceptance/ferm_spec.rb
index b0c41a5..c5018da 100644
--- a/spec/acceptance/ferm_spec.rb
+++ b/spec/acceptance/ferm_spec.rb
@@ -12,6 +12,20 @@ manage_initfile = case sut_os
false
end
+iptables_output = case sut_os
+ when 'Debian-10'
+ [
+ '-A INPUT -p tcp -m tcp --dport 22 -m comment --comment allow_acceptance_tests -j ACCEPT',
+ '-A INPUT -p tcp -m tcp --dport 80 -m comment --comment jump_http -j HTTP',
+ '-A HTTP -s 127.0.0.1/32 -p tcp -m tcp --dport 80 -m comment --comment allow_http_localhost -j ACCEPT'
+ ]
+ else
+ [
+ '-A INPUT -p tcp -m comment --comment ["]*allow_acceptance_tests["]* -m tcp --dport 22 -j ACCEPT',
+ '-A INPUT -p tcp -m comment --comment ["]*jump_http["]* -m tcp --dport 80 -j HTTP',
+ '-A HTTP -s 127.0.0.1/32 -p tcp -m comment --comment ["]*allow_http_localhost["]* -m tcp --dport 80 -j ACCEPT'
+ ]
+ end
basic_manifest = %(
class { 'ferm':
manage_service => true,
@@ -57,7 +71,7 @@ describe 'ferm' do
describe iptables do
it do
- is_expected.to have_rule('-A INPUT -p tcp -m comment --comment ["]*allow_acceptance_tests["]* -m tcp --dport 22 -j ACCEPT'). \
+ is_expected.to have_rule(iptables_output[0]). \
with_table('filter'). \
with_chain('INPUT')
end
@@ -97,12 +111,12 @@ describe 'ferm' do
describe iptables do
it do
- is_expected.to have_rule('-A INPUT -p tcp -m comment --comment ["]*jump_http["]* -m tcp --dport 80 -j HTTP'). \
+ is_expected.to have_rule(iptables_output[1]). \
with_table('filter'). \
with_chain('INPUT')
end
it do
- is_expected.to have_rule('-A HTTP -s 127.0.0.1/32 -p tcp -m comment --comment ["]*allow_http_localhost["]* -m tcp --dport 80 -j ACCEPT'). \
+ is_expected.to have_rule(iptables_output[2]). \
with_table('filter'). \
with_chain('HTTP')
end
diff --git a/spec/classes/ferm_spec.rb b/spec/classes/ferm_spec.rb
index 225577b..3257fca 100644
--- a/spec/classes/ferm_spec.rb
+++ b/spec/classes/ferm_spec.rb
@@ -17,7 +17,7 @@ describe 'ferm' do
it { is_expected.to contain_class('ferm::service') }
it { is_expected.to contain_class('ferm::install') }
it { is_expected.to contain_package('ferm') }
- if facts[:os]['release']['major'].to_i == 10
+ if facts[:os]['name'] == 'Debian'
it { is_expected.to contain_file('/etc/ferm/ferm.d') }
it { is_expected.to contain_file('/etc/ferm/ferm.d/definitions') }
it { is_expected.to contain_file('/etc/ferm/ferm.d/chains') }
@@ -51,7 +51,7 @@ describe 'ferm' do
{ manage_configfile: true }
end
- if facts[:os]['name'] == 'Ubuntu' || facts[:os]['release']['major'].to_i == 10
+ if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_concat('/etc/ferm/ferm.conf') }
else
it { is_expected.to contain_concat('/etc/ferm.conf') }
@@ -102,7 +102,7 @@ describe 'ferm' do
it { is_expected.to contain_concat__fragment('filter-INPUT-policy') }
it { is_expected.to contain_concat__fragment('filter-FORWARD-policy') }
it { is_expected.to contain_concat__fragment('filter-OUTPUT-policy') }
- if facts[:os]['release']['major'].to_i == 10
+ if facts[:os]['name'] == 'Debian'
it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/raw-PREROUTING.conf') }
it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/raw-OUTPUT.conf') }
it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/nat-PREROUTING.conf') }
diff --git a/spec/defines/chain_spec.rb b/spec/defines/chain_spec.rb
index 4a598b3..1a6bb44 100644
--- a/spec/defines/chain_spec.rb
+++ b/spec/defines/chain_spec.rb
@@ -30,7 +30,7 @@ describe 'ferm::chain', type: :define do
is_expected.to contain_concat__fragment('filter-INPUT2-footer'). \
with_content(%r{LOG log-prefix 'INPUT2: ';})
end
- if facts[:os]['release']['major'].to_i == 10
+ if facts[:os]['name'] == 'Debian'
it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-INPUT2.conf') }
else
it { is_expected.to contain_concat('/etc/ferm.d/chains/filter-INPUT2.conf') }
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb
index 33ce169..5e4ad69 100644
--- a/spec/defines/rule_spec.rb
+++ b/spec/defines/rule_spec.rb
@@ -161,7 +161,7 @@ describe 'ferm::rule', type: :define do
that_requires('Ferm::Chain[check-ssh]')
end
it { is_expected.to contain_concat__fragment('filter-INPUT-config-include') }
- if facts[:os]['release']['major'].to_i == 10
+ if facts[:os]['name'] == 'Debian'
it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-SSH.conf') }
else
it { is_expected.to contain_concat('/etc/ferm.d/chains/filter-SSH.conf') }