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

Fix in sudo_require_reauthentication #10216

Merged
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<def-group>
<definition class="compliance" id="{{{ rule_id }}}" version="1">
{{{ oval_metadata("'Ensure sudo timestamp_timeout is appropriate - sudo timestamp_timeout") }}}
<criteria comment="The timestamp_timeout should be configured" >
<criteria comment="The timestamp_timeout should be configured">
<criterion comment="check configuration in /etc/sudoers" test_ref="test_sudo_timestamp_timeout" />
</criteria>
</definition>

<!-- Define test for sudo timestamp. -->
<ind:textfilecontent54_test check="all" check_existence="only_one_exists" comment="check correct configuration in /etc/sudoers" id="test_sudo_timestamp_timeout" version="1">
<ind:object object_ref="obj_sudo_timestamp_timeout"/>
<ind:state state_ref="state_sudo_timestamp_timeout" />
</ind:textfilecontent54_test>

<ind:textfilecontent54_object id="obj_sudo_timestamp_timeout" version="1">
<ind:filepath operation="pattern match">^/etc/sudoers(\.d/.*)?$</ind:filepath>
<ind:pattern operation="pattern match">^[\s]*Defaults[\s]+timestamp_timeout[\s]*=[\s]*([-]?[\d]+)$</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
<ind:filepath operation="pattern match">^\/etc\/(sudoers|sudoers\.d\/*)$</ind:filepath>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<ind:filepath operation="pattern match">^\/etc\/(sudoers|sudoers\.d\/*)$</ind:filepath>
<ind:filepath operation="pattern match">^\/etc\/(sudoers|sudoers\.d\/.*)$</ind:filepath>

Copy link
Member

Choose a reason for hiding this comment

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

It looks like it's missing the proper capture all element here

<ind:pattern operation="pattern match">^[\s]*Defaults[\s]+timestamp_timeout[\s]*=\s*[0-9]+$</ind:pattern>
<ind:instance datatype="int" operation="equals">1</ind:instance>
</ind:textfilecontent54_object>

<ind:textfilecontent54_state id="state_sudo_timestamp_timeout"
version="1">
<ind:subexpression datatype="int" operation="greater than or equal">0</ind:subexpression>
</ind:textfilecontent54_state>

</def-group>
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ fixtext: |-
Remove any duplicate or conflicting lines from /etc/sudoers and /etc/sudoers.d/ files.

srg_requirement: '{{{ full_name }}} must require re-authentication when using the "sudo" command.'

platform: package[sudo]