Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c45916e
Exclude user nfsnobody who is equivalent to nobody
yuumasato Mar 21, 2022
457ba78
Merge pull request #8393 from yuumasato/accounts_users_home_files_and…
Mab879 Mar 22, 2022
95abf13
Introduce new abrt related rules to replace obsolete packages.
ggbecker Mar 22, 2022
9c3657f
Merge pull request #8397 from ggbecker/fix-obsolete-abrt-rules
yuumasato Mar 22, 2022
a896175
Prevent breaking file names if they have spaces
yuumasato Mar 22, 2022
9afa33f
explicit rule ordering for sshd_set_keepalive* and sshd_set_idle_timeout
vojtapolasek Mar 23, 2022
26ea4a0
Update RHEL9 auxiliary gpg key to auxiliary key 3.
ggbecker Mar 23, 2022
637ed3b
Merge pull request #8411 from ggbecker/update-rhel9-gpg-key
vojtapolasek Mar 23, 2022
5af298b
Add test to check file permissions within dirs
yuumasato Mar 22, 2022
21ef824
Improve template checks to recurse and regex file names
yuumasato Mar 22, 2022
3c0ad70
Merge pull request #8410 from vojtapolasek/sshd_rules_ordering
yuumasato Mar 23, 2022
bdc5989
Fix the ownership of the symlink
yuumasato Mar 22, 2022
0e837f6
Bash: Only change ownership of incompliant files
yuumasato Mar 22, 2022
4c71f7e
Ansible: Make file_regex and recurse independent in template
yuumasato Mar 23, 2022
f3d94f8
Ansible: Only change files when they are incompliant
yuumasato Mar 23, 2022
39d19f7
Bash: Make file_regex and recurse independent
yuumasato Mar 23, 2022
c8de6f2
Document file only and directory only behavior
yuumasato Mar 23, 2022
141f72c
Make sure that path pattern_match is achored
yuumasato Mar 23, 2022
0e235b9
Update test to reflect current rule behaviour
yuumasato Mar 23, 2022
98c2821
The mode should be interpreted as string
yuumasato Mar 23, 2022
f575bda
Merge pull request #8404 from yuumasato/file_owners_permissions_recur…
ggbecker Mar 24, 2022
6dd56a4
When 'file_regex' is set do not operate on symlinks
yuumasato Mar 24, 2022
04027f3
Prevent breaking the paths with spaces
yuumasato Mar 24, 2022
c5feb75
Update test scenario to align with OVAL behavior
yuumasato Mar 24, 2022
beb0e07
Exclude user nfsnobody when checking home directories
mildas Mar 25, 2022
a8bb925
Merge pull request #8420 from yuumasato/file_permissions_library_dirs…
vojtapolasek Mar 25, 2022
eaf86b0
Ansible: When 'file_regex` is set, only operate on files
yuumasato Mar 25, 2022
bd9afd3
Merge pull request #8425 from yuumasato/file_permissions_library_dirs…
mildas Mar 25, 2022
0370567
Define list of excluded users to check as shared variable
mildas Mar 25, 2022
49e6ad9
Merge pull request #8426 from mildas/home_dir_exclude_nfsnobody
ggbecker Mar 25, 2022
9e65821
Revert changes from OL8 STIG profile that cause conflict with master.
ggbecker Mar 25, 2022
6833269
Merge pull request #8431 from ggbecker/fix-merge-master
yuumasato Mar 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/templates/template_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@

- **filepath** - File path to be checked. If the file path ends
with `/` it describes a directory. Can also be a list of paths.
If **file_regex** is not specified, the rule will only check
and remediate directories.

- **filepath_is_regex** - If set to `"true"` the OVAL will
consider the value of **filepath** as a regular expression.
Expand Down Expand Up @@ -294,6 +296,8 @@ they must be of the same length.

- **filepath** - File path to be checked. If the file path ends
with `/` it describes a directory. Can also be a list of paths.
If **file_regex** is not specified, the rule will only check
and remediate directories.

- **filepath_is_regex** - If set to `"true"` the OVAL will
consider the value of **filepath** as a regular expression.
Expand Down Expand Up @@ -329,6 +333,8 @@ they must be of the same length.

