Closed spencer-cdw closed 2 years ago
Attempts to fix
describe processes('chronyd') do
its(:users) { should match(/^(chrony|_chrony)) }
end
@spencer-cdw
Attempts to fix
- ❌
describe processes('chronyd') do its(:users) { should match(/^(chrony|_chrony)) } end
I think the trailing /
in your match expression is missing, but that should work.
The emerging convention in this profile seems to be: add a default variable/input when values are expected to be different across distros (see https://github.com/dev-sec/cis-dil-benchmark/issues/112#issuecomment-817071258).
This might be easier/quicker fix to implement/release into this profile than fixing the bug you in heimdall you linked.
Good observation. This fix is small enough I think it is ok to put the logic in the describe
stanza.
I see your point about managing large differences (e.g. centos/amazon linux/debian ect...). I've stumbled on something similar where ubuntu 18.04 varies significantly from ubuntu 22.04 with regards to grub/grub2/auditd.
With regards to this bug, I think the following should fix it. (I'll open a PR if it does)
describe processes('chronyd') do
its(:users) { should be_in ['chrony', '_chrony'] }
end
Confirmed fixed: https://github.com/dev-sec/cis-dil-benchmark/pull/135
Nice catch. This seems to be this way since a very long time.
https://salsa.debian.org/debian/chrony/-/blob/debian/latest/debian/README.Debian#L17-24
Since version 1.31.1-1, we create the _chrony system user to which chronyd will drop root privileges on initialisation.
The check for cis 2.2.13 assumes that there is a
chrony
user on the system and that thechronyd
service is running as that user.The debian package for chrony does not provide a user.
There is however a user named
_chrony
https://github.com/dev-sec/cis-dil-benchmark/blob/c845274efcf6e5f2e9307a780995a94c7bee0042/controls/2_2_special_purpose_services.rb#L98-L122