Skip to content

Commit

Permalink
Group expectations by version
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Sep 2, 2020
1 parent 2c8e79d commit f224aaf
Showing 1 changed file with 70 additions and 80 deletions.
150 changes: 70 additions & 80 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,159 +343,143 @@ class { 'fail2ban': }
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2200$}
end

it 'is expected to modify dropbear port' do
shell("grep \"\\[dropbear\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2201$}
if fail2ban_version >= Gem::Version.new('0.8.7')
it 'is expected to modify lighttpd-auth port' do
shell("grep \"\\[lighttpd-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify selinux-ssh port' do
if fail2ban_version >= Gem::Version.new('0.8.11')
shell("grep \"\\[selinux-ssh\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2202$}
if fail2ban_version >= Gem::Version.new('0.8.9')
it 'is expected to modify roundcube-auth port' do
shell("grep \"\\[roundcube-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-auth port' do
if fail2ban_version >= Gem::Version.new('0.8.11')
shell("grep \"\\[apache-auth\\]\" -A 5 #{config_file_path}") do |r|
if fail2ban_version >= Gem::Version.new('0.8.10')
it 'is expected to modify apache-nohome port' do
shell("grep \"\\[apache-nohome\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-badbots port' do
if fail2ban_version >= Gem::Version.new('0.9.4')
shell("grep \"\\[apache-badbots\\]\" -A 7 #{config_file_path}") do |r|
if fail2ban_version >= Gem::Version.new('0.8.11')
it 'is expected to modify suhosin port' do
shell("grep \"\\[suhosin\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-noscript port' do
shell("grep \"\\[apache-noscript\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
it 'is expected to modify selinux-ssh port' do
shell("grep \"\\[selinux-ssh\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2202$}
end
end
end

it 'is expected to modify apache-overflows port' do
shell("grep \"\\[apache-overflows\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
it 'is expected to modify apache-auth port' do
shell("grep \"\\[apache-auth\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-nohome port' do
if fail2ban_version >= Gem::Version.new('0.8.10')
shell("grep \"\\[apache-nohome\\]\" -A 6 #{config_file_path}") do |r|
if fail2ban_version >= Gem::Version.new('0.8.12')
it 'is expected to modify horde port' do
shell("grep \"\\[horde\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-botsearch port' do
if fail2ban_version >= Gem::Version.new('0.9.0')
shell("grep \"\\[apache-botsearch\\]\" -A 6 #{config_file_path}") do |r|
it 'is expected to modify groupoffice port' do
shell("grep \"\\[groupoffice\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-fakegooglebot port' do
if fail2ban_version >= Gem::Version.new('0.9.6')
shell("grep \"\\[apache-fakegooglebot\\]\" -A 6 #{config_file_path}") do |r|
it 'is expected to modify openwebmail port' do
shell("grep \"\\[openwebmail\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-modsecurity port' do
shell("grep \"\\[apache-modsecurity\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
if fail2ban_version >= Gem::Version.new('0.9.0')
it 'is expected to modify apache-botsearch port' do
shell("grep \"\\[apache-botsearch\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify apache-shellshock port' do
if fail2ban_version >= Gem::Version.new('0.9.1')
if fail2ban_version >= Gem::Version.new('0.9.1')
it 'is expected to modify apache-shellshock port' do
shell("grep \"\\[apache-shellshock\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify nginx-http-auth port' do
shell("grep \"\\[nginx-http-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
if fail2ban_version >= Gem::Version.new('0.9.2')
it 'is expected to modify nginx-botsearch port' do
shell("grep \"\\[nginx-botsearch\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify nginx-limit-req port' do
if fail2ban_version >= Gem::Version.new('0.9.4')
if fail2ban_version >= Gem::Version.new('0.9.4')
it 'is expected to modify nginx-limit-req port' do
shell("grep \"\\[nginx-limit-req\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify nginx-botsearch port' do
if fail2ban_version >= Gem::Version.new('0.9.2')
shell("grep \"\\[nginx-botsearch\\]\" -A 6 #{config_file_path}") do |r|
it 'is expected to modify apache-badbots port' do
shell("grep \"\\[apache-badbots\\]\" -A 7 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify php-url-fopen port' do
shell("grep \"\\[php-url-fopen\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

it 'is expected to modify suhosin port' do
if fail2ban_version >= Gem::Version.new('0.8.11')
shell("grep \"\\[suhosin\\]\" -A 6 #{config_file_path}") do |r|
if fail2ban_version >= Gem::Version.new('0.9.6')
it 'is expected to modify apache-fakegooglebot port' do
shell("grep \"\\[apache-fakegooglebot\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end

it 'is expected to modify lighttpd-auth port' do
if fail2ban_version >= Gem::Version.new('0.8.7')
shell("grep \"\\[lighttpd-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
it 'is expected to modify dropbear port' do
shell("grep \"\\[dropbear\\]\" -A 5 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+ssh,2201$}
end
end

it 'is expected to modify roundcube-auth port' do
if fail2ban_version >= Gem::Version.new('0.8.9')
shell("grep \"\\[roundcube-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
it 'is expected to modify apache-modsecurity port' do
shell("grep \"\\[apache-modsecurity\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

it 'is expected to modify openwebmail port' do
if fail2ban_version >= Gem::Version.new('0.8.12')
shell("grep \"\\[openwebmail\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
it 'is expected to modify nginx-http-auth port' do
shell("grep \"\\[nginx-http-auth\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

it 'is expected to modify horde port' do
if fail2ban_version >= Gem::Version.new('0.8.12')
shell("grep \"\\[horde\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
it 'is expected to modify apache-noscript port' do
shell("grep \"\\[apache-noscript\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

it 'is expected to modify groupoffice port' do
if fail2ban_version >= Gem::Version.new('0.8.12')
shell("grep \"\\[groupoffice\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
it 'is expected to modify apache-overflows port' do
shell("grep \"\\[apache-overflows\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

Expand All @@ -504,6 +488,12 @@ class { 'fail2ban': }
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end

it 'is expected to modify php-url-fopen port' do
shell("grep \"\\[php-url-fopen\\]\" -A 6 #{config_file_path}") do |r|
expect(r.stdout).to match %r{^port\s+\=\s+80,443$}
end
end
end
end
end

0 comments on commit f224aaf

Please sign in to comment.