- **filepath** - File path to be checked. If the file path ends
with `/` it describes a directory. Can also be a list of paths.
If **file_regex** is not specified, the rule will only check
and remediate directories.

- **filepath_is_regex** - If set to `"true"` the OVAL will
consider the value of **filepath** as a regular expression.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
</definition>

<unix:password_object id="object_accounts_users_home_files_groupownership_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_accounts_users_home_files_groupownership_interactive_gids</filter>
<filter action="exclude">state_accounts_users_home_files_groupownership_user_list</filter>
</unix:password_object>

<unix:password_state id="state_accounts_users_home_files_groupownership_interactive_gids" version="1">
<unix:user_id datatype="int" operation="greater than or equal">{{{ gid_min }}}</unix:user_id>
</unix:password_state>

<unix:password_state id="state_accounts_users_home_files_groupownership_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<local_variable id="var_accounts_users_home_files_groupownership_dirs" datatype="string" version="1"
comment="Variable including all home dirs from interactive users">
<object_component item_field="home_dir"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
</definition>

<unix:password_object id="object_accounts_users_home_files_ownership_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_accounts_users_home_files_ownership_interactive_uids</filter>
<filter action="exclude">state_accounts_users_home_files_ownership_user_list</filter>
</unix:password_object>

<unix:password_state id="state_accounts_users_home_files_ownership_interactive_uids" version="1">
<unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
</unix:password_state>

<unix:password_state id="state_accounts_users_home_files_ownership_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<local_variable id="var_accounts_users_home_files_ownership_dirs" datatype="string" version="1"
comment="Variable including all home dirs from interactive users">
<object_component item_field="home_dir"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
<!-- For detailed comments about logic used in this OVAL, check the
"file_ownership_home_directories" rule. -->
<unix:password_object id="object_accounts_users_home_files_permissions_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_accounts_users_home_files_permissions_interactive_uids</filter>
<filter action="exclude">state_accounts_users_home_files_permissions_user_list</filter>
</unix:password_object>

<unix:password_state id="state_accounts_users_home_files_permissions_interactive_uids" version="1">
<unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
</unix:password_state>

<unix:password_state id="state_accounts_users_home_files_permissions_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<!-- #### prepare for test_file_permissions_home_directories #### -->
<local_variable id="var_accounts_users_home_files_permissions_dirs" datatype="string" version="1"
comment="Variable including all home dirs from interactive users">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
<!-- For detailed comments about logic used in this OVAL, check the
"file_ownership_home_directories" rule. -->
<unix:password_object id="object_file_groupownership_home_directories_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_file_groupownership_home_directories_interactive_gids</filter>
<filter action="exclude">state_file_permissions_groupownership_user_list</filter>
</unix:password_object>

<unix:password_state id="state_file_groupownership_home_directories_interactive_gids" version="1">
<unix:group_id datatype="int" operation="greater than or equal">{{{ gid_min }}}</unix:group_id>
</unix:password_state>

<unix:password_state id="state_file_permissions_groupownership_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<!-- #### prepare for test_file_groupownership_home_directories #### -->
<local_variable id="var_file_groupownership_home_directories_dirs" datatype="string" version="1"
comment="Variable including all home dirs from primary interactive groups">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
create local variables composed by UIDs e Home Dirs.
-->
<unix:password_object id="object_file_ownership_home_directories_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_file_ownership_home_directories_interactive_uids</filter>
<filter action="exclude">state_file_ownership_home_directories_user_list</filter>
</unix:password_object>

<!--
Expand All @@ -34,6 +35,10 @@
<unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
</unix:password_state>

<unix:password_state id="state_file_ownership_home_directories_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<!--
#### prepare for test_file_groupownership_home_directories ####
From the list of interactive users objects we create a local variable composed of their home dirs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
<!-- For detailed comments about logic used in this OVAL, check the
"file_ownership_home_directories" rule. -->
<unix:password_object id="object_file_permissions_home_directories_objects" version="1">
<unix:username datatype="string" operation="not equal">nobody</unix:username>
<unix:username datatype="string" operation="pattern match">.*</unix:username>
<filter action="include">state_file_permissions_home_directories_interactive_uids</filter>
<filter action="exclude">state_file_permissions_home_files_permissions_user_list</filter>
</unix:password_object>

