Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 14 additions & 10 deletions cfg/rke2-cis-1.23/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ groups:
- id: 1.1.7
text: "Ensure that the etcd pod specification file permissions are set to 644 or more restrictive (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "permissions=%a" {} +
else
echo "Directory not found"
fi'
/bin/sh -c '
if [ -e "$etcdconf" ]; then
stat -c "permissions=%a %n" "$etcdconf"
else
echo "Directory not found"
fi
'
use_multiple_values: true
tests:
bin_op: or
Expand All @@ -122,11 +124,13 @@ groups:
- id: 1.1.8
text: "Ensure that the etcd pod specification file ownership is set to root:root (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "ownership=%U:%G %n" {} +
else
echo "Directory not found"
fi'
/bin/sh -c '
if [ -e $etcdconf ]; then
stat -c "ownership=%U:%G %n" $etcdconf
else
echo "Directory not found"
fi
'
tests:
bin_op: or
test_items:
Expand Down
24 changes: 14 additions & 10 deletions cfg/rke2-cis-1.24/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ groups:
- id: 1.1.7
text: "Ensure that the etcd pod specification file permissions are set to 644 or more restrictive (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "permissions=%a" {} +
else
echo "Directory not found"
fi'
/bin/sh -c '
if [ -e "$etcdconf" ]; then
stat -c "permissions=%a %n" "$etcdconf"
else
echo "Directory not found"
fi
'
use_multiple_values: true
tests:
bin_op: or
Expand All @@ -122,11 +124,13 @@ groups:
- id: 1.1.8
text: "Ensure that the etcd pod specification file ownership is set to root:root (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "ownership=%U:%G %n" {} +
else
echo "Directory not found"
fi'
/bin/sh -c '
if [ -e $etcdconf ]; then
stat -c "ownership=%U:%G %n" $etcdconf
else
echo "Directory not found"
fi
'
tests:
bin_op: or
test_items:
Expand Down
26 changes: 14 additions & 12 deletions cfg/rke2-cis-1.7/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ groups:
- id: 1.1.7
text: "Ensure that the etcd pod specification file permissions are set to 600 or more restrictive (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" \
-exec stat -c "permissions=%a %n" {} +
else
echo "Directory not found"
fi'
use_multiple_values: true
/bin/sh -c '
if [ -e "$etcdconf" ]; then
stat -c "permissions=%a %n" "$etcdconf"
else
echo "Directory not found"
fi
'
tests:
bin_op: or
test_items:
Expand All @@ -125,11 +125,13 @@ groups:
- id: 1.1.8
text: "Ensure that the etcd pod specification file ownership is set to root:root (Automated)"
audit: |
/bin/sh -c 'if [ -d "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "ownership=%U:%G %n" {} +
else
echo "Directory not found"
fi'
/bin/sh -c '
if [ -e $etcdconf ]; then
stat -c "ownership=%U:%G %n" $etcdconf
else
echo "Directory not found"
fi
'
tests:
bin_op: or
test_items:
Expand Down
20 changes: 0 additions & 20 deletions cfg/rke2-cis-1.8/config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
---
## Version-specific settings that override the values in cfg/config.yaml

master:
components:
- apiserver
- kubelet
- scheduler
- controllermanager
- etcd
- policies
kubelet:
bins:
- kubelet
node:
kubelet:
defaultkubeconfig: "/node/etc/kubernetes/ssl/kubecfg-kube-node.yaml"
defaultcafile: "/node/etc/kubernetes/ssl/kube-ca.pem"
bins:
- kubelet
proxy:
defaultkubeconfig: "/node/etc/kubernetes/ssl/kubecfg-kube-proxy.yaml"
2 changes: 1 addition & 1 deletion cfg/rke2-cis-1.8/controlplane.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
controls:
version: "cis-1.8"
version: "rke2-cis-1.8"
id: 3
text: "Control Plane Configuration"
type: "controlplane"
Expand Down
5 changes: 1 addition & 4 deletions cfg/rke2-cis-1.8/etcd.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
controls:
version: "cis-1.8"
version: "rke2-cis-1.8"
id: 2
text: "Etcd Node Configuration"
type: "etcd"
groups:
- id: 1.1
text: "Control Plane Node Configuration Files"
checks:
- id: 2
text: "Etcd Node Configuration"
checks:
Expand Down
40 changes: 22 additions & 18 deletions cfg/rke2-cis-1.8/master.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
controls:
version: "cis-1.8"
version: "rke2-cis-1.8"
id: 1
text: "Control Plane Security Configuration"
type: "master"
Expand Down Expand Up @@ -98,15 +98,14 @@ groups:

