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

Prelim task "Ensure auditd is installed" required for level 1 benchmarks is not executed if using only level1-server tag #247

Open
angaaruriakhil opened this issue Oct 10, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@angaaruriakhil
Copy link

angaaruriakhil commented Oct 10, 2024

Describe the Issue

When trying to apply only level 1 benchmarks on an Ubuntu 22 machine, one can use the -t flag in the ansible playbook command to apply a tag so that only level 1 benchmarks will be applied to the host.

e.g.

-t 'level1-server'

If you do this, the prelim task "PRELIM | AUDIT | Audit conf and rules files | list files" defined here is skipped, , this is because it has the tag level2-server.

However, level 1 benchmark 4.1.4.5 (and maybe others) relies on this prelim task to run and define the audit conf files.

Other level 1 benchmarks also need auditd to be installed (checking for that is also a part of this block)

Expected Behavior
Prelim tasks that are required for any level 1 benchmarks as well should not have the tag level2-server and therefore this prelim task should be run if level2-server tag is skipped or not included in the ansible-playbook command.

Workarounds

A workaround is to not use any tags, read through each benchmark and set each one to true and false if level 1 or not, but is a little tedious , hence where the use of tags make level 1 hardening straightforward and is preferred. (I have tested without tags and benchmark 4.1.4.5 successfully gets applied)

Another possible workaround is to set the tags in your ansible-playbook as both 'level1-server' and 'always' to ensure this prelim task executes (Tested this and it works, but I'm not sure if the 'always' tag will apply any level2 benchmarks)

Actual Behavior

You will get the following error when trying to apply benchmark 4.1.4.5:

TASK [/root/.ansible/roles/UBUNTU22-CIS : 4.1.4.5 | PATCH | Ensure audit configuration files are 640 or more restrictive] ***
    azure-arm.build_vhd: fatal: [localhost]: FAILED! => {"msg": "'auditd_conf_files' is undefined"}

and if you don't have auditd installed, you'll get an error earlier on.

Control(s) Affected
Level 1

Environment (please complete the following information):

  • branch being used: devel
  • Ansible Version: ansible (10.5.0), ansible-core_2.17.5
  • Host Python Version: [e.g. Python 3.7.6]
  • Ansible Server Python Version: [e.g. Python 3.7.6]

Possible Solution
Amend tags accordingly in the prelim task or separate out the logic.

@angaaruriakhil angaaruriakhil added the bug Something isn't working label Oct 10, 2024
@uk-bolly uk-bolly self-assigned this Nov 4, 2024
@uk-bolly
Copy link
Member

uk-bolly commented Nov 4, 2024

hi @angaaruriakhil

Thank you for raising this issue, i am looking to get this addressed in an upcoming PR.
Many thanks

uk-bolly

uk-bolly added a commit that referenced this issue Nov 4, 2024
uk-bolly added a commit that referenced this issue Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants