mirror of
https://github.com/dev-sec/linux-baseline
synced 2024-11-10 13:44:14 +00:00
added test to check unique UID's
Signed-off-by: Patrick Meier <patrick.meier111@googlemail.com>
This commit is contained in:
parent
84dff35803
commit
5d91f454b0
1 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.filter_run_excluding skipOn: backend(Serverspec::Commands::Base).check_os[:family]
|
||||
end
|
||||
|
||||
# GIS: Req 3.21-4
|
||||
describe command('find / -name \'.rhosts\' | wc -l ') do
|
||||
its(:stdout) { should match(/^0/) }
|
||||
|
@ -93,5 +101,14 @@ describe "SUID/ SGID whitelist check" do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# trennen von sysctl und uid's mit einer map suchen
|
||||
# GIS: Req 3.21-16
|
||||
describe "Unique uid" do
|
||||
it "check for unique uid's" do
|
||||
actual = command('cat /etc/passwd | cut -d \':\' -f 3').stdout.split(/\r?\n/)
|
||||
hm = actual.each_with_object(Hash.new(0)) { |d,counts| counts[d] += 1 }
|
||||
hm.each do |k,v|
|
||||
str = "User: UID #{k} instances: "
|
||||
("#{str}#{v}").should eq("#{str}1")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue