|
|
|
|
|
|
|
|
control 'UFW configuration' do |
|
|
|
|
|
|
|
|
# frozen_string_literal: true |
|
|
|
|
|
|
|
|
|
|
|
control 'UFW configuration' do |
|
|
title 'Test UFW configuration' |
|
|
title 'Test UFW configuration' |
|
|
|
|
|
|
|
|
describe directory('/etc/ufw') do |
|
|
describe directory('/etc/ufw') do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe command('ufw status verbose | grep Status') do |
|
|
describe command('ufw status verbose | grep Status') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /active/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/active/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status verbose | grep Logging') do |
|
|
describe command('ufw status verbose | grep Logging') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /low/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/low/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep MySQL') do |
|
|
describe command('ufw status | grep MySQL') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /ALLOW/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/ALLOW/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep Postgresql') do |
|
|
describe command('ufw status | grep Postgresql') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /LIMIT/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/LIMIT/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep SSH223') do |
|
|
describe command('ufw status | grep SSH223') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /DENY/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/DENY/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 10.0.0.0') do |
|
|
describe command('ufw status | grep 10.0.0.0') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /DENY/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/DENY/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 22/tcp') do |
|
|
describe command('ufw status | grep 22/tcp') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /LIMIT/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/LIMIT/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 80/tcp') do |
|
|
describe command('ufw status | grep 80/tcp') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /DENY/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/DENY/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 443/tcp') do |
|
|
describe command('ufw status | grep 443/tcp') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /ALLOW/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/ALLOW/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 10.0.0.1') do |
|
|
describe command('ufw status | grep 10.0.0.1') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /DENY/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/DENY/) } |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
describe command('ufw status | grep 10.0.0.2') do |
|
|
describe command('ufw status | grep 10.0.0.2') do |
|
|
its('exit_status') { should eq 0 } |
|
|
its('exit_status') { should eq 0 } |
|
|
its('stdout') { should match /DENY/ } |
|
|
|
|
|
|
|
|
its('stdout') { should match(/DENY/) } |
|
|
end |
|
|
end |
|
|
end |
|
|
end |