Skip to content

Commit 09b76de

Browse files
authored
Merge pull request #141 from ansible-lockdown/devel
cis2.0.1 release March 24
2 parents 5f03547 + 38b4140 commit 09b76de

File tree

11 files changed

+24
-17
lines changed

11 files changed

+24
-17
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ repos:
3737
exclude: .config/.gitleaks-report.json tasks/parse_etc_password
3838

3939
- repo: https://github.com/gitleaks/gitleaks
40-
rev: v8.18.1
40+
rev: v8.18.2
4141
hooks:
4242
- id: gitleaks
4343
args: ['--baseline-path', '.config/.gitleaks-report.json']
4444
exclude: .config/.secrets.baseline
4545

4646
- repo: https://github.com/ansible-community/ansible-lint
47-
rev: v6.22.1
47+
rev: v24.2.1
4848
hooks:
4949
- id: ansible-lint
5050
name: Ansible-lint
@@ -63,6 +63,6 @@ repos:
6363
- ansible-core>=2.10.1
6464

6565
- repo: https://github.com/adrienverge/yamllint.git
66-
rev: v1.33.0 # or higher tag
66+
rev: v1.35.1 # or higher tag
6767
hooks:
6868
- id: yamllint

defaults/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ ubtu20cis_system_is_container: false
100100
# skip events for ec2 instance testing pipeline
101101
system_is_ec2: false
102102

103+
## Root user used
104+
# Root by default is not used unless setup by user
105+
# The role will only run certain commands if set to true
106+
# This allows the ability to skip tasks that may cause an issue
107+
ubtu20cis_uses_root: false
108+
103109
# Section 1 Fixes
104110
# Section 1 is Initial setup (FileSystem Configuration, Configure Software Updates, Filesystem Integrity Checking, Secure Boot Settings,
105111
# Additional Process Hardening, Mandatory Access Control, Command Line Warning Banners, and GNOME Display Manager)
@@ -535,7 +541,7 @@ ubtu20cis_warning_banner: |
535541
# The two options are chrony, ntp, or systemd-timesyncd
536542
ubtu20cis_time_sync_tool: "systemd-timesyncd"
537543

538-
# This setting allow to use 'pool' or 'server' options using values below.
544+
# This setting allow to use 'pool' or 'servers' options using values below.
539545
# only one wil be applied
540546
ubtu20cis_chrony_timesource: pool
541547

tasks/LE_audit_setup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- name: Pre Audit Setup | Set audit package name | ARM64
1111
ansible.builtin.set_fact:
1212
audit_pkg_arch_name: ARM64
13-
when: ansible_facts.machine == "arm64"
13+
when: ansible_facts.machine == "aarch64"
1414

1515
- name: Pre Audit Setup | Download audit binary
1616
ansible.builtin.get_url:

tasks/post_remediation_audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22

33
- name: Post Audit | Run post_remediation {{ benchmark }} audit
4-
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ post_audit_outfile }} -g {{ group_names }}"
4+
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ post_audit_outfile }} -g \"{{ group_names }}\""
55
changed_when: true
66
environment:
77
AUDIT_BIN: "{{ audit_bin }}"

tasks/pre_remediation_audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
mode: '0600'
7878

7979
- name: Pre Audit | Run pre_remediation {{ benchmark }} audit
80-
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ pre_audit_outfile }} -g {{ group_names }}"
80+
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\""
8181
changed_when: true
8282
environment:
8383
AUDIT_BIN: "{{ audit_bin }}"

tasks/prelim.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
ansible.builtin.package:
5252
update_cache: true
5353
when:
54-
- ubtu20cis_rule_1_3_1 or
55-
ubtu20cis_rule_1_9
54+
- ubtu20cis_rule_1_2_1 or
55+
ubtu20cis_rule_1_3_1
5656
tags:
5757
- rule_1.3.1
58-
- rule_1.9
58+
- rule_1.2.1
5959
- always
6060

6161
- name: "PRELIM | Check for autofs service"

