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

Added rule for RHEL-08-010400 #7411

Merged
merged 1 commit into from Aug 23, 2021

Conversation

Mab879
Copy link
Member

@Mab879 Mab879 commented Aug 18, 2021

@Mab879 Mab879 added New Rule Issues or pull requests related to new Rules. DISA RHEL8 STIG Alignment labels Aug 18, 2021
@Mab879 Mab879 added this to the 0.1.58 milestone Aug 18, 2021
@jan-cerny jan-cerny self-assigned this Aug 19, 2021
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.

It looks amazing.

I have only minor problems.

The tests pass for me locally:

[jcerny@thinkpad scap-security-guide{pr/7411}]$ python3 tests/test_suite.py rule --libvirt qemu:///system ssgts_rhel8 sssd_certificate_verification
Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/jcerny/work/git/scap-security-guide/logs/rule-custom-2021-08-19-0956/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_sssd_certificate_verification
INFO - Script correct_value.pass.sh using profile (all) OK
INFO - Script not_configured.fail.sh using profile (all) OK
INFO - Script wrong_section.fail.sh using profile (all) OK
INFO - Script wrong_value.fail.sh using profile (all) OK

But, in the github Actions job, they're all notapplicable. @mildas Any idea why is that happening? Is it because the VM doesn't have SSSD installed? Should Mathhew add sssd to packages section in the scenarios?

Comment on lines 17 to 20
cert=$( awk '/^\s*\[/{f=0} /^\s*\[sssd\]/{f=1} f{nu=gensub("^\\s*certificate_verification\\s*=\\s*ocsp_dgst\\s*=\\s*(\\S+).*","\\1",1); if($0!=nu){cert=nu}} END{print cert}' $f )
if [ -n "$cert" ] ; then
if [ "$cert" != $var_sssd_certificate_verification_digest_function ] ; then
sed -i "s/^certificate_verification\s*=.*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" $f
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that the "$f" should be quoted.


<ind:textfilecontent54_object id="obj_{{{rule_id}}}" version="1">
<ind:filepath operation="pattern match">^/etc/sssd/(sssd|conf\.d/.*)\.conf$</ind:filepath>
<ind:pattern operation="pattern match">^[\s]*\[sssd](?:[^\n\[]*\n+)+?[\s]*certificate_verification\s*=\s*ocsp_dgst\s*=\s*(\w+)$</ind:pattern>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it isn't needed to surround the \s by [ and ] if the \s is the only member of the group. Be consistent with the rest of the expression.

@mildas
Copy link
Contributor

mildas commented Aug 19, 2021

@jan-cerny The rule is in group with platform: sssd which needs to have installed sssd-common package. So yes, it is caused by the missing package.
Please @Mab879, add # packages = sssd-common to all test scenarios.

Copy link
Member

@ggbecker ggbecker left a comment

Choose a reason for hiding this comment

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

One test scenario suggestion is to have something like this in the test:

echo -e "[sssd]\ndifferent_option = test\ncertificate_verification = ocsp_dgst=sha1" >> /etc/sssd/sssd.conf

To check if the OVAL is able to detect a configuration item even if it comes after other configuration options.

Also, I'm trying to find the documentation around the syntax for this particular case, if it's allowed to have spaces between the equal sign from ocsp_dgst=sha1, but with no success so far.

@jan-cerny jan-cerny merged commit 13a20de into ComplianceAsCode:master Aug 23, 2021
@marcusburghardt marcusburghardt added RHEL8 Red Hat Enterprise Linux 8 product related. STIG STIG Benchmark related. labels Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Rule Issues or pull requests related to new Rules. RHEL8 Red Hat Enterprise Linux 8 product related. STIG STIG Benchmark related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants