Skip to content

Commit

Permalink
update readme and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alivx committed Sep 23, 2020
1 parent 712e76b commit 900fcab
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 15 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
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)
<div align="center">
<img src="https://raw.githubusercontent.com/alivx/CIS-Ubuntu-20.04-Ansible/master/files/header.png">
</div>


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)
=========

CIS hardened Ubuntu: cyber attack and malware prevention for mission-critical systems
Expand Down
2 changes: 2 additions & 0 deletions files/1_1_22.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
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 '{}'
4 changes: 4 additions & 0 deletions files/3_2_2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
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
4 changes: 4 additions & 0 deletions files/3_2_2_2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
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
2 changes: 2 additions & 0 deletions files/4_1_11.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
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" }'
Binary file added files/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tasks/section_1_Initial_Setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@
register: worldWriteableList

- name: 1.1.22 Ensure sticky bit is set on all world-writable directories | fix
shell: |
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 '{}'
script: 1_1_22.sh
when: worldWriteableList.stdout_lines |length > 0

tags:
Expand Down
10 changes: 4 additions & 6 deletions tasks/section_3_Network_Configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,12 @@
value: "0"
state: present
reload: true
when: IPv6_is_enabled
# when: IPv6_is_enabled
- name: 3.2.2 Ensure IP forwarding is disabled | IPV4 load"
shell: |
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
script: 3_2_2.sh
- name: 3.2.2 Ensure IP forwarding is disabled | IPV6 load"
shell: |
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
when: IPv6_is_enabled
script: 3_2_2_2.sh
# when: IPv6_is_enabled
tags:
- section3
- level_1_server
Expand Down
4 changes: 1 addition & 3 deletions tasks/section_4_Logging_and_Auditing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,8 @@
- name: 4.1.11 Ensure use of privileged commands is collected
block:
- name: 4.1.11 Ensure use of privileged commands is collected | get data
shell: |
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" }'
script: 4_1_11.sh
register: output_4_1_11

- name: 4.1.11 Ensure use of privileged commands is collected | apply
template:
src: files/templates/auditd/privileged.rules.j2
Expand Down
6 changes: 3 additions & 3 deletions tasks/section_6_System_Maintenance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@
# 6.2.5 Ensure users' home directories permissions are 750 or more restrictive
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive
block:
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | list
- name: 6.2.5 Ensure users home directories permissions are 750 or more restrictive - list
script: 6_2_5.sh
register: output_6_2_5
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | save
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive - save
copy:
dest: "{{ outputfiles }}/6.2.5"
content: "{{ output_6_2_5.stdout_lines }}"
- name: 6.2.5 Ensure users' home directories permissions are 750 or more restrictive | fix
- name: 6.2.5 Ensure users home directories permissions are 750 or more restrictive - fix
file:
name: "{{ item }}"
mode: "g-w,o-rwx"
Expand Down

0 comments on commit 900fcab

Please sign in to comment.