dev-sec / dev-sec/linux-baseline
sysctl-34 - fs.protected_hardlinks and fs.protected_symlinks can be nil
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 875
- Forks
- 193
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
The sysctl-34 checks are currently failing with the latest amzn linux 2 images from aws (used ami filter amzn2-ami-hvm-*-x86_64-gp2):
CIS-AMZN2.amazon-ebs.amz-ami: × sysctl-34: Ensure links are protected (2 failed)
CIS-AMZN2.amazon-ebs.amz-ami: ✔ Kernel Parameter fs.protected_fifos value is expected to eq 1 or eq 2 or eq nil
CIS-AMZN2.amazon-ebs.amz-ami: × Kernel Parameter fs.protected_hardlinks value is expected to eq 1
CIS-AMZN2.amazon-ebs.amz-ami:
CIS-AMZN2.amazon-ebs.amz-ami: expected: 1
CIS-AMZN2.amazon-ebs.amz-ami: got: nil
CIS-AMZN2.amazon-ebs.amz-ami:
CIS-AMZN2.amazon-ebs.amz-ami: (compared using ==)
CIS-AMZN2.amazon-ebs.amz-ami:
CIS-AMZN2.amazon-ebs.amz-ami: ✔ Kernel Parameter fs.protected_regular value is expected to eq 2 or eq nil
CIS-AMZN2.amazon-ebs.amz-ami: × Kernel Parameter fs.protected_symlinks value is expected to eq 1
CIS-AMZN2.amazon-ebs.amz-ami:
CIS-AMZN2.amazon-ebs.amz-ami: expected: 1
CIS-AMZN2.amazon-ebs.amz-ami: got: nil
The issue triggered by the following lines.
fs.protected_hardlinks:
https://github.com/dev-sec/linux-baseline/blob/81ce2ab60cc4bc29aad3822897de1c55593e3f73/controls/sysctl_spec.rb#L420
fs.protected_symlinks:
https://github.com/dev-sec/linux-baseline/blob/81ce2ab60cc4bc29aad3822897de1c55593e3f73/controls/sysctl_spec.rb#L426
A possible fix is similar like the already implemented exceptions for fs.protected_regular and fs.protected_fifos:
describe kernel_parameter('fs.protected_hardlinks') do # include nil because amzn linux does not have this parameter
its(:value) { should eq(1).or eq(nil) }
end
describe kernel_parameter('fs.protected_symlinks') do
its(:value) { should eq(1).or eq(nil) } # include nil because amzn linux does not have this parameter
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in controls/sysctl_spec.rb at the kernel_parameter checks around lines 420 and 426, and compare them with the existing fs.protected_regular and fs.protected_fifos expectations. Verify the checks handle Amazon Linux 2 values as described, then run the relevant InSpec profile tests and confirm sysctl-34 passes without weakening the required values on systems that provide them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, ruby
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100