You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ssg test suite does not take into account the platform: machine definitions in the rule, when deciding which tests to run.
The evaluation of applicability (machine vs container) is performed only after the test environment is already prepared,
which can result in the test failing if the environment is not setup correctly in a non-supported environment.
An example rule which tests fine in a VM but fails to test in a container is all_apparmor_profiles_in_enforce_complain_mode, when the machine profile is added to its rule defintion.
$ tests/test_rule_in_container.sh --no-make-applicable-in-containers --dontclean --logdir logs_bash --remediate-using bash --name ssg_test_suite --datastream build/ssg-ubuntu2204-ds.xml all_apparmor_profiles_in_enforce_complain_mode
ERROR - Rule 'all_apparmor_profiles_in_enforce_complain_mode' test setup script 'correct_all_apparmor_profiles_in_enforce.pass.sh' failed with exit code 1
ERROR - Environment failed to prepare, skipping test
By adding the following to the test scenario, the issue is resolved:
if [ -f /.dockerenv ] || [ -f /run/.containerenv ]; then
exit 0
fi
Description of problem:
The ssg test suite does not take into account the
platform: machine
definitions in the rule, when deciding which tests to run.The evaluation of applicability (machine vs container) is performed only after the test environment is already prepared,
which can result in the test failing if the environment is not setup correctly in a non-supported environment.
An example rule which tests fine in a VM but fails to test in a container is
all_apparmor_profiles_in_enforce_complain_mode
, when themachine
profile is added to its rule defintion.By adding the following to the test scenario, the issue is resolved:
SCAP Security Guide Version:
master branch (a11711d)
Operating System Version:
Steps to Reproduce:
platform: machine
to ruleall_apparmor_profiles_in_enforce_complain_mode
./build_product ubuntu2204
podman build --build-arg "CLIENT_PUBLIC_KEY=$(cat ~/.ssh/id_rsa.pub)" -t ssg_test_suite -f Dockefiles/test_suite-ubuntu2204
tests/test_rule_in_container.sh --no-make-applicable-in-containers --dontclean --logdir logs_bash --remediate-using bash --name ssg_test_suite --datastream build/ssg-ubuntu2204-ds.xml all_apparmor_profiles_in_enforce_complain_mode
Actual Results:
See error above
Expected Results:
The expected result is that the tests pass when inside a container because the rule should not be evaluated.
Additional Information/Debugging Steps:
Possible solutions that come to mind:
The text was updated successfully, but these errors were encountered: