Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 31 #32

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
747f23c
thanks to @lukebakare #10
uk-bolly Mar 17, 2023
145edd9
thanks to @nvntsin #11
uk-bolly Mar 17, 2023
9627728
updated goss version and url
uk-bolly Mar 22, 2023
b952bcd
updated inline with galaxy
uk-bolly Mar 22, 2023
546903b
lint update
uk-bolly Mar 22, 2023
cda5a60
updated for galaxy
uk-bolly Mar 22, 2023
e6da774
Added update
uk-bolly Mar 22, 2023
772bb5b
updated date
uk-bolly Mar 22, 2023
d91e203
nice lint options added
uk-bolly Mar 22, 2023
0993116
lint updates
uk-bolly Mar 22, 2023
38680a2
dummy update
uk-bolly Mar 22, 2023
96ac4cb
#18 corrected
uk-bolly May 16, 2023
e5f54b2
updated due to #19 great catch
uk-bolly May 16, 2023
7ad9390
devel to main release (#27)
uk-bolly May 1, 2024
b1b78c2
Issues #28 addressed thansk to @msachikanta
uk-bolly Jun 4, 2024
816d358
addressed issue #29 thanks to @msachikanta
uk-bolly Jun 4, 2024
dcba658
test
mfortin Jun 4, 2024
9f24235
test
mfortin Jun 4, 2024
4bd71bb
test
mfortin Jun 4, 2024
4b0b0fc
oops
mfortin Jun 4, 2024
b827520
oops
mfortin Jun 4, 2024
a698af4
Cleanup commented out lines
mfortin Jun 4, 2024
f419d7c
test
mfortin Jun 5, 2024
d793800
another attempt
mfortin Jun 5, 2024
0c47587
test
mfortin Jun 5, 2024
6ff5392
test
mfortin Jun 4, 2024
14d4a3e
test
mfortin Jun 4, 2024
c60f60e
test
mfortin Jun 4, 2024
920aaf6
oops
mfortin Jun 4, 2024
7b5c864
oops
mfortin Jun 4, 2024
b716e17
Cleanup commented out lines
mfortin Jun 4, 2024
c1482c5
test
mfortin Jun 5, 2024
fdab44d
another attempt
mfortin Jun 5, 2024
506cef0
test
mfortin Jun 5, 2024
6bf30bd
Merge branch 'grub' of github.com:mfortin/AMAZON2-CIS into grub
mfortin Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tasks/section_4/cis_4.1.1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@
- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled"
block:
- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled | Get Grub CMDLINE Settings"
shell: grep GRUB_CMDLINE_LINUX= /etc/default/grub | cut -d'"' -f2
shell: grep -c -E '^GRUB_CMDLINE_LINUX(_DEFAULT)?=' /etc/default/grub
changed_when: false
failed_when: false
register: amazon2cis_4_1_1_3_grub_cmdline_linux

- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled | Set if audit setting already set"
replace:
- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled | Set if Grub CMDLINE exists"
lineinfile:
path: /etc/default/grub
regexp: 'audit=([^\D]+)'
replace: 'audit=1'
regexp: '^(GRUB_CMDLINE_LINUX(?:_DEFAULT)?)="(.*)( audit=\d)?(.*)"'
line: '\1="\2 audit=1\3"'
backrefs: true
notify: grub2cfg
when: "'audit=' in amazon2cis_4_1_1_3_grub_cmdline_linux.stdout"
when: "'1' in amazon2cis_4_1_1_3_grub_cmdline_linux.stdout"

- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled | Set if audit setting not already set"
- name: "4.1.1.3 | PATCH | Ensure auditing for processes that start prior to auditd is enabled | Set if Grub CMDLINE does not exist"
lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX='
line: 'GRUB_CMDLINE_LINUX="{{ amazon2cis_4_1_1_3_grub_cmdline_linux.stdout }} audit=1"'
line: 'GRUB_CMDLINE_LINUX="audit=1"'
notify: grub2cfg
when: "'audit=' not in amazon2cis_4_1_1_3_grub_cmdline_linux.stdout"
when: "'0' in amazon2cis_4_1_1_3_grub_cmdline_linux.stdout"
when:
- amazon2cis_rule_4_1_1_3
tags:
Expand Down
24 changes: 12 additions & 12 deletions tasks/section_4/cis_4.1.2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@
- name: "4.1.2.4 | PATCH | Ensure audit_backlog_limit is sufficient"
block:
- name: "4.1.2.4 | AUDIT | Ensure audit_backlog_limit is sufficient | Grep GRUB_CMDLINE_LINUX parameter"
shell: grep 'GRUB_CMDLINE_LINUX=' /etc/default/grub | cut -f2 -d'"'
shell: grep -c -E 'GRUB_CMDLINE_LINUX(_DEFAULT)?=' /etc/default/grub
changed_when: false
failed_when: false
register: amazon2cis_4_1_2_4_grub_cmdline_linux_settings

- name: "4.1.2.4 | PATCH | Ensure audit_backlog_limit is sufficient | Set audit_backlog_limit if not configured"
- name: "4.1.2.4 | PATCH | Ensure audit_backlog_limit is sufficient | Set audit_backlog_limit if GRUB_CMDLINE_LINUX exists"
lineinfile:
dest: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX='
line: 'GRUB_CMDLINE_LINUX="{{ amazon2cis_4_1_2_4_grub_cmdline_linux_settings.stdout }} audit_backlog_limit={{ amazon2cis_audit_backlog_limit }}"'
path: /etc/default/grub
regexp: '^(GRUB_CMDLINE_LINUX(?:_DEFAULT)?)="(.*)( audit_backlog_limit={{ amazon2cis_audit_backlog_limit }})?(.*)"'
line: '\1="\2 audit_backlog_limit={{ amazon2cis_audit_backlog_limit }}\3"'
backrefs: true
notify: grub2cfg
when: '"audit_backlog_limit" not in amazon2cis_4_1_2_4_grub_cmdline_linux_settings.stdout'
when: "'1' in amazon2cis_4_1_2_4_grub_cmdline_linux_settings.stdout"

- name: "4.1.2.4 | PATCH | Ensure audit_backlog_limit is sufficient | Adjust audit_backlog_limit if exists"
replace:
dest: /etc/default/grub
regexp: 'audit_backlog_limit=([^\D]+)'
replace: 'audit_backlog_limit={{ amazon2cis_audit_backlog_limit }}'
- name: "4.1.2.4 | PATCH | Ensure audit_backlog_limit is sufficient | Set audit_backlog_limit if GRUB_CMDLINE_LINUX does not exists"
lineinfile:
path: /etc/default/grub
replace: 'GRUB_CMDLINE_LINUX="audit_backlog_limit={{ amazon2cis_audit_backlog_limit }}"'
notify: grub2cfg
when: '"audit_backlog_limit" in amazon2cis_4_1_2_4_grub_cmdline_linux_settings.stdout'
when: "'0' in amazon2cis_4_1_2_4_grub_cmdline_linux_settings.stdout"
when:
- amazon2cis_rule_4_1_2_4
tags:
Expand Down
Loading