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

Updates of the rule use_pam_wheel_group_for_su #10714

Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion controls/cis_sle12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,8 @@ controls:
- l1_workstation
automated: partially # we check only for usage of use_uid with pam_su, not for the group
rules:
- use_pam_wheel_for_su
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis

- id: 6.1.1
title: Audit system file permissions (Manual)
Expand Down
3 changes: 2 additions & 1 deletion controls/cis_sle15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,8 @@ controls:
- l1_workstation
automated: partially # we check only for usage of use_uid with pam_su, not for the group
rules:
- use_pam_wheel_for_su
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis

- id: 6.1.1
title: Audit system file permissions (Manual)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# platform = multi_platform_sle,multi_platform_ubuntu
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low

{{{ ansible_instantiate_variables("var_pam_wheel_group_for_su") }}}

- name: {{{ rule_title }}} - Ensure group {{ var_pam_wheel_group_for_su }} is removed
group:
name: "{{ var_pam_wheel_group_for_su }}"
state: absent

- name: {{{ rule_title }}} - Ensure group {{ var_pam_wheel_group_for_su }} exist
group:
name: "{{ var_pam_wheel_group_for_su }}"
state: present
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this handled by ensure_pam_wheel_group_empty already?


- name: {{{ rule_title }}} - Add the group to the /etc/pam.d/su file
ansible.builtin.lineinfile:
path: "/etc/pam.d/su"
state: present
regexp: '^[\s]*#[\s]*auth[\s]+required[\s]+pam_wheel\.so[\s]+use_uid group=$'
line: "auth required pam_wheel.so use_uid group={{ var_pam_wheel_group_for_su }}"
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# platform = multi_platform_ubuntu
# platform = multi_platform_ubuntu,multi_platform_sle
{{{ bash_instantiate_variables("var_pam_wheel_group_for_su") }}}

PAM_CONF=/etc/pam.d/su

if [ "$(getent group ${var_pam_wheel_group_for_su})" ]; then
# group exists
groupdel -f ${var_pam_wheel_group_for_su}
fi
groupadd -f ${var_pam_wheel_group_for_su}


pamstr=$(grep -P '^auth\s+required\s+pam_wheel\.so\s+(?=[^#]*\buse_uid\b)(?=[^#]*\bgroup=)' ${PAM_CONF})
if [ -z "$pamstr" ]; then
sed -Ei '/^auth\b.*\brequired\b.*\bpam_wheel\.so/d' ${PAM_CONF} # remove any remaining uncommented pam_wheel.so line
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
documentation_complete: true

prodtype: ubuntu2004,ubuntu2204
prodtype: sle12,sle15,ubuntu2004,ubuntu2204

title: 'Enforce Usage of pam_wheel with Group Parameter for su Authentication'

Expand All @@ -19,7 +19,13 @@ rationale: |-

severity: medium

identifiers:
cce@sle12: CCE-92351-6
cce@sle15: CCE-92522-2

references:
cis@sle12: '5.6'
cis@sle15: '5.6'
cis@ubuntu2004: '5.6'
cis@ubuntu2204: 5.3.7

Expand Down
3 changes: 3 additions & 0 deletions products/sle12/profiles/pci-dss-4.profile
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@ selections:
- sshd_strong_kex=pcidss
- sshd_approved_macs=cis_sle12
- sysctl_fs_suid_dumpable
- '!use_pam_wheel_for_su'
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis
3 changes: 3 additions & 0 deletions products/sle15/profiles/pci-dss-4.profile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ selections:
- '!service_ntpd_enabled'
- '!service_timesyncd_enabled'
- '!package_libreswan_installed'
- '!use_pam_wheel_for_su'
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis
1 change: 0 additions & 1 deletion shared/references/cce-sle12-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ CCE-92345-8
CCE-92347-4
CCE-92348-2
CCE-92350-8
CCE-92351-6
CCE-92353-2
CCE-92354-0
CCE-92355-7
Expand Down
1 change: 0 additions & 1 deletion shared/references/cce-sle15-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ CCE-92514-9
CCE-92516-4
CCE-92517-2
CCE-92521-4
CCE-92522-2
CCE-92524-8
CCE-92525-5
CCE-92527-1
Expand Down