Skip to content

Commit 56928ba

Browse files
committed
feat: add rules to ensure that all referred users and gids exist
Signed-off-by: Claudius Heine <[email protected]>
1 parent e6671b4 commit 56928ba

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

controls/os_spec.rb

+16
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,19 @@
370370
its('users') { should be_empty }
371371
end
372372
end
373+
374+
control 'os-20' do
375+
impact 1.0
376+
title 'All users and gids referred in /etc/group and /etc/passwd should exist'
377+
desc 'Errors in system administration can lead to a case where gids or uids referred to do not exist'
378+
379+
gids = etc_group.gids.map(&:to_s)
380+
describe passwd do
381+
its('gids') { should be_in gids }
382+
end
383+
384+
users = passwd.users
385+
describe etc_group do
386+
its('users') { should be_in users }
387+
end
388+
end

0 commit comments

Comments
 (0)