Skip to content

Commit 132801d

Browse files
authored
Merge pull request #87 from ansible-lockdown/devel
Release to main branch
2 parents 13568c3 + 4c02b43 commit 132801d

File tree

14 files changed

+87
-80
lines changed

14 files changed

+87
-80
lines changed

.yamllint

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
extends: default
44

55
rules:
6-
braces: {max-spaces-inside: 1, level: error}
7-
brackets: {max-spaces-inside: 1, level: error}
8-
colons: {max-spaces-after: -1, level: error}
9-
commas: {max-spaces-after: -1, level: error}
10-
comments: disable
11-
comments-indentation: disable
12-
document-start: disable
13-
empty-lines: {max: 3, level: error}
14-
hyphens: {level: error}
15-
indentation:
16-
# Requiring 4 space indentation
17-
spaces: 4
18-
# Requiring consistent indentation within a file, either indented or not
19-
indent-sequences: consistent
20-
key-duplicates: enable
21-
line-length: disable
22-
new-line-at-end-of-file: enable
23-
new-lines:
24-
type: unix
25-
trailing-spaces: enable
26-
truthy:
27-
allowed-values: ['true', 'false']
28-
check-keys: true
6+
braces: {max-spaces-inside: 1, level: error}
7+
brackets: {max-spaces-inside: 1, level: error}
8+
colons: {max-spaces-after: -1, level: error}
9+
commas: {max-spaces-after: -1, level: error}
10+
comments: disable
11+
comments-indentation: disable
12+
document-start: disable
13+
empty-lines: {max: 3, level: error}
14+
hyphens: {level: error}
15+
indentation:
16+
# Requiring 4 space indentation
17+
spaces: 4
18+
# Requiring consistent indentation within a file, either indented or not
19+
indent-sequences: consistent
20+
key-duplicates: enable
21+
line-length: disable
22+
new-line-at-end-of-file: enable
23+
new-lines:
24+
type: unix
25+
trailing-spaces: enable
26+
truthy:
27+
allowed-values: ['true', 'false']
28+
check-keys: true

Changelog.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
# Change log for Ubuntu 2004
22

