Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move auditing group #11789

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

jan-cerny
Copy link
Collaborator

Move auditing group so that rules related to auditing are always the last rules in the built XCCDF benchmark.

This change should prevent situations when a remediation of other rules from other groups cause a need for changes in audit configuration after audit has already been remediated. It's a problem mainly for Ansible Playbooks because they are supposed to be run only once (unlike Bash remediations and Bash scripts).

This usually happens for the rule audit_rules_privileged_commands which conflicts with package_sssd_installed. Currently, package_sssd_installed installs some SUID files which need to be add to audit rules auditing the privileged commands. But with the current layout, the remediation for the package_sssd_installed is executed later than remediation for audit_rules_privileged_commands which means that
audit_rules_privileged_commands starts to fail after sssd is installed.

Unfortunately, moving just a single rule would break the logical structure and would make the text guides chaotic so we need to move the whole auditing group.

Fixes: #11752

@jan-cerny jan-cerny added this to the 0.1.73 milestone Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Apr 4, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11789
This image was built from commit: c6c3dc1

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11789

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11789 make deploy-local

@vojtapolasek vojtapolasek self-assigned this Apr 5, 2024
@marcusburghardt marcusburghardt added the Infrastructure Our content build system label Apr 10, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Used by openshift-ci bot. label Apr 12, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Used by openshift-ci bot. label Apr 15, 2024
@jan-cerny
Copy link
Collaborator Author

I have rebased this PR on the top of the latest upstream master branch.

@jan-cerny
Copy link
Collaborator Author

I have rebased this PR on the top of the latest upstream master branch. again

@jan-cerny
Copy link
Collaborator Author

/retest

@jan-cerny
Copy link
Collaborator Author

I have rebased this PR on the top of the latest upstream master branch.

Move auditing group so that rules related to auditing are always the
last rules in the built XCCDF benchmark.

This change should prevent situations when a remediation of other rules
from other groups cause a need for changes in audit configuration after
audit has already been remediated. It's a problem mainly for Ansible
Playbooks because they are supposed to be run only once (unlike Bash
remediations and Bash scripts).

This usually happens for the rule audit_rules_privileged_commands which
conflicts with package_sssd_installed. Currently, package_sssd_installed
installs some SUID files which need to be add to audit rules auditing
the privileged commands. But with the current layout, the remediation
for the package_sssd_installed is executed later than remediation for
audit_rules_privileged_commands which means that
audit_rules_privileged_commands starts to fail after sssd is installed.

Unfortunately, moving just a single rule would break the logical
structure and would make the text guides chaotic so we need to move the
whole auditing group.

Fixes: ComplianceAsCode#11752
Copy link

codeclimate bot commented Apr 18, 2024

Code Climate has analyzed commit c6c3dc1 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 0.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.2% (0.0% change).

View more on Code Climate.

@jan-cerny
Copy link
Collaborator Author

/packit retest-failed

Copy link
Collaborator

@vojtapolasek vojtapolasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. The change is uncommon, but I think it is the only way how to solve the problem of rule ordering right now.
I think that more robust solution should be explored in the future.

@vojtapolasek vojtapolasek merged commit b6401bc into ComplianceAsCode:master Apr 18, 2024
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule audit_rules_privileged_commands fails after hardening on ANSSI High
4 participants