-
Notifications
You must be signed in to change notification settings - Fork 714
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
ANSSI high profile triggers OpenSCAP error #10450
Comments
The #10334 PR included the |
This is the OVAL check for <def-group>
<definition class="compliance" id="kernel_config_binfmt_misc"
version="1">
<metadata>
<title>Disable kernel support for MISC binaries</title>
<affected family="unix">
<platform>multi_platform_all</platform>
</affected>
<description>The kernel CONFIG_BINFMT_MISC should have value n</description>
</metadata>
<criteria operator="OR">
<criteria operator="AND">
<criterion comment="Check presence of build configuration of installed kernels"
test_ref="test_kernel_config_binfmt_misc" />
<criterion comment="Ensure all kernels have the config"
test_ref="test_all_kernels_config_binfmt_misc_compliant" />
</criteria>
<criterion comment="Check absense of build configuration of installed kernels"
test_ref="test_kernel_config_binfmt_misc_absence" />
</criteria>
</definition>
<ind:textfilecontent54_test check="all"
comment="Check /boot/config-.* files for CONFIG_BINFMT_MISC=n"
id="test_kernel_config_binfmt_misc" version="1">
<ind:object object_ref="object_kernel_config_binfmt_misc" />
<ind:state state_ref="state_kernel_config_binfmt_misc" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_kernel_config_binfmt_misc" version="1">
<ind:filepath operation="pattern match">^/boot/config-.*$</ind:filepath>
<ind:pattern operation="pattern match">^CONFIG_BINFMT_MISC="?(.*?)"?$</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_state id="state_kernel_config_binfmt_misc" version="1">
<ind:subexpression operation="equals" datatype="string">n</ind:subexpression>
</ind:textfilecontent54_state>
<ind:textfilecontent54_test check="all" check_existence="none_exist"
comment="Check /boot/config-.* files for absence of CONFIG_BINFMT_MISC"
id="test_kernel_config_binfmt_misc_absence" version="1">
<ind:object object_ref="object_kernel_config_binfmt_misc" />
</ind:textfilecontent54_test>
<ind:variable_test check="all" check_existence="all_exist"
comment="Check if all installed kernels are compliant"
id="test_all_kernels_config_binfmt_misc_compliant" version="1">
<ind:object object_ref="object_var_kernel_config_binfmt_misc_count" />
<ind:state state_ref="state_var_kernel_config_binfmt_misc" />
</ind:variable_test>
<ind:variable_object id="object_var_kernel_config_binfmt_misc_count" version="1">
<ind:var_ref>local_var_config_binfmt_misc_count_kernels_installed</ind:var_ref>
</ind:variable_object>
<ind:variable_state id="state_var_kernel_config_binfmt_misc" version="1">
<ind:value operation="equals" datatype="int"
var_ref="local_var_config_binfmt_misc_count_compliant_configs" />
</ind:variable_state>
<local_variable comment="Count number of kernels installed" datatype="int"
id="local_var_config_binfmt_misc_count_kernels_installed" version="1">
<count>
<unique>
<object_component object_ref="object_kernel_config_binfmt_misc_files"
item_field="filepath" />
</unique>
</count>
</local_variable>
<local_variable comment="Count number of configs found" datatype="int"
id="local_var_config_binfmt_misc_count_compliant_configs" version="1">
<count>
<unique>
<object_component object_ref="object_kernel_config_binfmt_misc"
item_field="filepath" />
</unique>
</count>
</local_variable>
<unix:file_object comment="Collect the kernel config files" id="object_kernel_config_binfmt_misc_files" version="1">
<unix:path>/boot</unix:path>
<unix:filename operation="pattern match">^config-.*$</unix:filename>
</unix:file_object>
</def-group> |
@ggbecker Should we see something specific there? Reminder that the error happens during evaluation of rule audit_rules_privileged_command. |
Probably not, it's just that we were wondering if it would be related to the rule |
Yes, as Marcus mentioned the rule kernel_config_binfmt_misc is probably unrelated because the template used in the rule doesn't provide any remediation. |
@jan-cerny But the error comes from openscap scan so the problem might be related to OVAL test. |
@mildas yes, it's related to an OVAL |
@marcusburghardt In that test we are scanning mountpoints matching |
The relevant OVAL from the
Based on the error message, I guess it is generated when processing this
It seems the If so, the idea from @jan-cerny to adjust the On the other hand, I am not sure why the In any case, manually excluding the |
This OVAL partition_test should match all mount points on the target system. Here is what OpenSCAP partition_probe does when evaluates this OVAL test: It iterates over all entries in
On my local laptop I can see the problematic path
Possibly, we might need special handling for the "pseudofilesystems" in oscap. |
Hello. So I also did some investigation. It seems that this file system is handled by Systemd. I am attaching recording of a session where I show it. |
Does that mean that oscap has problems with accessing automounts? |
We had multiple issues in past with auto mounts: OpenSCAP/openscap#1329 OpenSCAP/openscap#1342 |
Just a note: This happens on a RHEL8 system after I did
|
Should we skip |
I believe the suggestion from @jan-cerny , to remove the |
Another note - if you perform evaluation with the full profile (not using ds_unselect_rules script), you will encounter similar error message at multiple rules but it is about polyinstantiated temporary directories in /tmp/tmp-inst. |
I was able to reproduce it locally on a RHEL 8.8 Virtual machine. I performed scan, remediation, reboot and another scan. The error message appeared during the scan after the reboot. The error message appeared twice, first during evaluation of rule Then, I checked the status of the systemd automount and mount units that are responsible for the pseudo file system mounted at our problematic path. I find the output interesting, because both systemd units are in a failed state:
|
With help of @jan-cerny's findings, I managed to found the cause of the problem. And the winner is... the rule sebool_secure_mode_insmod. It effectively blocks loading of modules by processes. I suggest we do the same as with the rule sysctl_kernel_modules_disabled - disable the Bash remediation because it will cause the some trouble. Opinions@ @yuumasato |
After further discussions, I decided to suggest a PR which skips the /proc directory for audit_rules_privileged_commands rule. Removing remediation of the sebool_secure_mode_insmod would solve the problem, but the rule is just doing its job and it is doing it apparently well. |
Description of problem:
The upstream CI job testing-farm:centos-stream-8-x86_64 and testing-farm:centos-stream-9-x86_64 fail on the test /Sanity/machine-hardening/anssi_bp28_high. There is an unwanted error message
E: oscap: Can't statvfs /proc/sys/fs/binfmt_misc: errno=19, No such device.
appearing in the final scan after reboot. This message appears during evaluation of ruleaudit_rules_privileged_command
. This message comes from oscap from partition probe. In the ruleaudit_rules_privileged_command
we use partition test for all paths.My theory is that this is caused by remediation of rule kernel_config_binfmt_misc.EDIT: the rule kernel_config_binfmt_misc has no remediation.SCAP Security Guide Version:
current upstream master as of 2023-04-11 as of head d8d1052
Operating System Version:
CS 8 , CS 9
Steps to Reproduce:
--profile xccdf_org.ssgproject.content_profile_anssi_bp28_high
Actual Results:
E: oscap: Can't statvfs /proc/sys/fs/binfmt_misc: errno=19, No such device.
Expected Results:
no error
Additional Information/Debugging Steps:
can be related to big ANSSI update in #10334
The text was updated successfully, but these errors were encountered: