From 03936aab6f7f5b2cb115c968887ce7c7b724c3e9 Mon Sep 17 00:00:00 2001 From: Spencer Owen Date: Thu, 3 Nov 2022 21:49:47 -0600 Subject: [PATCH] Skip non existant files --- controls/1_4_secure_boot_settings.rb | 2 ++ controls/1_6_mandatory_access_control.rb | 1 + controls/4_1_configure_system_accounting_auditd.rb | 1 + 3 files changed, 4 insertions(+) diff --git a/controls/1_4_secure_boot_settings.rb b/controls/1_4_secure_boot_settings.rb index 6350344..407cc71 100644 --- a/controls/1_4_secure_boot_settings.rb +++ b/controls/1_4_secure_boot_settings.rb @@ -30,6 +30,7 @@ describe.one do grub_conf.locations.each do |f| describe file(f) do + next unless file(f).exist? it { should exist } it { should_not be_readable.by 'group' } it { should_not be_writable.by 'group' } @@ -55,6 +56,7 @@ describe.one do grub_conf.locations.each do |f| describe file(f) do + next unless file(f).exist? its(:content) { should match(/^set superusers/) } its(:content) { should match(/^password/) } end diff --git a/controls/1_6_mandatory_access_control.rb b/controls/1_6_mandatory_access_control.rb index b705739..d3ac5ca 100644 --- a/controls/1_6_mandatory_access_control.rb +++ b/controls/1_6_mandatory_access_control.rb @@ -166,6 +166,7 @@ describe.one do grub_conf.locations.each do |f| describe file(f) do + next unless file(f).exist? its('content') { should_not match /apparmor=0/ } end end diff --git a/controls/4_1_configure_system_accounting_auditd.rb b/controls/4_1_configure_system_accounting_auditd.rb index b830d1d..4b74b9e 100644 --- a/controls/4_1_configure_system_accounting_auditd.rb +++ b/controls/4_1_configure_system_accounting_auditd.rb @@ -127,6 +127,7 @@ describe.one do grub_conf.locations.each do |f| describe file(f) do + next unless file(f).exist? its('content') { should match(/audit=1/) } end end