Skip to content

Commit

Permalink
Merge branch 'devel' into nov23_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
uk-bolly committed Dec 11, 2023
2 parents 0f02967 + f082010 commit bd6c2ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
exclude: .config/.secrets.baseline

- repo: https://github.com/ansible-community/ansible-lint
rev: v6.22.0
rev: v6.22.1
hooks:
- id: ansible-lint
name: Ansible-lint
Expand Down
4 changes: 3 additions & 1 deletion tasks/section_2/cis_2.1.1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
state: stopped
enabled: false
masked: true
when: ubtu20cis_time_sync_tool != "systemd-timesyncd"
when:
- ubtu20cis_time_sync_tool != "systemd-timesyncd"
- "'systemd-timesyncd' in ansible_facts.packages"
when:
- ubtu20cis_rule_2_1_1_1
tags:
Expand Down
16 changes: 8 additions & 8 deletions tasks/section_4/cis_4.3.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
- name: "4.3.2 | PATCH | Ensure sudo commands use pty"
ansible.builtin.lineinfile:
path: /etc/sudoers
regexp: '^Defaults use_'
line: 'Defaults use_pty'
insertafter: '^Defaults'
regexp: '^\s*Defaults\s+use_pty\s*$'
line: 'Defaults use_pty'
insertafter: 'EOF'
when:
- ubtu20cis_rule_4_3_2
tags:
Expand All @@ -33,9 +33,9 @@
- name: "4.3.3 | PATCH | Ensure sudo log file exists"
ansible.builtin.lineinfile:
path: /etc/sudoers
regexp: '^Defaults logfile'
line: 'Defaults logfile="{{ ubtu20cis_sudo_logfile }}"'
insertafter: '^Defaults'
regexp: '^\s*Defaults\s+logfile\s*='
line: 'Defaults logfile="{{ ubtu20cis_sudo_logfile }}"'
insertafter: 'EOF'
when:
- ubtu20cis_rule_4_3_3
tags:
Expand Down Expand Up @@ -89,15 +89,15 @@
- name: "4.3.6 | PATCH | Ensure sudo authentication timeout is configured correctly | Set value if no results"
ansible.builtin.lineinfile:
path: /etc/sudoers
regexp: 'Defaults timestamp_timeout='
regexp: '^\s*Defaults\s+timestamp_timeout\s*='
line: "Defaults timestamp_timeout={{ ubtu20cis_sudo_timestamp_timeout }}"
validate: '/usr/sbin/visudo -cf %s'
when: ubtu20cis_4_3_6_timeout_files.stdout | length == 0

- name: "4.3.6 | PATCH | Ensure sudo authentication timeout is configured correctly | Set value if has results"
ansible.builtin.replace:
path: "{{ item }}"
regexp: 'timestamp_timeout=(\d+)'
regexp: 'timestamp_timeout\s*=\s*(\d+)'
replace: "timestamp_timeout={{ ubtu20cis_sudo_timestamp_timeout }}"
validate: '/usr/sbin/visudo -cf %s'
loop: "{{ ubtu20cis_4_3_6_timeout_files.stdout_lines }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/section_4/cis_4.5.1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
- name: "4.5.1.6 | PATCH | Ensure the number of changed characters in a new password is configured"
ansible.builtin.lineinfile:
path: /etc/security/pwquality.conf
regexp: '^(#\s+|)difok|'
regexp: '^(#\s+|)difok'
line: 'difok = {{ ubtu20cis_pass.character_changed }}'
create: true
mode: 0640
Expand Down
13 changes: 6 additions & 7 deletions tasks/section_4/cis_4.5.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@

- name: "4.5.4 | PATCH | Ensure default user umask is 027 or more restrictive"
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '(?i)(umask\s*)'
line: '\g<1>{{ ubtu20cis_bash_umask }}'
backrefs: true
path: "{{ item.path }}"
regexp: '(?i)(umask\s*\d\d\d)'
line: '{{ item.line }} {{ ubtu20cis_bash_umask }}'
with_items:
- /etc/bash.bashrc
- /etc/profile
- /etc/login.defs
- { path: '/etc/bash.bashrc', line: 'umask' }
- { path: '/etc/profile', line: 'umask' }
- { path: '/etc/login.defs', line: 'UMASK' }

- name: "4.5.4 | PATCH | Ensure default user umask is 027 or more restrictive"
ansible.builtin.lineinfile:
Expand Down
1 change: 0 additions & 1 deletion tasks/section_6/cis_6.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@
with_items: "{{ ubtu20cis_6_2_12_audit.stdout_lines }}"
when:
- ubtu20cis_6_2_12_audit.stdout | length > 0
- ubtu20cis_dotperm_ansibleManaged

- name: "6.2.12 | PATCH | Ensure local interactive user dot files access is configured | Ensure no users have .netrc files"
ansible.builtin.file:
Expand Down

0 comments on commit bd6c2ad

Please sign in to comment.