<unix:password_state id="state_file_permissions_home_directories_interactive_uids" version="1">
<unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
</unix:password_state>

<unix:password_state id="state_file_permissions_home_files_permissions_user_list" version="1">
<unix:username datatype="string" operation="pattern match">^{{{ user_list }}}$</unix:username>
</unix:password_state>

<!-- #### prepare for test_file_permissions_home_directories #### -->
<local_variable id="var_file_permissions_home_directories_dirs" datatype="string" version="1"
comment="Variable including all home dirs from interactive users">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ template:
- /lib64/
- /usr/lib/
- /usr/lib64/
recursive: 'true'
file_regex: ^.*$
fileuid: '0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# platform = multi_platform_sle,multi_platform_rhel,multi_platform_fedora,multi_platform_ubuntu

useradd user_test

TESTDIR="/usr/lib/dir/"

mkdir $TESTDIR
touch $TESTDIR/test_me
chown user_test $TESTDIR/test_me
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# platform = multi_platform_sle,multi_platform_rhel,multi_platform_fedora,multi_platform_ubuntu

useradd user_test

TESTDIR="/usr/lib/"

# The check ignores this symlink and results in pass
ln -s $TESTDIR/mising_test_file $TESTDIR/faulty_symlink
chown -h user_test $TESTDIR/faulty_symlink
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ template:
- /lib64/
- /usr/lib/
- /usr/lib64/
recursive: 'true'
file_regex: ^.*$
filemode: '0755'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

DIRS="/lib /lib64 /usr/lib /usr/lib64"
for dirPath in $DIRS; do
find "$dirPath" -type d -exec chmod go-w '{}' \;
find "$dirPath" -type f -exec chmod go+w '{}' \;
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
documentation_complete: true

prodtype: fedora,ol7,ol8,rhel7,rhel8

title: 'Uninstall libreport-plugin-logger Package'

description: |-
{{{ describe_package_remove(package="libreport-plugin-logger") }}}

rationale: |-
<tt>libreport-plugin-logger</tt> is a ABRT plugin to report bugs into the
Red Hat Support system.

severity: low

identifiers:
cce@rhel8: CCE-89201-8

references:
disa: CCI-000381
srg: SRG-OS-000095-GPOS-00049
stigid@ol8: OL08-00-040001
stigid@rhel8: RHEL-08-040001

{{{ complete_ocil_entry_package(package="libreport-plugin-logger") }}}

template:
name: package_removed
vars:
pkgname: libreport-plugin-logger
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
documentation_complete: true

prodtype: fedora,ol7,ol8,rhel7,rhel8

title: 'Uninstall libreport-plugin-rhtsupport Package'

description: |-
{{{ describe_package_remove(package="libreport-plugin-rhtsupport") }}}

rationale: |-
<tt>libreport-plugin-rhtsupport</tt> is a ABRT plugin to report bugs into the
Red Hat Support system.

severity: low

identifiers:
cce@rhel8: CCE-88955-0

references:
disa: CCI-000381
srg: SRG-OS-000095-GPOS-00049
stigid@ol8: OL08-00-040001
stigid@rhel8: RHEL-08-040001

{{{ complete_ocil_entry_package(package="libreport-plugin-rhtsupport") }}}

template:
name: package_removed
vars:
pkgname: libreport-plugin-rhtsupport
4 changes: 3 additions & 1 deletion products/ol8/profiles/ospp.profile
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ selections:
- package_nfs-utils_removed
- package_krb5-workstation_removed
- package_abrt-addon-kerneloops_removed
- package_abrt-addon-python_removed
- package_python3-abrt-addon_removed
- package_abrt-addon-ccpp_removed
- package_abrt-plugin-sosreport_removed
- package_abrt-cli_removed
- package_libreport-plugin-rhtsupport_removed
- package_libreport-plugin-logger_removed
- package_abrt_removed

