Skip to content

Commit 900fcab

Browse files
committed
update readme and fix lint
1 parent 712e76b commit 900fcab

10 files changed

+27
-15
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Ansible CIS Ubuntu Linux 20.04 LTS [![Build Status](https://travis-ci.com/alivx/CIS-Ubuntu-20.04-Ansible.svg?branch=master)](https://travis-ci.com/alivx/CIS-Ubuntu-20.04-Ansible)
1+
<div align="center">
2+
<img src="https://raw.githubusercontent.com/alivx/CIS-Ubuntu-20.04-Ansible/master/files/header.png">
3+
</div>
4+
5+
6+
Ansible CIS Ubuntu 20.04 LTS [![Build Status](https://travis-ci.com/alivx/CIS-Ubuntu-20.04-Ansible.svg?branch=master)](https://travis-ci.com/alivx/CIS-Ubuntu-20.04-Ansible)
27
=========
38

49
CIS hardened Ubuntu: cyber attack and malware prevention for mission-critical systems

files/1_1_22.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
df --local -P | awk '{if (NR!=1) print $6}' | xargs -I '{}' find '{}' -xdev -type d \( -perm -0002 -a ! -perm -1000 \) 2>/dev/null | xargs -I '{}' chmod a+t '{}'

files/3_2_2.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
grep -Els "^\s*net\.ipv4\.ip_forward\s*=\s*1" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri "s/^\s*(net\.ipv4\.ip_forward\s*)(=)(\s*\S+\b).*$/#*REMOVED* \1/" $filename; done
3+
sysctl -w net.ipv4.ip_forward=0
4+
sysctl -w net.ipv4.route.flush=1

files/3_2_2_2.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
grep -Els "^\s*net\.ipv6\.conf\.all\.forwarding\s*=\s*1" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri "s/^\s*(net\.ipv6\.conf\.all\.forwarding\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/" $filename; done
3+
sysctl -w net.ipv6.conf.all.forwarding=0
4+
sysctl -w net.ipv6.route.flush=1

files/4_1_11.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
find / -xdev \( -perm -4000 -o -perm -2000 \) -type f | awk '{print "-a always,exit -F path=" $1 " -F perm=x -F auid>='"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)"' -F auid!=4294967295 -k privileged" }'

files/header.png

312 KB
Loading

tasks/section_1_Initial_Setup.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@
370370
register: worldWriteableList
371371

372372
- name: 1.1.22 Ensure sticky bit is set on all world-writable directories | fix
373-
shell: |
374-
df --local -P | awk '{if (NR!=1) print $6}' | xargs -I '{}' find '{}' -xdev -type d \( -perm -0002 -a ! -perm -1000 \) 2>/dev/null | xargs -I '{}' chmod a+t '{}'
373+
script: 1_1_22.sh
375374
when: worldWriteableList.stdout_lines |length > 0
376375

377376
tags:

tasks/section_3_Network_Configuration.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,12 @@
8282
value: "0"
8383
state: present
8484
reload: true
85-
when: IPv6_is_enabled
85+
# when: IPv6_is_enabled
8686
- name: 3.2.2 Ensure IP forwarding is disabled | IPV4 load"
87-
shell: |
88-
grep -Els "^\s*net\.ipv4\.ip_forward\s*=\s*1" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri "s/^\s*(net\.ipv4\.ip_forward\s*)(=)(\s*\S+\b).*$/#*REMOVED* \1/" $filename; done; sysctl -w net.ipv4.ip_forward=0; sysctl -w net.ipv4.route.flush=1
87+
script: 3_2_2.sh
8988
- name: 3.2.2 Ensure IP forwarding is disabled | IPV6 load"
90-
shell: |
91-
grep -Els "^\s*net\.ipv6\.conf\.all\.forwarding\s*=\s*1" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri "s/^\s*(net\.ipv6\.conf\.all\.forwarding\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/" $filename; done; sysctl -w net.ipv6.conf.all.forwarding=0; sysctl -w net.ipv6.route.flush=1
92-
when: IPv6_is_enabled
89+
script: 3_2_2_2.sh
90+
# when: IPv6_is_enabled
9391
tags:
9492
- section3
9593
- level_1_server

tasks/section_4_Logging_and_Auditing.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,8 @@
231231
- name: 4.1.11 Ensure use of privileged commands is collected
232232
block:
233233
- name: 4.1.11 Ensure use of privileged commands is collected | get data
234-
shell: |
235-
find / -xdev \( -perm -4000 -o -perm -2000 \) -type f | awk '{print "-a always,exit -F path=" $1 " -F perm=x -F auid>='"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)"' -F auid!=4294967295 -k privileged" }'
234+
script: 4_1_11.sh
236235
register: output_4_1_11
237-
238236
- name: 4.1.11 Ensure use of privileged commands is collected | apply
239237
template:
240238
src: files/templates/auditd/privileged.rules.j2

tasks/section_6_System_Maintenance.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,14 @@
344344
# 6.2.5 Ensure users' home directories permissions are 750 or more restrictive
345345
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive
346346
block:
347-
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | list
347+
- name: 6.2.5 Ensure users home directories permissions are 750 or more restrictive - list
348348
script: 6_2_5.sh
349349
register: output_6_2_5
350-
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | save
350+
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive - save
351351
copy:
352352
dest: "{{ outputfiles }}/6.2.5"
353353
content: "{{ output_6_2_5.stdout_lines }}"
354-
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | fix
354+
- name: 6.2.5 Ensure users home directories permissions are 750 or more restrictive - fix
355355
file:
356356
name: "{{ item }}"
357357
mode: "g-w,o-rwx"

0 commit comments

Comments
 (0)