anthcourtney / ansible-role-cis-amazon-linux

Ansible role to apply CIS Amazon Linux Benchmark v2.0.0
MIT License
154 stars 140 forks source link

anthcourtney.cis-amazon-linux

Build Status

Branch Status
Master Build Status
Build Build Status

Development

We are going to use "master" branch only for fully tested changes.

Going forward please send your pull requests to "build" branch.

We need more community support to make changes and most importantly to test and review changes. If you would like to participate, please send a note to Anth or Chandan.

The major work to be done are

Introduction

This ansible role applies v2.0.0 of the CIS Amazon Linux Benchmark. https://benchmarks.cisecurity.org/tools2/linux/CIS_Amazon_Linux_Benchmark_v2.0.0.pdf

This role was developed and tested against Amazon Linux 2016.03. It has been tested against Amazon Linux 2016.09 with equal success.

Why Would I Use This Role?

If you are attempting to obtain compliance against an industry-accepted security standard, like PCI DSS, APRA or ISO 27001, then you need to demonstrate that you have applied documented hardening standards against all systems within scope of assessment.

If you are running Amazon Linux, then this role attempts to provide one piece of the solution to the compliance puzzle.

Here Be Dragons!

If you are considering applying this role to any servers, you should have a basic familiarity with the CIS Benchmark (or other similar benchmarks) and an appreciation for the impact that it may have on a system.

Please take the time to familarise yourself with the standard and with the configurable default values, and exclude any items before applying to a system.

An examples of items that should be immediately considered for exclusion (or at least, for modification of the related default values) include:

Amazon Linux and SE Linux

By default SElinux is disabled via grub in amazon linux.

To enable edit ;

/boot/grub/menu.lst

Modifiy selinux=0 to selinux=1

touch /etc/selinux/config

Also install the following package to allow the ansible SElinux module to function on the host.

yum install libselinux-python

A reboot will be neccessary for the changes to take effect.

Example Playbook

An example playbook which uses this role is as follows:

---

- hosts: localhost
  connection: local
  gather_facts: true
  become: yes

  roles:
    - anthcourtney.cis-amazon-linux

A more advanced example, which includes modifications to the default values used, as well as the exclusion of some items in the benchmark which are considered unnecessary for a fictional environment, is as follows:

---

- hosts: localhost
  connection: local
  gather_facts: true
  become: yes

  vars:
    cis_level_1_exclusions:
      - 5.4.4
      - 3.4.2
      - 3.4.3
      - 6.2.13
    cis_pass_max_days: 45
    cis_umask_default: 002

  roles:
    - anthcourtney.cis-amazon-linux

Note that the use of become: yes is required as 99% of tasks require privileged access to execute.

Role Variables

See defaults/main.yml for variables which can be overriden according to preference.

Options

Tags (and combinations thereof) can be used to run a particular level of the CIS standard, a section, or an individual recommendation. For example:

ansible-playbook playbook.yml -t level-1
ansible-playbook playbook.yml -t section-3
ansible-playbook playbook.yml -t 1.3.1,2.2.10
ansible-playbook playbook.yml -t scored

Limitations

At present, only the Level 1 items of the benchmark are implemented. Level 2 items will be added as time permits.

The following checks have not been implemented:

Compatibility

This role is compatible with the following versions of ansible:

This role has not been tested against any other versions of ansible.

Testing

The following testing processes are applied by the developer of this role:

The following tests have been flagged but are not yet implemented:

Lint

Please run make lint to make sure we are following ansible standards.

License

MIT.

Author Information

This role was developed by Anth Courtney.

All feedback, issues and PRs are encouraged and appreciated.