pytest_mh.utils.auditd

Classes

Auditd(*args, **kwargs)

Auditd utilities.

class pytest_mh.utils.auditd.Auditd(*args, **kwargs)

Bases: MultihostUtility[MultihostHost]

Auditd utilities.

Collects audit logs and detects AVC denials.

avc_mode values:

  • ignore: all failures are ignored

  • warn: test result category is set to “AVC DENIALS” and the test is marked as such in a test summary, however test outcome and pytest exit code is kept intact

  • fail: test result category is set to “AVC DENIALS” and the test is marked as such in a test summary, if a test outcome is passed it is set to failed and pytest will return non-zero exit code

Parameters:
  • host (MultihostHost) – Multihost host.

  • avc_mode (Literal["fail", "warn", "ignore"]) – Action taken when AVC denial is found in audit logs.

  • avc_filter (str | None, optional) – Regular expression used to filter the AVC denials, defaults to None

setup() None

Create backup of audit logs and clear them for current test run.

teardown() None

Restore previous audit logs from backup and remove the backup.

pytest_report_teststatus(report: CollectReport | TestReport, config: Config) tuple[str, str, str | tuple[str, dict[str, bool]]] | None

Report AVC denial error if found and matches requested filter.

Parameters:
Returns:

Pytest test status

Return type:

tuple[str, str, str | tuple[str, dict[str, bool]]] | None