serverspec has a contract on running commands remote. this fixes the local execution and adds a conditional context depending on the presence of the nx flag

This commit is contained in:
Edmund Haselwanter 2014-06-05 10:15:06 +02:00
parent f944aaab35
commit 2e7dfc229a

View file

@ -173,11 +173,16 @@ describe 'System sysctl' do
end
describe 'ExecShield' do
%x( cat /proc/cpuinfo | egrep "^flags" | grep -q ' nx ' )
if $CHILD_STATUS.exitstatus != 0
if command('cat /proc/cpuinfo').return_stdout?(/^flags.*?: .*? nx .*?$/)
context linux_kernel_parameter('kernel.exec-shield') do
its(:value) { should eq 1 }
end
else
context 'No nx flag detected' do
it 'no kernel.exec-shield required' do
true
end
end
end
context linux_kernel_parameter('kernel.randomize_va_space') do