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

Fix for Control 5.2.4 issue #20

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,13 @@ deb12cis_sudo_package: "sudo"
## Control 5.2.3
# This variable defines the path and file name of the sudo log file.
deb12cis_sudolog_location: "/var/log/sudo.log"

## Control 5.2.4 - Ensure users must provide password for escalation
# The following variable specifies a list of users that should not be required to provide a password
# for escalation. Feel free to edit it according to your needs.
deb12cis_sudoers_exclude_nopasswd_list:
- admin

## Control 5.2.6
# This variable sets the duration (in minutes) during which a user's authentication credentials
# are cached after successfully authenticating using "sudo". This allows the user to execute
Expand Down
2 changes: 1 addition & 1 deletion tasks/section_5/cis_5.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
register: discovered_sudo_nopasswd

- name: "5.2.4 | PATCH | Ensure users must provide password for escalation"
when: discovered_sudo_nopasswd.std | length > 0
when: discovered_sudo_nopasswd.stdout | length > 0
ansible.builtin.replace:
path: "{{ item }}"
regexp: '^((?!#|{% for name in deb12cis_sudoers_exclude_nopasswd_list %}{{ name }}{% if not loop.last -%}|{%- endif -%}{% endfor %}).*)NOPASSWD(.*)'
Expand Down