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

Add ansible remediation to mount_option_home template #12546

Merged

Conversation

mrkanon
Copy link
Contributor

@mrkanon mrkanon commented Oct 25, 2024

Description:

Added

  • ansible.template
  • fstab_multiple_users_template.fail.sh

Updated

  • template.yml

Rationale:

This change introduces ansible remediation in the mount_option_home template, which is used by the mount_option_home_noexec and mount_option_home_nosuid rules; the logic was taken from bash remediation.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Oct 25, 2024
Copy link

openshift-ci bot commented Oct 25, 2024

Hi @mrkanon. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

Copy link

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

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@Xeicker Xeicker added Ansible Ansible remediation update. Update Template Issues or pull requests related to Templates updates. labels Oct 30, 2024
@jan-cerny jan-cerny added this to the 0.1.75 milestone Nov 4, 2024
@jan-cerny jan-cerny self-assigned this Nov 4, 2024
# complexity = low
# disruption = high

- name: "Initialize variables"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add {{{ rule_title }}}: to each Ansible Task name so that the same Ansible Tasks can be distinguished between rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review, I updated this

ansible.builtin.set_fact:
allowed_mount_point: "{{ allowed_mount_point + [item.stdout_lines[0]] }}"
with_items: "{{ df_output.results }}"
when: item.stdout_lines[0] != ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

If df doesn't return anything or produces an error then the stdout_lines is empty and doesn't have 0 element which causes the Playbook to fail and terminate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review, I updated this

Update task name with "full_name" in the mount_home_option template &
Fix conditional to cover none value

Signed-off-by: Armando Acosta <[email protected]>
Copy link

codeclimate bot commented Nov 5, 2024

Code Climate has analyzed commit 434ad07 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 60.9% (0.0% change).

View more on Code Climate.

@jan-cerny jan-cerny merged commit 6036e07 into ComplianceAsCode:master Nov 6, 2024
97 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ansible Ansible remediation update. needs-ok-to-test Used by openshift-ci bot. Update Template Issues or pull requests related to Templates updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants