Skip to content

Commit

Permalink
Modification of the rule ensure_pam_wheel_group_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rumch-se committed Jun 29, 2023
1 parent 9a11550 commit a6b6843
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions controls/cis_sle12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,7 @@ controls:
- l1_workstation
automated: partially # we check only for usage of use_uid with pam_su, not for the group
rules:
- ensure_pam_wheel_group_empty
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis

Expand Down
1 change: 1 addition & 0 deletions controls/cis_sle15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,7 @@ controls:
- l1_workstation
automated: partially # we check only for usage of use_uid with pam_su, not for the group
rules:
- ensure_pam_wheel_group_empty
- use_pam_wheel_group_for_su
- var_pam_wheel_group_for_su=cis

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform = multi_platform_ubuntu
# platform = multi_platform_sle,multi_platform_ubuntu

{{{ bash_instantiate_variables("var_pam_wheel_group_for_su") }}}

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: 'Ensure the Group Used by pam_wheel Module Exists on System and is Empty'

Expand All @@ -17,7 +17,13 @@ rationale: |-
severity: medium

identifiers:
cce@sle12: CCE-92353-2
cce@sle15: CCE-92528-9

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

{{{ 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

- name: {{{ rule_title }}} - Add the group to the /etc/pam.d/su file
ansible.builtin.lineinfile:
path: "/etc/pam.d/su"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# platform = multi_platform_ubuntu,multi_platform_sle
# platform = multi_platform_sle,multi_platform_ubuntu
{{{ 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
1 change: 1 addition & 0 deletions products/sle12/profiles/pci-dss-4.profile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ selections:
- disable_host_auth
- disable_prelink
- disable_users_coredumps
- ensure_pam_wheel_group_empty
- file_at_deny_not_exist
- file_cron_deny_not_exist
- file_groupowner_at_allow
Expand Down
1 change: 1 addition & 0 deletions products/sle15/profiles/pci-dss-4.profile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ description: |-

selections:
- pcidss_4:all:base
- ensure_pam_wheel_group_empty
- sshd_strong_kex=pcidss
- sshd_approved_macs=cis_sle15
- sshd_approved_ciphers=cis_sle15
Expand Down
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-92353-2
CCE-92354-0
CCE-92355-7
CCE-92357-3
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 @@ -26,7 +26,6 @@ CCE-92521-4
CCE-92524-8
CCE-92525-5
CCE-92527-1
CCE-92528-9
CCE-92530-5
CCE-92532-1
CCE-92533-9
Expand Down

0 comments on commit a6b6843

Please sign in to comment.