public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] main: test if gnome-remote-desktop-daemon can access TPM devices
Date: Wed, 18 Nov 2026 07:20:07 GMT	[thread overview]
Message-ID: <179498640704.1.328131925663348103.tests-selinux-586d842e150b@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : main
            Commit : 586d842e150b68b0e88e47e14b184390090ecd2f
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2026-11-18T07:18:45+00:00
            Stats  : +21/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/586d842e150b68b0e88e47e14b184390090ecd2f?branch=main

            Log:
            test if gnome-remote-desktop-daemon can access TPM devices

Bug reports from our customers revealed that SELinux prevents the
gnome-remote-desktop-daemon process from accessing (syscall =
statx) the TPM devices (/dev/tpm0 and /dev/tpmrm0). The TC
reproduces the situation via a software TPM.

In order to support the scenario, I believe that SELinux policy
should allow the access. The TC looks for appropriate policy
rules and file context patterns.

The TC covers RHEL-138731.

---
diff --git a/selinux-policy/gnome-remote-desktop-and-similar/main.fmf b/selinux-policy/gnome-remote-desktop-and-similar/main.fmf
index 3b854a8..3f3541b 100644
--- a/selinux-policy/gnome-remote-desktop-and-similar/main.fmf
+++ b/selinux-policy/gnome-remote-desktop-and-similar/main.fmf
@@ -24,6 +24,9 @@ recommend:
   - gnome-remote-desktop
   - gdm
   - freerdp
+  - tpm2-tools
+  - swtpm
+  - swtpm-tools
 environment:
     AVC_ERROR: +no_avc_check
 duration: 10m
@@ -37,6 +40,7 @@ tag:
 link:
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2321236
   - verifies: https://issues.redhat.com/browse/RHEL-35877
+  - verifies: https://redhat.atlassian.net/browse/RHEL-138731
 adjust+:
   - enabled: false
     when: distro == rhel-4, rhel-5, rhel-6, rhel-7

diff --git a/selinux-policy/gnome-remote-desktop-and-similar/runtest.sh b/selinux-policy/gnome-remote-desktop-and-similar/runtest.sh
index 2349eb1..f3bcf01 100755
--- a/selinux-policy/gnome-remote-desktop-and-similar/runtest.sh
+++ b/selinux-policy/gnome-remote-desktop-and-similar/runtest.sh
@@ -69,10 +69,27 @@ rlJournalStart
         rlSESearchRule "allow gnome_remote_desktop_t policykit_t : dbus { send_msg } [ ]"
         rlSESearchRule "allow policykit_t gnome_remote_desktop_t : dbus { send_msg } [ ]"
     rlPhaseEnd
+
+    rlPhaseStartTest "RHEL-138731"
+        rlSEMatchPathCon "/dev/tpm0" "tpm_device_t"
+        rlSEMatchPathCon "/dev/tpmrm0" "tpm_device_t"
+        rlSESearchRule "allow gnome_remote_desktop_t tpm_device_t : chr_file { getattr } [ ]"
+    rlPhaseEnd
     fi
 
     if [ -f /usr/lib/systemd/system/gnome-remote-desktop.service ] ; then
     rlPhaseStartTest "real scenario"
+        rlRun "modprobe tpm_vtpm_proxy"
+        rlRun "lsmod | grep tpm"
+        rlRun "ls -lZ /dev/vtpmx"
+        rlRun "mkdir -p /var/lib/swtpm/tpm0"
+        rlRun "chown -R tss:tss /var/lib/swtpm"
+        rlRun "swtpm_setup --tpm-state /var/lib/swtpm/tpm0 --tpm2 --create-ek-cert --create-platform-cert"
+        rlRun "swtpm chardev --vtpm-proxy --tpm2 --tpmstate dir=/var/lib/swtpm/tpm0 --daemon"
+        sleep 2
+        rlRun "ls -lZ /dev/tpm*"
+        rlRun "tpm2_getrandom --hex 16"
+
         rlRun "rm -rf ~gnome-remote-desktop/.local/share/gnome-remote-desktop"
         rlRun "sudo -u gnome-remote-desktop mkdir -p ~gnome-remote-desktop/.local/share/gnome-remote-desktop"
         rlRun "sudo -u gnome-remote-desktop winpr-makecert -silent -rdp -path ~gnome-remote-desktop/.local/share/gnome-remote-desktop tls"

                 reply	other threads:[~2026-11-18  7:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179498640704.1.328131925663348103.tests-selinux-586d842e150b@fedoraproject.org \
    --to=mmalik@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox