bottlerocket-os / bottlerocket

An operating system designed for hosting containers
https://bottlerocket.dev
Other
8.78k stars 519 forks source link

fix: update permission bits for kubelet-exec-start-conf #4199

Closed Sparksssj closed 1 month ago

Sparksssj commented 2 months ago

Issue number: Closes #4173

Description of changes: Changed the mode code for configuration-files.kubelet-exec-start-conf, such that it will not generate error message. Screenshot 2024-09-16 at 2 52 51 PM

Screenshot 2024-09-16 at 4 55 59 PM

Testing done: Required migration test was done.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

bcressey commented 1 month ago

Can you verify that the file permissions are not flagged by the CIS Kubernetes report (at either level)?

Sparksssj commented 1 month ago

Can you verify that the file permissions are not flagged by the CIS Kubernetes report (at either level)?

Sorry but I'm not quite understand what this means.

bcressey commented 1 month ago

Sorry but I'm not quite understand what this means.

On an image with your changes applied, run this command and check the output:

$ apiclient report cis-k8s -l 2
Benchmark name:  CIS Kubernetes Benchmark (Worker Node)
Version:         v1.8.0
Reference:       https://www.cisecurity.org/benchmark/kubernetes
Benchmark level: 1
Start time:      2024-09-25T21:04:00.514761119Z

[PASS] 4.1.1     Ensure that the kubelet service file permissions are set to 644 or more restrictive (Automatic)
...
Compliance check result: PASS

It needs to continue to say "PASS" for both the 4.1.1 check and the final result.

bcressey commented 1 month ago

It would also be good to check the journal before and after, to confirm that the warnings are no longer logged.

Sparksssj commented 1 month ago

Screenshot 2024-09-26 at 10 15 42 AM I've confirmed the report shows PASS here.

bcressey commented 1 month ago

@Sparksssj can you also verify that the warnings from the related issue are no longer present?

Sparksssj commented 1 month ago

@Sparksssj can you also verify that the warnings from the related issue are no longer present?

Yes I confirm that this warning exist in previous version, and disappeared after the change.