Commit graph

773 commits

Author SHA1 Message Date
Stepan Broz
40243c00aa systemd-journal-upload: Adjust test relevancy
The only sub-test present currently is fixed in RHEL-9.7 and RHEL-10.0.
Do not test below these versions.
2026-01-07 07:03:13 +00:00
Jan Onderka
7ccb3c22cc setting additional audit-rules package as recommend for policycoreutils/load_policy 2025-12-19 11:47:50 +01:00
Jan Onderka
8e7a591a84 libselinux/setenforce test update audit-rules package dependency for RHEL10+ and making test fail if 'auditctl' is not present on the system 2025-12-18 16:20:58 +01:00
Milos Malik
54a83ea1e5 add metadata and fix description+summary
Unfortunately, the test was merged even if some metadata was missing.
Additionally, the description and summary contains characters which
are not allowed based on the output of: tmt tests lint.

Both problems should be fixed now.
2025-12-03 13:32:10 +01:00
Milos Malik
5f241c5352 test if 'restorecon -i' ignores missing filesystem objects
A recently reported customer case revealed that the restorecon
program produces error messages even if it was executed with
the '-i' option. In such case no error messages should appear
when the inspected filesystem objects are missing.

The TC reproduces the situation when old libselinux/policycoreutils
packages are installed.

The TC covers RHEL-110181 and RHEL-123884.
2025-11-25 22:50:31 +01:00
Milos Malik
4d5af50a2a fix few failing tests
Package installation attempts may fail, but the rest of test code
may still succeed. Expected exit codes were updated.
2025-11-24 08:29:41 +01:00
Stepan Broz
06e24b7df4 power-profiles-daemon-and-similari: adjust RHEL-100718 relevancy
Do not test this phase under RHEL-9.7 as it was only fixed there.
2025-11-18 14:16:16 +00:00
Therese Cornell
c49440dfb5 cups-browsed-and-similar: Ignore specific AVC denial
on RHEL/centos-9 due to RHEL-47401
2025-11-17 11:16:37 -05:00
Milos Malik
98bb59b158 test if dhcpcd-run-hooks can write into /etc/chrony.conf file
A recent dhcpcd + selinux-policy testing revealed that SELinux
prevents the running dhcpcd-run-hooks script from writing into
/etc/chrony.conf file on s390x machines. The TC reproduces the
situation, which is accompanied by the following error message:

  dhcpcd[...]: /usr/libexec/dhcpcd-run-hooks: line 132: /etc/chrony.conf: Permission denied

In order to support the intended dhcpcd-run-hooks function and
to avoid such errors in the journal, I believe that SELinux
policy should allow the access. The TC looks for appropriate
policy rules and file context patterns.

The TC covers RHEL-113937 and RHEL-113941.
2025-11-13 08:21:12 +00:00
Milos Malik
752ee72f5a test if stress-ng can read+write+map /secretmem anon inodes
Recently, a regular kernel + stress-ng testing revealed that SELinux
prevents the stress-ng program from writing (syscall = ftruncate)
and reading (syscall = mmap) the /secretmem anon inodes. The TC
reproduces the situation.

In order to enable various stress-ng functions, I believe that SELinux
policy should allow the actions mentioned above. The TC looks for
appropriate policy rules and file context patterns.

The TC covers RHEL-116154 and RHELTEST-2022.
2025-11-13 08:16:15 +00:00
Milos Malik
5842e54015 fix the targetd-and-similar test
The automated test runs the following command which produces an error:

  # targetctl clear
  Traceback (most recent call last):
    File "/usr/bin/targetctl", line 7, in <module>
      sys.exit(main())
               ~~~~^^
    File "/usr/lib/python3.14/site-packages/rtslib/targetctl.py", line 79, in main
      funcs[sys.argv[1]](savefile)
      ~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  TypeError: clear() takes 0 positional arguments but 1 was given
  # echo $?
  1
  #

Even though SELinux is not the cause, the test fails because of the error.
To work around that problem, the expected exit code is between 0 and 255 now.
2025-11-13 08:13:39 +00:00
jan janasek
d4ebe95f73 renaming type test_file_t
On rhel9 there is a another type with this name so it is colliding,
so my_test_file_t will be used in this test futher.

Signed-off-byt: jan janasek <jjanasek@redhat.com>
2025-11-10 13:09:08 +01:00
Milos Malik
ff7b5b9147 enable the systemd-oomd test for RHEL-10
Because the systemd-oomd package is available on RHEL-10, the TC
is also relevant there.
2025-10-25 08:33:23 +02:00
jan janasek
ec5c6a6306 adding test coverage for unknown permissions
Unknown permissions are now handled as errors in CIL.
With selinux >= 3.0: a CIL module, which contains unknown permissions,
cannot be inserted via semodule -i. Error messages appear.