tasks/section_1/cis_1.6.x.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
regexp: "{{ item.regexp }}"
4040
replace: "{{ item.replace }}"
4141
with_items:
42-
- { regexp: 'apparmor=\S+', replace: 'apparmor=1' }
43-
- { regexp: 'security=\S+', replace: 'security=apparmor' }
42+
- { regexp: 'apparmor=[^\s"]+', replace: 'apparmor=1' }
43+
- { regexp: 'security=[^\s"]+', replace: 'security=apparmor' }
4444
when:
4545
- "'apparmor' in ubtu20cis_1_6_1_2_cmdline_settings.stdout"
4646
- "'security' in ubtu20cis_1_6_1_2_cmdline_settings.stdout"

tasks/section_4/cis_4.3.x.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
path: /etc/sudoers
2020
regexp: '^\s*Defaults\s+use_pty\s*$'
2121
line: 'Defaults use_pty'
22-
insertafter: 'EOF'
22+
insertafter: '^\s*Defaults'
2323
when:
2424
- ubtu20cis_rule_4_3_2
2525
tags:
@@ -35,7 +35,7 @@
3535
path: /etc/sudoers
3636
regexp: '^\s*Defaults\s+logfile\s*='
3737
line: 'Defaults logfile="{{ ubtu20cis_sudo_logfile }}"'
38-
insertafter: 'EOF'
38+
insertafter: '^\s*Defaults'
3939
when:
4040
- ubtu20cis_rule_4_3_3
4141
tags:
@@ -92,6 +92,7 @@
9292
regexp: '^\s*Defaults\s+timestamp_timeout\s*='
9393
line: "Defaults timestamp_timeout={{ ubtu20cis_sudo_timestamp_timeout }}"
9494
validate: '/usr/sbin/visudo -cf %s'
95+
insertafter: '^\s*Defaults'
9596
when: ubtu20cis_4_3_6_timeout_files.stdout | length == 0
9697

9798
- name: "4.3.6 | PATCH | Ensure sudo authentication timeout is configured correctly | Set value if has results"

tasks/section_5/cis_5.1.2.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
- { regexp: '^mail.info|^#mail.info', line: 'mail.info -/var/log/mail.info', insertafter: '^# Logging for the mail system' }
9898
- { regexp: '^mail.warn|^#mail.warn', line: 'mail.warn -/var/log/mail.warn', insertafter: '^# Logging for the mail system.' }
9999
- { regexp: '^mail.err|^#mail.err', line: 'mail.err /var/log/mail.err', insertafter: '^# Logging for the mail system.' }
100-
- { regexp: '^cron.\*|^#cron.\*', line: 'cron.\* /var/log/cron', insertafter: '^# First some standard log files' }
100+
- { regexp: '^cron.\*|^#cron.\*', line: 'cron.* /var/log/cron', insertafter: '^# First some standard log files' }
101101
- { regexp: '^\*.=warning;\*.=err|^#\*.=warning;\*.=err', line: '*.=warning;*.=err -/var/log/warn', insertafter: '^# First some standard log files' }
102102
- { regexp: '^\*.crit|^#\*.crit', line: '*.crit /var/log/warn', insertafter: '^# First some standard log files' }
103103
- { regexp: '^\*.\*;mail.none;news.none|^#\*.\*;mail.none;news.none', line: '*.*;mail.none;news.none -/var/log/messages', insertafter: '^# First some standard log files' }

tasks/section_5/cis_5.2.3.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
- name: "5.2.3.6 | PATCH | Ensure use of privileged commands is collected"
9494
block:
9595
- name: "5.2.3.6 | AUDIT | Ensure use of privileged commands is collected | Get list of privileged programs"
96-
ansible.builtin.shell: for i in $(df | grep '^/dev' | awk '{ print $NF }'); do find $i -xdev -type f -perm -4000 -o -type f -perm -2000 2>/dev/null; done
96+
ansible.builtin.shell: for i in $(findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) | grep -Pv "noexec|nosuid" | awk '{print $1}'); do find $i -xdev -type f -perm -4000 -o -type f -perm -2000 2>/dev/null; done
9797
register: priv_procs
9898
changed_when: false
9999
check_mode: false

0 commit comments

Comments
 (0)