Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

chore(CIS): grub configuration changes to accommodate CIS #1111

Merged
merged 3 commits into from Apr 22, 2019

Conversation

jackfrancis
Copy link
Member

Reason for Change:

Enables auditing via grub, see https://secscan.acron.pl/centos7/4/1/3

Issue Fixed:

Fixes #1009

Requirements:

Notes:

@acs-bot acs-bot added the size/M label Apr 22, 2019
@acs-bot
Copy link

acs-bot commented Apr 22, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jackfrancis jackfrancis added this to In progress in CIS spike - Spring 2019 Apr 22, 2019
@jackfrancis
Copy link
Member Author

Validated w/ "ubuntu" distro:

  should validate all cloud-init-paved files
  /Users/jackfrancis/work/src/github.com/Azure/aks-engine/test/e2e/kubernetes/kubernetes_test.go:237

$ k config view -o json

$ k get nodes -o json

$ scp -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -o StrictHostKeyChecking=no scripts/cloud-init-files-validate.sh azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com:/tmp/cloud-init-files-validate.sh
2019/04/22 10:06:42 Authorized uses only. All activity may be monitored and reported.


$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -o ConnectTimeout=30 -o StrictHostKeyChecking=no azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com -p 22 scp -o StrictHostKeyChecking=no /tmp/cloud-init-files-validate.sh k8s-agentpool1-12763148-vmss000000:/tmp/cloud-init-files-validate.sh

$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -p 22 -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR k8s-agentpool1-12763148-vmss000000 "/tmp/cloud-init-files-validate.sh"

$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -o ConnectTimeout=30 -o StrictHostKeyChecking=no azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com -p 22 scp -o StrictHostKeyChecking=no /tmp/cloud-init-files-validate.sh k8s-agentpool1-12763148-vmss000001:/tmp/cloud-init-files-validate.sh

$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -p 22 -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR k8s-agentpool1-12763148-vmss000001 "/tmp/cloud-init-files-validate.sh"

$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -o ConnectTimeout=30 -o StrictHostKeyChecking=no azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com -p 22 scp -o StrictHostKeyChecking=no /tmp/cloud-init-files-validate.sh k8s-master-12763148-0:/tmp/cloud-init-files-validate.sh

$ ssh -A -i /Users/jackfrancis/work/src/github.com/Azure/aks-engine/_output/kubernetes-westus2-28812-ssh -p 22 -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR azureuser@kubernetes-westus2-28812.westus2.cloudapp.azure.com ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR k8s-master-12763148-0 "/tmp/cloud-init-files-validate.sh"
•

@codecov
Copy link

codecov bot commented Apr 22, 2019

Codecov Report

Merging #1111 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff            @@
##           master   #1111      +/-   ##
=========================================
+ Coverage    74.4%   74.4%   +<.01%     
=========================================
  Files         131     131              
  Lines       18283   18284       +1     
=========================================
+ Hits        13603   13604       +1     
  Misses       3901    3901              
  Partials      779     779

@@ -0,0 +1,35 @@
# If you change this file, run 'update-grub' afterwards to update
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this file "lighter" by removing a lot of the commented out lines?

Copy link
Member

@mboersma mboersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

stat /boot/grub/grub.cfg | grep 'Access: (0400' || exit 1
# validate grub configuration
sudo grep "^\s*linux" /boot/grub/grub.cfg | grep 'audit=1' || exit 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also grep for ipv6.disable=1 or is that not part of the CIS recommendation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in fact this grep is carried over specifically from here:

https://secscan.acron.pl/centos7/4/1/3

@jackfrancis jackfrancis merged commit 21561b2 into Azure:master Apr 22, 2019
CIS spike - Spring 2019 automation moved this from In progress to Done Apr 22, 2019
@jackfrancis jackfrancis deleted the cis-grub-configuration branch April 22, 2019 23:19
@CecileRobertMichon CecileRobertMichon moved this from Done to Won't do in CIS spike - Spring 2019 Aug 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

CIS 4.1.3 Ensure auditing for processes that start prior to auditd is enabled
4 participants