- id: 1.1.7
text: "Ensure that the etcd pod specification file permissions are set to 600 or more restrictive (Automated)"

audit: |
/bin/sh -c 'if [ -e "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" \
-exec stat -c "permissions=%a %n" {} +
/bin/sh -c '
if [ -e "$etcdconf" ]; then
stat -c "permissions=%a %n" "$etcdconf"
else
echo "Directory not found"
fi'
use_multiple_values: true
fi
'
tests:
bin_op: or
test_items:
Expand All @@ -126,16 +125,21 @@ groups:
- id: 1.1.8
text: "Ensure that the etcd pod specification file ownership is set to root:root (Automated)"
audit: |
/bin/sh -c 'if [ -e "$etcdconf" ]; then
find "$etcdconf" -type f -name "*etcd*" -exec stat -c "%U:%G %n" {} +
/bin/sh -c '
if [ -e $etcdconf ]; then
stat -c "ownership=%U:%G %n" $etcdconf
else
echo "Directory not found"
fi'
use_multiple_values: true
fi
'
tests:
bin_op: or
test_items:
- flag: "root:root"
- flag: "ownership"
compare:
op: eq
value: "root:root"
set: true
- flag: "Directory not found"
set: true
remediation: |
Expand Down Expand Up @@ -181,10 +185,10 @@ groups:
- id: 1.1.11
text: "Ensure that the etcd data directory permissions are set to 700 or more restrictive (Automated)"
audit: |
/bin/sh -c 'if [ -e "/node/var/lib/etcd" ]; then
stat -c "%a" "/node/var/lib/etcd"
/bin/sh -c 'if [ -e "/var/lib/rancher/rke2/server/db/etcd" ]; then
stat -c "%a" "/var/lib/rancher/rke2/server/db/etcd"
else
echo "Directory not found: /node/var/lib/etcd"
echo "Directory not found: /var/lib/rancher/rke2/server/db/etcd"
fi'
tests:
bin_op: or
Expand All @@ -194,7 +198,7 @@ groups:
op: eq
value: "700"
set: true
- flag: "Directory not found: /node/var/lib/etcd"
- flag: "Directory not found: /var/lib/rancher/rke2/server/db/etcd"
remediation: |
On the etcd server node, get the etcd data directory, passed as an argument --data-dir,
from the command 'ps -ef | grep etcd'.
Expand All @@ -204,10 +208,10 @@ groups:

- id: 1.1.12
text: "Ensure that the etcd data directory ownership is set to etcd:etcd (Automated)"
audit: "stat -c %U:%G /node/var/lib/etcd"
audit: "stat -c %U:%G /var/lib/rancher/rke2/server/db/etcd"
tests:
test_items:
- flag: "etcd:etcd"
- flag: "root:root"
set: true
remediation: |
On the etcd server node, get the etcd data directory, passed as an argument --data-dir,
Expand Down
2 changes: 1 addition & 1 deletion cfg/rke2-cis-1.8/node.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
controls:
version: "cis-1.8"
version: "rke2-cis-1.8"
id: 4
text: "Worker Node Security Configuration"
type: "node"
Expand Down
2 changes: 1 addition & 1 deletion cfg/rke2-cis-1.8/policies.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
controls:
version: "cis-1.8"
version: "rke2-cis-1.8"
id: 5
text: "Kubernetes Policies"
type: "policies"
Expand Down
Loading