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

Improve CIS SCTP kernel module check #3564

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

stmcginnis
Copy link
Contributor

Issue number:

N/A

Description of changes:

The level 2 check 3.3.1 verifies the sctp kernel module is disabled. The current check for whether it was already loaded was not correct. There is a second check to make sure loading is also disabled. If the setting for loading is to not allow it, but the module is already laoded, the check does not return the expected output. So it would stillr eport failure, but it is less than ideal for reporting the actual issue.

This changes the check for whether the module is loaded to correctly identify if the module is loaded or not before checking whether the ability has been disabled.

Testing done:

With default settings:

bash-5.1# lsmod | grep sctp

bash-5.1# modprobe -n -v sctp
insmod /lib/modules/5.15.134/kernel/net/ipv4/udp_tunnel.ko.xz 
insmod /lib/modules/5.15.134/kernel/net/ipv6/ip6_udp_tunnel.ko.xz   

bash-5.1# apiclient report cis -l 2
...
[FAIL] 3.3.1     Ensure SCTP is disabled (Automatic)
...

With driver loaded:

bash-5.1# insmod /lib/modules/5.15.134/kernel/net/ipv4/udp_tunnel.ko.xz 
bash-5.1# insmod /lib/modules/5.15.134/kernel/net/ipv6/ip6_udp_tunnel.ko.xz 
bash-5.1# insmod /lib/modules/5.15.134/kernel/net/sctp/sctp.ko.xz 

bash-5.1# lsmod | grep sctp
sctp                  454656  6
ip6_udp_tunnel         16384  1 sctp
udp_tunnel             24576  1 sctp

bash-5.1# apiclient report cis -l 2
...
[FAIL] 3.3.1     Ensure SCTP is disabled (Automatic)
...

With driver loading disabled and after reboot so module could be unloaded:

bash-5.1# apiclient set kernel.modules.sctp.allowed=false
bash-5.1# reboot

bash-5.1# apiclient report cis -l 2
...
[PASS] 3.3.1     Ensure SCTP is disabled (Automatic)
...

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.

@stmcginnis stmcginnis changed the title cis: Improve SCTP kernel module check Improve CIS SCTP kernel module check Nov 3, 2023
The level 2 check 3.3.1 verifies the sctp kernel module is disabled. The
current check for whether it was already loaded was not correct. There
is a second check to make sure loading is also disabled. If the setting
for loading is to not allow it, but the module is already laoded, the
check does not return the expected output. So it would stillr eport
failure, but it is less than ideal for reporting the actual issue.

This changes the check for whether the module is loaded to correctly
identify if the module is loaded or not before checking whether the
ability has been disabled.

Signed-off-by: Sean McGinnis <stmcg@amazon.com>
@stmcginnis stmcginnis merged commit f0d54e9 into bottlerocket-os:develop Nov 3, 2023
1 of 46 checks passed
@stmcginnis stmcginnis deleted the cis-sctp branch November 3, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants