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

Fixes for kernel_config_security rules #11259

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Conversation

a-skr
Copy link
Contributor

@a-skr a-skr commented Nov 8, 2023

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Nov 8, 2023
Copy link

openshift-ci bot commented Nov 8, 2023

Hi @a-skr. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

github-actions bot commented Nov 8, 2023

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Nov 8, 2023

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_dmesg_restrict'.
--- xccdf_org.ssgproject.content_rule_kernel_config_security_dmesg_restrict
+++ xccdf_org.ssgproject.content_rule_kernel_config_security_dmesg_restrict
@@ -9,8 +9,7 @@
     To check the configuration value for CONFIG_SECURITY_DMESG_RESTRICT, run the following command:
     grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config-*
     
-    Configs with value 'n' are not explicitly set in the file, so either commented lines or no
-    lines should be returned.
+    For each kernel installed, a line with value "y" should be returned.
 
 [warning]:
 There is no remediation for this besides re-compiling the kernel with the appropriate value for the config.

OVAL for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_dmesg_restrict' differs.
--- oval:ssg-kernel_config_security_dmesg_restrict:def:1
+++ oval:ssg-kernel_config_security_dmesg_restrict:def:1
@@ -2,4 +2,3 @@
 criteria AND
 criterion oval:ssg-test_kernel_config_security_dmesg_restrict:tst:1
 criterion oval:ssg-test_all_kernels_config_security_dmesg_restrict_compliant:tst:1
-criterion oval:ssg-test_kernel_config_security_dmesg_restrict_absence:tst:1

OCIL for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_dmesg_restrict' differs.
--- ocil:ssg-kernel_config_security_dmesg_restrict_ocil:questionnaire:1
+++ ocil:ssg-kernel_config_security_dmesg_restrict_ocil:questionnaire:1
@@ -1,8 +1,7 @@
 To determine the config value the kernel was built with, run the following command:
     $ grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config.*
     
-    Configs with value 'n' are not explicitly set in the file, so either commented lines or no
-    lines should be returned.
+    For each kernel installed, a line with value "y" should be returned.
     
       Is it the case that the kernel was not built with the required value?
       
New content has different text for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_writable_hooks'.
--- xccdf_org.ssgproject.content_rule_kernel_config_security_writable_hooks
+++ xccdf_org.ssgproject.content_rule_kernel_config_security_writable_hooks
@@ -9,7 +9,8 @@
     To check the configuration value for CONFIG_SECURITY_WRITABLE_HOOKS, run the following command:
     grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config-*
     
-    For each kernel installed, a line with value "y" should be returned.
+    Configs with value 'n' are not explicitly set in the file, so either commented lines or no
+    lines should be returned.
 
 [warning]:
 There is no remediation for this besides re-compiling the kernel with the appropriate value for the config.

OVAL for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_writable_hooks' differs.
--- oval:ssg-kernel_config_security_writable_hooks:def:1
+++ oval:ssg-kernel_config_security_writable_hooks:def:1
@@ -2,3 +2,4 @@
 criteria AND
 criterion oval:ssg-test_kernel_config_security_writable_hooks:tst:1
 criterion oval:ssg-test_all_kernels_config_security_writable_hooks_compliant:tst:1
+criterion oval:ssg-test_kernel_config_security_writable_hooks_absence:tst:1

OCIL for rule 'xccdf_org.ssgproject.content_rule_kernel_config_security_writable_hooks' differs.
--- ocil:ssg-kernel_config_security_writable_hooks_ocil:questionnaire:1
+++ ocil:ssg-kernel_config_security_writable_hooks_ocil:questionnaire:1
@@ -1,7 +1,8 @@
 To determine the config value the kernel was built with, run the following command:
     $ grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config.*
     
-    For each kernel installed, a line with value "y" should be returned.
+    Configs with value 'n' are not explicitly set in the file, so either commented lines or no
+    lines should be returned.
     
       Is it the case that the kernel was not built with the required value?
       

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

Please change also other occurrences of the value in the rule.yml files (description, ocil), the rule.yml files need to be internally consistent.

This configuration option shall be set to prevent an unprivileged user to get information about kernel memory layout.

See ANSSI-BP-028 v2.0 guide.

Fixes issue ComplianceAsCode#11255
Those hooks shall be deactivated to prevent LSM deactivation at runtime. Hence, the kernel flag CONFIG_SECURITY_WRITABLE_HOOKS shall not be set.

See ANSSI-BP-028 v2.0 guide.

Fixes issue ComplianceAsCode#11254
@a-skr
Copy link
Contributor Author

a-skr commented Nov 12, 2023

Please find the commits amended with requested changes.

@jan-cerny jan-cerny self-assigned this Nov 13, 2023
@jan-cerny jan-cerny added the Update Rule Issues or pull requests related to Rules updates. label Nov 13, 2023
@jan-cerny jan-cerny added this to the 0.1.71 milestone Nov 13, 2023
Copy link

codeclimate bot commented Nov 13, 2023

Code Climate has analyzed commit e83193f and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 58.8%.

View more on Code Climate.

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

The fail of Ansible lint job is caused by update of the worker to F39 and isn't caused by the changes in this PR.

@jan-cerny jan-cerny merged commit 9f1de1e into ComplianceAsCode:master Nov 16, 2023
36 of 37 checks passed
@Mab879 Mab879 changed the title Fixes Fixes for kernel_config_security rules Nov 16, 2023
@a-skr a-skr deleted the fixes branch January 4, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants