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

Unify the RHEL approach for rule file_permissions_var_log_audit #9129

Conversation

yuumasato
Copy link
Member

@yuumasato yuumasato commented Jul 11, 2022

Description:

  • RHEL7 and RHEL9 should follow the same approach for RHEL8. i.e.:
    • Look for log_file in /etc/audit/auditd.conf` and check that file's permissions

Rationale:

@yuumasato yuumasato changed the title Unify the rhel approach for rule file_permissions_var_log_audit Unify the RHEL approach for rule file_permissions_var_log_audit Jul 11, 2022
@yuumasato
Copy link
Member Author

* RHEL8 STIG: https://stigs.mab879.com/products/rhel8/v1r6/RHEL-08-030070/

* RHEL7 STIG https://stigs.mab879.com/products/rhel7/v3r7/RHEL-07-910055/

@Mab879 @ggbecker Do you think fix text of this item is correct?
Should it be more like the RHEL7's fixtext?

There is an item more specific about the file's group: https://stigs.mab879.com/products/rhel8/v1r6/RHEL-08-030090/

@github-actions
Copy link

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

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

I think this change makes sense.

Maybe we should use 'rhel' in product or similar so that we will not have to repeat this work for future versions of RHEL.

@vojtapolasek vojtapolasek self-assigned this Jul 12, 2022
@yuumasato yuumasato added the Update Rule Issues or pull requests related to Rules updates. label Jul 12, 2022
RHEL7 and RHEL9 should follow the same approach for RHEL8.
@yuumasato yuumasato force-pushed the fix_file_permissions_var_log_audit branch from 9dfdff0 to 63d00bc Compare July 12, 2022 07:35
@yuumasato yuumasato added this to the 0.1.63 milestone Jul 12, 2022
@yuumasato
Copy link
Member Author

Weird, the test scenarios pass on my machine:

time python3 tests/test_suite.py rule  --libvirt qemu:///session rhel9 --datastream build/ssg-rhel9-ds.xml --dontclean file_permissions_var_log_audit
WARNING - You call Automatus using the legacy 'test_suite.py' script, use the 'automatus.py' instead

Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/wsato/git/content/logs/rule-custom-2022-07-12-1839/test_suite.log
WARNING - Script correct_permissions.pass.sh is not applicable on given platform
WARNING - Script incorrect_permissions.fail.sh is not applicable on given platform
INFO - xccdf_org.ssgproject.content_rule_file_permissions_var_log_audit
INFO - Script correct_value_default_file_0600.pass.sh using profile (all) OK
INFO - Script incorrect_value_default_file_0600.fail.sh using profile (all) OK
INFO - Script correct_value_0600.pass.sh using profile (all) OK
INFO - Script incorrect_value_0600.fail.sh using profile (all) OK

WARNING - You call Automatus using the legacy 'test_suite.py' script, use the 'automatus.py' instead

@vojtapolasek
Copy link
Collaborator

I see that some tet scenarios are missing:

packages = auditd

Could this be the problem?

Install audit when testing file_permissions_var_log_audit,
this enables testing in containers in CI.
@yuumasato yuumasato force-pushed the fix_file_permissions_var_log_audit branch from b305fea to 27e7eab Compare July 18, 2022 09:18
@yuumasato
Copy link
Member Author

@vojtapolasek Thanks, the CI seems happy now.

@codeclimate
Copy link

codeclimate bot commented Jul 18, 2022

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

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

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

View more on Code Climate.

@openshift-ci
Copy link

openshift-ci bot commented Jul 18, 2022

@yuumasato: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-rhcos4-high 27e7eab link true /test e2e-aws-rhcos4-high
ci/prow/e2e-aws-rhcos4-moderate 27e7eab link true /test e2e-aws-rhcos4-moderate

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

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.

Looks great now, thank you.

@vojtapolasek vojtapolasek merged commit 176e818 into ComplianceAsCode:master Jul 18, 2022
@yuumasato yuumasato deleted the fix_file_permissions_var_log_audit branch July 18, 2022 14:10
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test scenarios for file_permissions_var_log_audit fail on RHEL7 and RHEL9
3 participants