Signed-off-by: jan janasek <janjanasek@redhat.com>
2025-10-22 09:03:25 +02:00
Stepan Broz
c04e1fa7a8 valkey-and-similar: Adjust relevancy
This currently only verifies RHEL-108982 (should be fixed in RHEL-9.8)
and RHEL-102631 (fixed in RHEL-10.1), disable the test anywhere else
for now.
2025-10-14 19:31:48 +02:00
Vit Mojzis
caa904c01f Fix "adjust" statements
Whenever a key is defined in the tmt hierarchy and some child also
defines that key, the child's will overwrite the previous one. The "+"
changes the operation to "append", so the content of key+ in the child
is added to the existing key.

Meaning that any "adjust" statement in a test plan using a test that
defines it's own "adjust:" is ignored.

Since we are expecting other statements to be appended to the "adjust"
sections, the content of each section needs to be a single list item as
opposed to a set of key-value pairs (first line needs to start with a
hyphen).

- Replace all "adjust:" sections with "adjust+:" in order to honor any
  adjustments further up the tree (parent tests, or test plans).
- Fix malformed "adjust" sections (sets of key-value pairs)

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
2025-10-09 20:22:22 +02:00
Vit Mojzis
33fd7a4bdf Increase the time limit when testing RHIVOS preload
The preload scripts cause all tests to take significantly longer than
usual, often triggering timeouts with current time limits.

Increase the time limit to 1500%.

https://issues.redhat.com/browse/VROOM-29315

Usage:
  tmt -c rhivos_preload=true run

  or

  context:
    rhivos_preload: true
2025-10-09 20:21:17 +02:00
Milos Malik
36d28b09f5 fix a syntax error
A syntax error appears when the following test is executed:
 * policycoreutils/semodule-rebuild-if-modules-changed

The problem is a missing "then" word in the test code.
2025-10-02 13:58:11 +02:00
Milos Malik
1eb61b3a69 exclude unsuitable tests from image mode testing
Tests which are not suitable (various reasons) for image mode
testing will get the avoidImageMode tag. If their conditions improve,
the tag can be removed.
2025-09-26 14:45:52 +02:00
Milos Malik
0d14d2424a find tests which do reboots and tag them properly
These tests should have the 'reboot' tag. The tag can then be used
as a filter for running tests.
2025-09-25 19:48:11 +02:00
Milos Malik
447bd53465 add a general plan for image mode testing
The newly added image-mode plan runs all relevant tests except for
those which:
 * are broken
 * require multiple hosts
 * do reboots
 * are not suitable for image mode environments

The image-mode test plan does not recognize tiers. That may change
in the future.
2025-09-25 16:33:18 +02:00
Jan Onderka
af6d8ea145 policycoreutils linux system roles test disable for RHIVOS 2025-09-16 15:22:46 +02:00
Milos Malik
d2d1130211 inform the framework to expect SELinux denials
Some tests intentionally trigger SELinux denials during their run
and there is no need to fail because of them. The default value
of avc check is not suitable for these tests.
2025-09-04 11:35:02 +02:00
Milos Malik
14479be1b9 perform the rules check on RHEL-10/CentOS stream 10 only
Currently, the SELinux denial shown in RHEL-77071 is not reproducible
on RHEL-9 or CentOS stream 9. It makes no sense to check the SELinux
policy rule existence there. The test code relevancy was updated.
2025-08-28 16:36:40 +02:00
Milos Malik
a68d8721c6 test if systemd-machined can inspect dead/empty images
Recent systemd-machined + selinux-policy testing revealed that
SELinux prevents the systemd-machined processes from creating
and removing the following directories and files:
 * /run/systemd/nspawn/
 * /run/systemd/nspawn/locks/
 * /run/systemd/nspawn/locks/inode-*

In order to support various systemd-machined and machinectl functions,
I believe that SELinux policy should allow above-mentioned actions.
The TC looks for appropriate policy rules and file context patterns.

The TC covers RHEL-105966 and RHEL-108849.
2025-08-27 08:30:40 +00:00
jan janasek
160b772afe adding gating guideline to README
Adds documentation to the README file to explain the test tiering system and its role in our gating process.
This clarifies the meaning of 'tier: 1/2/3' metadata and explains that older tags (e.g., tag:Tier1) have been deprecated.

Signed-off-by: Jan Janasek <jjanasek@redhat.com>
2025-08-26 13:03:09 +00:00
jan janasek
a74ee6af17 tag:Tier clean up
Removed redundant tags (e.g., Tier2/Tier3 and Tier2se/Tier3se) from all tests
with "tier: 2" and "tier: 3" metadata. The "tier" metadata is used instead.

