Skip to content

Commit

Permalink
Fix regex for pam_wheel.so line with use_uid
Browse files Browse the repository at this point in the history
The regex used in OVAL was not expecting additional options configured
on the same line and assumed the use_uid was the last option. This
commit makes the regex more flexible and robust.
  • Loading branch information
marcusburghardt committed Jan 23, 2024
1 parent 3f4d8ec commit 756ba46
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<def-group>
<definition class="compliance" id="use_pam_wheel_for_su" version="1">
<definition class="compliance" id="{{{ rule_id }}}" version="1">
{{{ oval_metadata("Only members of the wheel group should be able to authenticate through the su command.") }}}
<criteria operator="AND">
<criterion test_ref="test_use_pam_wheel_for_su" />
</criteria>
</definition>

<ind:textfilecontent54_test check="all" check_existence="at_least_one_exists" comment="check /etc/pam.d/su for correct setting" id="test_use_pam_wheel_for_su" version="1">
<ind:textfilecontent54_test id="test_use_pam_wheel_for_su" version="1"
check="all" check_existence="at_least_one_exists"
comment="check existence of use_uid option for pam_wheel.so in /etc/pam.d/su">
<ind:object object_ref="object_use_pam_wheel_for_su" />
</ind:textfilecontent54_test>

<ind:textfilecontent54_object comment="check /etc/pam.d/su for correct setting" id="object_use_pam_wheel_for_su" version="1">
<ind:textfilecontent54_object id="object_use_pam_wheel_for_su" version="1"
comment="collect pam_wheel.so line in /etc/pam.d/su if use_uid option is present in the line">
<ind:filepath>/etc/pam.d/su</ind:filepath>
<ind:pattern operation="pattern match">^[\s]*auth[\s]+required[\s]+pam_wheel\.so[\s]+use_uid$</ind:pattern>
<ind:pattern operation="pattern match">^[\s]*auth[\s]+required[\s]+pam_wheel\.so[\s]+\buse_uid\b</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

</def-group>

0 comments on commit 756ba46

Please sign in to comment.