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

auth-select options variable not used #156

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
646b4de
Adding missing lines to sysctl.d/50-default.conf
bgro Oct 12, 2023
c6a51ad
Adding new entry in /etc/pam.d/system-auth
brisky Nov 10, 2023
88ffe32
Storing max_log_file under `rhel9cis_auditd` dict variable.
ipruteanu-sie Dec 20, 2023
ca41b12
Defining some threshold for (audit_)space_left vars, as well as a boo…
ipruteanu-sie Dec 20, 2023
1e55d86
Update cis_1.3.x.yml
sickbock Jan 3, 2024
4d749d9
Update cis_1.8.x.yml
sickbock Jan 3, 2024
712b8b6
Update cis_5.6.1.x.yml
sickbock Jan 3, 2024
3b256ff
Update cis_5.6.1.x.yml
sickbock Jan 3, 2024
d6b44aa
Update cis_6.1.x.yml
sickbock Jan 3, 2024
e0491cc
Update cis_6.2.x.yml
sickbock Jan 3, 2024
87d2685
Update cis_1.1.7.x.yml
jLemmings Jan 10, 2024
85e2eb1
RH9 does not require extra authselect options(just `with-faillock`). …
ipruteanu-sie Jan 17, 2024
884377c
Use the proper sub-task name when authselect custom profile is selected.
ipruteanu-sie Jan 17, 2024
068c45f
Merge pull request #105 from siemens/siemens/feat/reverse_path_filter…
uk-bolly Jan 18, 2024
aa8a60b
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 22, 2024
ac5eee8
Merge pull request #112 from siemens/siemens/feat/ensure_default_umas…
uk-bolly Jan 26, 2024
df1aef8
Merge pull request #148 from siemens/siemens/feat/AuditVarsRefactoring
uk-bolly Jan 26, 2024
902956e
Merge pull request #151 from sickbock/devel
uk-bolly Jan 26, 2024
b726c2e
Merge pull request #154 from jLemmings/patch-3
uk-bolly Jan 26, 2024
3fe681c
Merge pull request #159 from ansible-lockdown/pre-commit-ci-update-co…
uk-bolly Jan 26, 2024
f0e4768
RH9 does not require extra authselect options(just `with-faillock`). …
ipruteanu-sie Jan 17, 2024
c60167a
[IP] Rebased and fixed conflicts.
ipruteanu-sie Jan 17, 2024
936218e
Merge branch 'siemens/feat/bUSE_authSelectOptions' of code.siemens.co…
ipruteanu-sie Jan 31, 2024
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
args: ['--baseline-path', '.config/.gitleaks-report.json']

- repo: https://github.com/ansible-community/ansible-lint
rev: v6.22.1
rev: v6.22.2
hooks:
- id: ansible-lint
name: Ansible-lint
Expand Down
23 changes: 13 additions & 10 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,26 +528,30 @@ rhel9cis_auditd:
space_left_action: email
action_mail_acct: root
admin_space_left_action: halt
# The max_log_file parameter should be based on your sites policy.
max_log_file: 10
max_log_file_action: keep_logs

# This value governs if the below extra-vars for auditd should be used by the role
rhel9cis_auditd_extra_conf_usage: false

# This can be used to configure other keys in auditd.conf
# Example:
# rhel9cis_auditd_extra_conf:
# admin_space_left: '10%'
rhel9cis_auditd_extra_conf:
admin_space_left: 50
space_left: 75

# The audit_back_log_limit value should never be below 8192
rhel9cis_audit_back_log_limit: 8192

# The max_log_file parameter should be based on your sites policy
rhel9cis_max_log_file_size: 10

### 4.1.3.x audit template
update_audit_template: false

## Advanced option found in auditd post
rhel9cis_allow_auditd_uid_user_exclusions: false

# This can be used to configure other keys in auditd.conf
rhel9cis_auditd_extra_conf: {}
# Example:
# rhel9cis_auditd_extra_conf:
# admin_space_left: '10%'

## Preferred method of logging
## Whether rsyslog or journald preferred method for local logging
## Affects rsyslog cis 4.2.1.3 and journald cis 4.2.2.5
Expand Down Expand Up @@ -616,7 +620,6 @@ rhel9cis_use_authconfig: false
rhel9cis_authselect:
custom_profile_name: custom-profile
default_file_to_copy: "sssd --symlink-meta"
options: with-sudo with-faillock without-nullok

# 5.3.1 Enable automation to create custom profile settings, using the settings above
rhel9cis_authselect_custom_profile_create: false
Expand Down
13 changes: 13 additions & 0 deletions tasks/post.yml
Copy link
Member

Choose a reason for hiding this comment

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

Trying to understand why this is added?
This is already as as per the guidelines to a sysctl.d file in rule 3.3.7

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
- not system_is_container
- "'procps-ng' in ansible_facts.packages"

- name: POST | Update usr sysctl
ansible.builtin.lineinfile:
dest: /usr/lib/sysctl.d/50-default.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- { regexp: '^net.ipv4.conf.default.rp_filter', line: 'net.ipv4.conf.default.rp_filter = 1' }
- { regexp: '^net.ipv4.conf.*.rp_filter', line: 'net.ipv4.conf.*.rp_filter = 1' }
when:
- rhel9cis_sysctl_update
- not system_is_container
- "'procps-ng' in ansible_facts.packages"

- name: Flush handlers
ansible.builtin.meta: flush_handlers

Expand Down
2 changes: 1 addition & 1 deletion tasks/section_1/cis_1.1.7.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
src: "{{ item.device }}"
fstype: "{{ item.fstype }}"
state: present
opts: defaults,{% if rhel9cis_rule_1_1_7_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_7_3 %}nosuid,{% endif %}
opts: defaults,{% if rhel9cis_rule_1_1_7_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_7_3 %}nosuid{% endif %}
loop: "{{ ansible_facts.mounts }}"
loop_control:
label: "{{ item.device }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/section_1/cis_1.3.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512
validate: aide -D --config %s
when:
- rhel9cis_rule_1_3_2
- rhel9cis_rule_1_3_3
- not system_is_ec2
tags:
- level1-server
Expand Down
2 changes: 1 addition & 1 deletion tasks/section_1/cis_1.8.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,4 @@
- level1-workstation
- patch
- gui
- rule_1.8.4
- rule_1.8.10
3 changes: 2 additions & 1 deletion tasks/section_4/cis_4.1.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ansible.builtin.lineinfile:
path: /etc/audit/auditd.conf
regexp: "^max_log_file( |=)"
line: "max_log_file = {{ rhel9cis_max_log_file_size }}"
line: "max_log_file = {{ rhel9cis_auditd['max_log_file'] }}"
notify: Restart auditd
when:
- rhel9cis_rule_4_1_2_1
Expand Down Expand Up @@ -58,6 +58,7 @@
notify: Restart auditd
when:
- rhel9cis_auditd_extra_conf.keys() | length > 0
- rhel9cis_auditd_extra_conf_usage
tags:
- level2-server
- level2-workstation
Expand Down
4 changes: 2 additions & 2 deletions tasks/section_5/cis_5.4.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
- "Below are the current custom profiles"
- "{{ rhel9cis_5_4_2_profiles_faillock.stdout_lines }}"

- name: "5.4.2 | PATCH | Ensure authselect includes with-faillock | Create custom profiles"
ansible.builtin.shell: "authselect select custom/{{ rhel9cis_authselect['custom_profile_name'] }} {{ rhel9cis_authselect['options'] }}"
- name: "5.4.2 | PATCH | Ensure authselect includes with-faillock | Select custom profile"
ansible.builtin.shell: "authselect select custom/{{ rhel9cis_authselect['custom_profile_name'] }} with-faillock"
when: rhel9cis_authselect_custom_profile_select

- name: 5.4.2 | PATCH | Ensure authselect includes with-faillock | not auth select profile"
Expand Down
4 changes: 2 additions & 2 deletions tasks/section_5/cis_5.6.1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- level1-workstation
- patch
- password
- rule_5.5.1.1
- rule_5.6.1.1

- name: "5.6.1.2 | PATCH | Ensure minimum days between password changes is 7 or more"
ansible.builtin.lineinfile:
Expand Down Expand Up @@ -117,4 +117,4 @@
- level1-server
- level1-workstation
- patch
- rule_5.5.1.5
- rule_5.6.1.5
5 changes: 5 additions & 0 deletions tasks/section_5/cis_5.6.x.yml
Copy link
Member

Choose a reason for hiding this comment

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

Can see the confusion on this one,
the first method pam has been started but the control ends with writing it the second option.
Shall we just remove the pam method and have the second one via shell methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only purpose of this PR was to highlight that:

  • there are some extra authselect options, not explicitly requested by CIS, present in 5.4.2
  • but encountered within the CIS report, as an impl-example for 5.4.1.
    Considering the extra-options will not hurt, please feel free to close this PR, in case is does not help.

Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
regexp: '^USERGROUPS_ENAB'
line: USERGROUPS_ENAB no

- name: "5.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Force umask sessions /etc/pam.d/system-auth"
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
line: 'session required pam_umask.so'
insertafter: EOF
when:
- rhel9cis_rule_5_6_5
tags:
Expand Down
4 changes: 2 additions & 2 deletions tasks/section_6/cis_6.1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
- level1-workstation
- patch
- permissions
- rule_6.1.10
- rule_6.1.8

- name: "6.1.9 | PATCH | Ensure no world writable files exist"
block:
Expand Down Expand Up @@ -253,7 +253,7 @@
- patch
- stickybits
- permissons
- rule_1.1.21
- rule_6.1.12

- name: "6.1.13 | AUDIT | Audit SUID executables"
block:
Expand Down
2 changes: 1 addition & 1 deletion tasks/section_6/cis_6.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
- audit
- accounts
- groups
- rule_6.2.2
- rule_6.2.3

- name: "6.2.4 | AUDIT Ensure no duplicate UIDs exist"
block:
Expand Down