Signed-off-by: Jan Janasek <jjanasek@redhat.com>
2025-08-26 13:03:09 +00:00
jan janasek
7e37b29514 fix .fmf metadata
all tests with CI-Tier-1 tag should have "tier: 1" in their metadata,
also removing tags Tier1 and Tier1se and lastly tests with "tier: 2"
and "tier: 3" should not have CI-Tier-1 tag.

Signed-off-by: Jan Janasek <jjanasek@redhat.com>
2025-08-26 13:03:09 +00:00
Milos Malik
7a6077caac fix several failing tests
Several automated tests were updated, because they were failing on
RHEL-10 machines. The list of reasons follows:
 * incorrect test relevancy
 * unimportant SELinux denials
 * newly defined SELinux labels
 * missing metadata
2025-08-26 07:55:35 +00:00
Milos Malik
22bdc812bb test if fapolicyd can connect to systemd-machined via its socket
A combined fapolicyd + systemd-machined + selinux-policy testing
revealed that SELinux prevents the fapolicyd processes from connecting
to the systemd-machined process via its UNIX socket located at:
/run/systemd/userdb/io.systemd.Machine. The TC reproduces the situation.

In order to support this behavior dictated by the nsswitch configuration,
I believe that SELinux policy should allow this action. The TC looks for
appropriate policy rules and file context patterns.

The TC covers RHEL-77071.
2025-08-18 14:47:05 +02:00
Milos Malik
16ec518546 add new test which covers the valkey* services
The valkey component is a replacement for the redis component. The
automated test covers basic functions of the valkey* services.

The TC covers RHEL-102631.
2025-08-18 08:25:14 +00:00
Zdenek Pytela
bbaec0906e Update systemd-oomd test
Do not check the type of /proc/pressure with matchpathcon because
the type is assigned using genfscon which is not recognised by
userspace tools.

Ensure that the /etc/systemd/system/-.slice.d and
/etc/systemd/system/user@.service.d directories exist before
creating files in them.
2025-08-11 13:41:35 +02:00
Milos Malik
bd01c13f8c test if recent systemd generators issues are fixed
Recent selinux-policy testing revealed that policies for various systemd
generators are not complete. For example:
 * SELinux prevented the vsftpd-generator program from executing commands
like mkdir, ls, ln, gawk etc.
 * SELinux prevented systemd-cryptsetup-generator from creating files like
/run/systemd/generator/systemd-cryptsetup@luks*.service

In order to support the functionality of various systemd generators,
I believe that SELinux policy allow the actions mentioned above. The TC
looks for appropriate policy rules and file context patterns.

The TC covers RHEL-98656, RHEL-100415 and RHEL-100721.
2025-07-28 09:06:36 +02:00
Vit Mojzis
9948e7bcf0 libsemanage/verify-options-in-semanage-conf: Extend error messages
Userspace 3.9 changes the error message to "OSError: No data available".

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
2025-07-25 21:17:30 +02:00
Milos Malik
b663bc4abf test if tuned-ppd can watch certain dirs under /sys
Several recent bug reports revealed that SELinux prevents the tuned-ppd
processes from using the inotify_add_watch syscall on the following
directories:

 * /sys/devices/system/cpu/intel_pstate (permission: watch)
 * /sys/firmware/acpi (permission: watch_reads)

In order to support the expected tuned-ppd behavior, I believe that
SELinux policy should allow these actions. The TC looks for appropriate
policy rules and file context patterns.

The TC covers RHEL-101686, RHEL-101687, BZ#2358952 and their duplicates.
2025-07-25 15:40:44 +00:00
Milos Malik
7093be1ae3 test if power-profiles-daemon can switch between profiles
A recently reported bug revealed that SELinux prevents the
power-profiles-daemon processes from writing to the following file:

 * /sys/devices/system/cpu/cpufreq/policy6/energy_performance_preference

The TC does not reproduce the situation usually.

In order to support the intentional behavior of the daemon when
power cable gets unplugged/plugged, I believe that SELinux policy
should allow the action. The TC looks for appropriate policy rules
and file context patterns.

The TC covers RHEL-100718.
2025-07-25 14:39:46 +00:00
Ondrej Mosnacek
0c58cf0a60
kernel: make flamegraph generation opt-in
To avoid running code from untrusted repositories, make the generation
of flamegraphs optional (via a test parameter) and disabled by default.
The test parameter should only be set to 1 as needed when running the
test manually and kept disabled in automated test runs.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2025-07-24 17:05:11 +02:00
Milos Malik
c857e84cc9 test if mdevctl (virtnodedevd_t) can create dirs under /etc/mdevctl.d/
A recent libvirt testing of mediated devices revealed that SELinux
prevents the mdevctl process (executed by the virtnodedevd service)
from creating directories under /etc/mdevctl.d/. The TC reproduces
the situation.