3+
## V1.0.1 - based upon CIS 1.1.0
4+
5+
thanks to ikthomas
6+
[#84](https://github.com/ansible-lockdown/UBUNTU20-CIS/issues/84)
7+
38
## v1.0.0
49

510
- update galaxy lint requirements
611
- license file
712
- ansible version
813

9-
## Feb 23 updates - Initial
14+
## April 2023 Updates
15+
- Addressed Bugs
16+
- [#73](https://github.com/ansible-lockdown/UBUNTU20-CIS/issues/73) - Thanks @fnschroeder (Fix Taken From @uk-bolly issue_73 branch)
17+
- [#80](https://github.com/ansible-lockdown/UBUNTU20-CIS/issues/80) - Thanks @kdebisschop
18+
- Added Fixes For Outstanding PR's
19+
- [#81](https://github.com/ansible-lockdown/UBUNTU20-CIS/pull/81) - Thanks @kdebisschop
20+
- Fixed Linting Errors For Yamllint & Ansbile-Lint
21+
- Adjusted Builtin to Posix For sysctl module.
1022

11-
### based upon CIS 1.1.0
23+
## Feb 23 updates - Initial
1224

1325
- lint files updated
1426
- ansible version updated

collections/requirements.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22

33
collections:
4-
- name: community.general
5-
- name: community.crypto
6-
- name: ansible.posix
4+
- name: community.general
5+
6+
- name: community.crypto
7+
8+
- name: ansible.posix

defaults/main.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -396,17 +396,6 @@ ubtu20cis_tmp_fstab_options: "defaults,rw,nosuid,nodev,noexec,relatime"
396396
# To conform to CIS control 1.1.9 noexec needs to be present
397397
ubtu20cis_dev_shm_fstab_options: "defaults,noexec,nodev,nosuid"
398398

399-
# Control 1.1.12/1.1.13/1.1.14
400-
# These are the settings for the /var/tmp mount
401-
# To conform to CIS control 1.1.12 nodev needs to be present in opts
402-
# To conform to CIS control 1.1.13 nosuid needs to be present in opts
403-
# To conform to CIS control 1.1.14 noexec needs to be present in opts
404-
ubtu20cis_vartmp:
405-
source: /tmp
406-
fstype: none
407-
opts: "defaults,nodev,nosuid,noexec,bind"
408-
enabled: false
409-
410399
# Control 1.3.1 - allow aide to be configured
411400
ubtu20cis_config_aide: true
412401

@@ -431,14 +420,14 @@ ubtu20cis_aide_cron:
431420
ubtu20cis_set_grub_password: true
432421
ubtu20cis_grub_user_file: /etc/grub.d/40_custom
433422
ubtu20cis_grub_users: root
434-
ubtu20cis_grub_pw: "grub.pbkdf2.sha512.10000.ChangeMe"
423+
ubtu20cis_grub_pw: "grub.pbkdf2.sha512.10000"
435424
# Change the following value to true if you wish to be prompted to get past grub bootloader
436425
ubtu20cis_ask_passwd_to_boot: false
437426

438427
# 1.4.4
439428
# note this needs to be in the encrypted format
440429
ubtu20cis_set_root_password: true
441-
ubtu20cis_root_pw: $6$this_is_needs_to_be_changed
430+
ubtu20cis_root_pw: $6$
442431

443432
# 1.7.1
444433
# disable dynamic motd to stop extra sshd message from appearing
@@ -454,7 +443,7 @@ ubtu20cis_warning_banner: |
454443
# Control 2.1.1.1
455444
# ubtu20cis_time_sync_tool is the tool in which to synchronize time
456445
# The two options are chrony, ntp, or systemd-timesyncd
457-
ubtu20cis_time_sync_tool: "ntp"
446+
ubtu20cis_time_sync_tool: "chrony"
458447

459448
# Control 2.1.1.2
460449
# ubtu20cis_ntp_server_list is the list ntp servers
@@ -504,7 +493,7 @@ ubtu20cis_ufw_allow_out_ports:
504493

505494
ufw_add_incoming: false
506495
ubtu20cis_ufw_allow_in:
507-
- ports: 22
496+
- port: 22
508497
from: any
509498
proto: tcp
510499

handlers/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@
33
- name: remount tmp
44
ansible.posix.mount:
55
name: /tmp
6-
src: /tmp
76
state: remounted
87

98
- name: remount dev_shm
109
ansible.posix.mount:
1110
name: /dev/shm
12-
src: /dev/shm
1311
state: remounted
1412

1513
- name: remount var_tmp
1614
ansible.posix.mount:
1715
name: /var/tmp
18-
src: "{{ ubtu20cis_vartmp['source'] }}"
1916
state: remounted
2017

2118
- name: grub update

tasks/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
tags:
4949
- run_audit
5050

51-
- ansible.builtin.import_tasks: parse_etc_password.yml
51+
- name: Run parse /etc/passwd
52+
ansible.builtin.import_tasks: parse_etc_password.yml
5253
when:
5354
- ubtu20cis_section5_patch or
5455
ubtu20cis_section6_patch
@@ -119,7 +120,7 @@
119120
- skip_reboot
120121

121122
- name: run post remediation tasks
122-
import_tasks: post.yml
123+
ansible.builtin.import_tasks: post.yml
123124
tags:
124125
- post_tasks
125126
- always

tasks/prelim.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
name: network-manager
5959
state: present
6060
when:
61+
- wireless_interfaces.stdout is defined
6162
- wireless_interfaces.stdout | length > 0
6263
- ubtu20cis_install_network_manager
6364
- ubtu20cis_rule_3_1_2

tasks/section_1/cis_1.1.x.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,27 @@
127127
- automated
128128
- audit
129129
- rule_1.1.11
130-
- var/tmp
130+
- var_tmp
131131

132132
- name: |
133133
"1.1.12 | PATCH | Ensure /var/tmp partition includes the nodev option"
134134
"1.1.13 | PATCH | Ensure /var/tmp partition includes the nosuid option"
135135
"1.1.14 | PATCH | Ensure /var/tmp partition includes the noexec option"
136136
ansible.posix.mount:
137137
name: /var/tmp
138-
src: "{{ ubtu20cis_vartmp['source'] }}"
138+
src: "{{ item.device }}"
139139
state: present
140-
fstype: "{{ ubtu20cis_vartmp['fstype'] }}"
141-
opts: "{{ ubtu20cis_vartmp['opts'] }}"
140+
fstype: "{{ item.fstype }}"
141+
opts: "defaults,{% if ubtu20cis_rule_1_1_12 %}nodev,{% endif %}{% if ubtu20cis_rule_1_1_13 %}nosuid,{% endif %}{% if ubtu20cis_rule_1_1_14 %}noexec{% endif %}"
142+
loop: "{{ ansible_mounts }}"
143+
loop_control:
144+
label: "{{ item.device }}"
142145
notify: remount var_tmp
143146
when:
144147
- ubtu20cis_rule_1_1_12 or
145148
ubtu20cis_rule_1_1_13 or
146149
ubtu20cis_rule_1_1_14
147-
- ubtu20cis_vartmp['enabled']
150+
- item.mount == '/var/tmp'
148151
tags:
149152
- level1-server
150153
- level1-workstation
@@ -153,7 +156,7 @@
153156
- rule_1.1.12
154157
- rule_1.1.13
155158
- rule_1.1.14
156-
- var/tmp
159+
- var_tmp
157160

158161
- name: "1.1.15 | AUDIT | Ensure separate partition exists for /var/log"
159162
block:
@@ -175,7 +178,7 @@
175178
- automated
176179
- audit
177180
- rule_1.1.15
178-
- var/log
181+
- var_log
179182

180183
- name: "1.1.16 | AUDIT | Ensure separate partition exists for /var/log/audit"
181184
block:
@@ -196,7 +199,7 @@
196199
- level2-workstation
197200
- automated
198201
- audit
199-
- var/log/audit
202+
- var_log_audit
200203

201204
- name: "1.1.17 | AUDIT | Ensure separate partition exists for /home"
202205
block:
@@ -217,7 +220,7 @@
217220
- level2-workstation
218221
- automated
219222
- audit
220-
- /home
223+
- home
221224

222225
- name: "1.1.18 | PATCH | Ensure /home partition includes the nodev option"
223226
ansible.posix.mount:
@@ -226,7 +229,7 @@
226229
state: mounted
227230
fstype: "{{ item.fstype }}"
228231
opts: "nodev"
229-
with_items: "{{ ansible_mounts }}"
232+
loop: "{{ ansible_mounts }}"
230233
loop_control:
231234
label: "{{ item.device }}"
232235
when:
@@ -238,7 +241,7 @@
238241
- automated
239242
- patch
240243
- rule_1.1.18
241-
- /home
244+
- home
242245

243246
- name: "1.1.19 | AUDIT | Ensure nodev option set on removable media partitions"
244247
ansible.builtin.debug:

tasks/section_1/cis_1.5.x.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
line: 'kernel.randomize_va_space = 2'
3838

3939
- name: "1.5.2 | PATCH | Ensure address space layout randomization (ASLR) is enabled | Set active kernel parameter"
40-
ansible.builtin.sysctl:
40+
ansible.posix.sysctl:
4141
name: kernel.randomize_va_space
4242
value: '2'
4343
when:
@@ -75,7 +75,7 @@
7575
- name: "1.5.4 | PATCH | Ensure core dumps are restricted"
7676
block:
7777
- name: "1.5.4 | PATCH | Ensure core dumps are restricted | kernel sysctl"
78-
ansible.builtin.sysctl:
78+
ansible.posix.sysctl:
7979
name: fs.suid_dumpable
8080
value: '0'
8181
state: present

tasks/section_2/cis_2.1.x.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
state: stopped
7676
enabled: false
7777
masked: true
78+
when: "'systemd-timesyncd' in ansible_facts.packages"
7879

7980
- name: "2.1.1.3 | AUDIT | Ensure chrony is configured | Check for chrony user"
8081
ansible.builtin.shell: grep {{ ubtu20cis_chrony_user }} /etc/passwd

0 commit comments

Comments
 (0)