1
0
Fork 0
mirror of synced 2024-11-09 11:08:58 -05:00
formula-sudoers/test/integration/appended/controls/config.rb

39 lines
1.2 KiB
Ruby
Raw Normal View History

2021-08-18 19:52:57 -04:00
# frozen_string_literal: true
control 'Sudoers configuration' do
title 'should match desired lines'
describe file('/etc/sudoers') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('content') { should include '#include /etc/sudoers.d/extra-file1' }
its('content') { should include '#include /etc/sudoers.d/extra-file2' }
its('content') { should include '#include /etc/sudoers.d/extra-file3' }
end
describe file('/etc/sudoers.d/extra-file1') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0440' }
its('content') { should include 'foo ALL=(ALL) ALL' }
end
describe file('/etc/sudoers.d/extra-file2') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0440' }
its('content') { should include '%bargroup ALL=(ALL) NOPASSWD: ALL' }
end
describe file('/etc/sudoers.d/extra-file3') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0440' }
its('content') { should include '+other_netgroup ALL=(ALL) ALL' }
end
end