### Login
Expand Down
2 changes: 2 additions & 0 deletions products/rhel8/profiles/ospp.profile
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ selections:
- package_abrt-addon-ccpp_removed
- package_abrt-plugin-sosreport_removed
- package_abrt-cli_removed
- package_libreport-plugin-rhtsupport_removed
- package_libreport-plugin-logger_removed
- package_abrt_removed

### Login
Expand Down
2 changes: 2 additions & 0 deletions products/rhel8/profiles/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,8 @@ selections:
- package_python3-abrt-addon_removed
- package_abrt-cli_removed
- package_abrt-plugin-sosreport_removed
- package_libreport-plugin-rhtsupport_removed
- package_libreport-plugin-logger_removed

# RHEL-08-040002
- package_sendmail_removed
Expand Down
6 changes: 3 additions & 3 deletions products/rhel9/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ dconf_gdm_dir: "distro.d"
# The fingerprints below are retrieved from https://access.redhat.com/security/team/key
pkg_release: "4ae0493b"
pkg_version: "fd431d51"
aux_pkg_release: "5b32db75"
aux_pkg_version: "d4082792"
aux_pkg_release: "6229229e"
aux_pkg_version: "5a6340b3"

release_key_fingerprint: "567E347AD0044ADE55BA8A5F199E2F91FD431D51"
auxiliary_key_fingerprint: "6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792"
auxiliary_key_fingerprint: "7E4624258C406535D56D6F135054E4A45A6340B3"
oval_feed_url: "https://access.redhat.com/security/data/oval/com.redhat.rhsa-RHEL9.xml.bz2"

cpes_root: "../../shared/applicability"
Expand Down
9 changes: 9 additions & 0 deletions shared/macros-oval.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -902,3 +902,12 @@
{{%- endif %}}
</def-group>
{{%- endmacro %}}

{{#
User list in form of regex that are excluded when checking user home directory permissions and ownerships.
#}}
{{%- if product in ["rhel7", "ol7"] %}}
{{%- set user_list="(nobody|nfsnobody)" %}}
{{%- else %}}
{{%- set user_list="nobody" %}}
{{%- endif %}}
2 changes: 0 additions & 2 deletions shared/references/cce-redhat-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,6 @@ CCE-88951-9
CCE-88952-7
CCE-88953-5
CCE-88954-3
CCE-88955-0
CCE-88956-8
CCE-88957-6
CCE-88958-4
Expand Down Expand Up @@ -3085,7 +3084,6 @@ CCE-89197-8
CCE-89198-6
CCE-89199-4
CCE-89200-0
CCE-89201-8
CCE-89202-6
CCE-89203-4
CCE-89204-2
Expand Down
18 changes: 14 additions & 4 deletions shared/templates/file_groupowner/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,42 @@
# disruption = low

{{% for path in FILEPATH %}}
{{% if IS_DIRECTORY and FILE_REGEX %}}
{{% if IS_DIRECTORY %}}
{{% if FILE_REGEX %}}

- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}{{% if RECURSIVE %}} recursively{{% endif %}}

- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
find:
paths: "{{{ path }}}"
patterns: {{{ FILE_REGEX[loop.index0] }}}
use_regex: yes
{{% if RECURSIVE %}}
recurse: yes
{{% endif %}}
hidden: yes
register: files_found

- name: Ensure group owner on {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
file:
path: "{{ item.path }}"
group: "{{{ FILEGID }}}"
state: file
when: item.gid != {{{ FILEGID }}}
with_items:
- "{{ files_found.files }}"

{{% elif IS_DIRECTORY and RECURSIVE %}}
{{% else %}}

- name: Ensure group owner on {{{ path }}} recursively
- name: Ensure group owner on {{{ path }}}{{% if RECURSIVE %}} recursively{{% endif %}}
file:
path: "{{{ path }}}"
state: directory
{{% if RECURSIVE %}}
recurse: yes
{{% endif %}}
group: "{{{ FILEGID }}}"

{{% endif %}}
{{% else %}}

- name: Test for existence {{{ path }}}
Expand Down
Loading