Skip to content

Commit 6b1f5ac

Browse files
authored
Merge pull request #14479 from mpurg/file_owner_exact_user
Fix file_owner OVAL to check exact username
2 parents 1c4b537 + 6b94de4 commit 6b1f5ac

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

shared/templates/file_owner/oval.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{{%- else %}}
2323
{{%- for own in OWNERS %}}
2424
<unix:password_object id="object_file_owner{{{ FILEID }}}_{{{ own }}}_uid" version="1">
25-
<unix:username operation="pattern match">{{{ own }}}</unix:username>
25+
<unix:username operation="equals">{{{ own }}}</unix:username>
2626
</unix:password_object>
2727
<local_variable id="var_file_owner{{{ FILEID }}}_{{{ own }}}_uid" comment="Retrieve the uid of {{{ own }}}" datatype="int" version="1">
2828
<object_component item_field="user_id" object_ref="object_file_owner{{{ FILEID }}}_{{{ own }}}_uid" />

shared/templates/file_owner/tests/incorrect_owner.fail.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
{{%- if NO_REMEDIATION %}}
33
# remediation = none
44
{{%- endif %}}
5+
56
useradd testuser_123
7+
8+
{{% set OWNERS=UID_OR_NAME.split("|") %}}
69
{{%- for own in OWNERS %}}
710
id "{{{ own }}}" &>/dev/null || useradd {{{ own }}}
811
{{%- endfor %}}

0 commit comments

Comments
 (0)