debian-cis/tests/hardening/6.2.20_shadow_group_empty.sh

28 lines
862 B
Bash
Raw Permalink Normal View History

# shellcheck shell=bash
# run-shellcheck
test_audit() {
describe Running on blank host
register_test retvalshouldbe 0
dismiss_count_for_test
# shellcheck disable=2154
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
local test_user="testshadowuser"
2020-12-04 14:08:01 +01:00
describe Tests purposely failing
useradd "$test_user"
usermod -aG shadow "$test_user"
register_test retvalshouldbe 1
register_test contain "Some users belong to shadow group"
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
userdel "$test_user"
2020-12-04 14:08:01 +01:00
describe Tests purposely failing
useradd --no-user-group -g shadow "$test_user"
register_test retvalshouldbe 1
register_test contain "Some users have shadow id as their primary group"
run noncompliant "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
userdel "$test_user"
2020-12-04 14:08:01 +01:00
}