In order to enable the expected mdevctl behavior, I believe that
SELinux policy should allow this action. The TC looks for appropriate
policy rules and file context patterns.

The TC covers RHEL-98559.

test if virtqemud can reset PCI devices

Recently, an experimental libvirt + selinux-policy testing that
SELinux prevents the rpc-virtqemud process from writing (syscall =
openat) into /sys/bus/pci/devices/0000:00:00.0/config file. The TC
reproduces the situation.

In order to support the nodedev-reset function and to avoid unnecessary
SELinux denials, I believe that SELinux policy should allow this
action. The TC looks for appropriate policy rules and file context
patterns.

The TC covers RHEL-101417.
2025-07-24 08:14:25 +00:00
Zdenek Pytela
fc90e68930 Add basic test which covers systemd-oomd 2025-07-23 15:37:36 +00:00
Milos Malik
be07ded929 skip certain tests on RHEL-10 because of their irrelevance
The following tests are not relevant for RHEL-10 because the required
packages are not available for RHEL-10:
 * /selinux-policy/caddy-and-similar
 * /selinux-policy/cups-pdf-and-similar
 * /selinux-policy/ntpsec-and-similar
2025-07-23 13:37:45 +02:00
Milos Malik
7ac017780e add a basic systemd-importd test
Recently, exploratory systemd-importd + selinux-policy testing revealed
that SELinux prevents the systemd-importd service from creating and
deleting the /run/systemd/io.systemd.Import socket. The TC reproduces
the situation.

In order to support the systemd-importd service start with the default
configuration, I believe that SELinux policy should allow the actions
listed above. The TC looks for appropriate policy rules and file
context patterns.

The TC covers RHEL-98490.
2025-07-23 09:25:05 +00:00
Milos Malik
dff2d2b919 adapt to policies with reduced set of types and rules
There are policies which define less types and rules than the targeted
policy. The executed automated tests should adapt if they still make sense.
2025-07-14 10:52:51 +00:00
Ondrej Mosnacek
f0131ccaca
kernel/selinux-testsuite: bump upstream ref
The only important commit is 72e60b601832 ("policy/test_secretmem.te:
add anon_inode perms required in Linux v6.16-rc5"), which fixes the
testsuite to work on 6.16-rc5+ kernels.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2025-07-09 11:38:04 +02:00
Milos Malik
bca963344a reconsider the set of broken tests
Check if all tests tagged with rhel9_broken or rhel10_broken are
really broken. If not, remove the tag. If there are other broken
tests not yet tagged, assign them the relevant broken tag.
2025-06-24 15:26:24 +02:00
Petr Lautrbach
0e555c68c6 Skip bootc-e2e tests
bootc-e2e tests requires specific environment related to image mode. The
image is prepared using buildah and later booted. This is not supported
in this test suite (yet)

Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
2025-06-23 20:26:54 +02:00
Milos Malik
967d55a3a3 make sure that whole /etc is labeled correctly
The rlSELibraryLoaded() now makes sure that the /etc directory and
its subdirectories are labeled correctly. If they are mislabeled,
a lot executed tests can trigger unnecessary SELinux denials.
2025-06-23 17:43:33 +00:00
Ondrej Mosnacek
27ab7e5e8a
kernel/selinux-testsuite: bump ustream commit ref
Mainly to pull "tests/inet_socket: properly detect IPSEC support", which
makes the testsuite run successfully on automotive RHEL again.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2025-06-23 15:57:12 +02:00
Milos Malik
c7425fefd1 skip the RHEL-2616 test phase on RHEL-9.x
Even though the RHEL-2616 bug was investigated on RHEL-9.x, it's
not fixed and it got auto-closed. Until a solution is found or the
bug is escalated, the automated test will skip the particular test
phase.
2025-06-16 10:13:57 +02:00
Milos Malik
4d517e7d9b show the size and label of /etc/tuned/ppd_base_profile
Instead of comparing the SELinux label of that file against a fixed
value, show the label and the file size.
2025-06-13 06:55:17 +00:00
Amith Kumar
4a8550185c Fix rhel-9 avc causing deny_rules test failure
The upstream selinux-policy/deny-rules test suite failed during its run
on rhel-9. Cause of failure is an AVC denial triggered by modprobe
command while executing module_load. Fix the test code to address the
AVC & test failure.

Signed-off-by: Amith Kumar <apeetham@redhat.com>
2025-06-13 05:16:33 +05:30