contest
)This is a repository of publicly-available tests used for testing ComplianceAsCode/content on Red Hat Enterprise Linux.
FMF - Flexible Metadata Format, a test metadata format used by TMT
TMT - Test Management Tool, a framework and a related CLI tool for running tests, see also user docs here or Under The Hood which explains the basic much better
"test" is a FMF object with a test:
in its YAML definiton, ie.
/hardening/oscap/stig
/hardening/oscap
defines multiple tests,
all sharing the same source code, parametrized using environment variables
in main.fmf
.)"result" is a piece of data reported by a test, containing
name
- either a test name, or a test name with something appended to it,
ie. /hardening/oscap/stig
or /hardening/oscap/stig/some_rule_name/etc
status
- one of pass
, fail
, info
, warn
or error
note
- additional freeform text details about the resultlog
- a list of logs associated with the resultCONTEST_VERBOSE
/something
after a test name), results
for tests themselves (as seen by TMT) are always reported.0
outputs only fail
and error
1
(default) is fail
, error
and warn
2
or greater to output everythingCONTEST_WAIVER_DIR
.
are ignored.conf/waivers
.CONTEST_LEAVE_GUEST_RUNNING
1
to break gurantees provided by class Guest()
, that is make the
context manager not honor __exit__
by leaving running guests (VMs) behind.virsh domifaddr contest
to get the VM's IP address
and ssh
into it as root
with contest
as password.CONTEST_VERBATIM_RESULTS
1
to avoid waiving known failures, leaving results exactly as
tests reported them./per-rule/from-env
,
rather than the waived one.CONTEST_STRICT_WAIVERS
1
to force all waivers to be strict=True
.CONTEST_CONTENT
CONTEST_CONTENT_BRANCH
CONTEST_CONTENT
to point to it.CONTEST_CONTENT
but without you having to
provide a cloned directory, Contest automatically clones it for you.CONTEST_CONTENT
in combination with this option.CONTEST_CONTENT_PR
#
or other letters) of the
CaC/content project.CONTEST_CONTENT_BRANCH
, but it uses content from the
pull request instead of a branch.CONTEST_CONTENT
in combination with this option.CONTEST_OSCAP_BRANCH
openscap-scanner
.openscap-scanner
built by Packit has to have a newer NVR
than the RPM provided by regular OS repositories.CONTEST_OSCAP_PR
#
or other letters) of the
OpenSCAP project.CONTEST_OSCAP_BRANCH
, but it upgrades to a Packit-built
version from the pull request, instead of a branch.See TESTS.md.
In this context, "to waive" means to label a failing result as known-bad, something we have seen before and expect to fail.
Read WAIVERS.md to see where/how you can set up rules to automatically waive failures.
(TODO: Find a better place for this?)
The tests perform some hacks to allow login after hardening:
-oPermitRootLogin=yes
in OPTIONS
of /etc/sysconfig/sshd
NOPASSWD
in /etc/sudoers
and impose other limitations./etc/sysconfig/sshd
, so no
rules are failing as a result of this. :)These have some unfortunate metadata, such as
/var/log/audit
sizescap-security-guide
which are removed by translate_ssg_kickstart()
in virt.py.
See https://rhsecuritycompliance.github.io/contest/ for online Sphinx version
of the modules present in lib
.
(TODO: probably move to its own document?)
Anaconda-based remediation can be debugged on a virtual machine by issuing
virsh domifaddr contest
(where contest
is the default VM name) to acquire
an IP address of the guest (which gets assigned just before Anaconda launches)
and doing ssh root@that-ip-addr
from the host running the test itself (and
hosting the VM).
There is no password for the Anaconda environment, so this will just log you in.
You can use a handy script in the home directory of the VM host's user.
Simply run:
./contest-sshvm [vm-name]
The script will find the first contest-installed VM if vm-name
is not given,
it will check whether the VM is running (as a result of you starting it earlier
or CONTEST_LEAVE_GUEST_RUNNING=1
) and if not, it will start it and wait for
sshd
to start responding. It will then ssh
you into the VM, using
pre-generated SSH keys (no passwords needed).
Unless specified otherwise, any content within this repository is distributed under the GNU GPLv3 license, see the COPYING.txt file for more.