Blame SOURCES/sos-bz2062908-tigervnc-update-collections.patch

904e70
From 4c92968ce461cdfc6a5d913748b2ce4f148ff4a9 Mon Sep 17 00:00:00 2001
904e70
From: Jake Hunsaker <jhunsake@redhat.com>
904e70
Date: Thu, 10 Mar 2022 12:31:49 -0500
904e70
Subject: [PATCH] [tigervnc] Update collections for newer versions of TigerVNC
904e70
904e70
First, relaxes the file specifications for collection by capturing the
904e70
entire `/etc/tigervnc/` directory.
904e70
904e70
Second, adds collection of service status and journal output for each
904e70
configured vnc server. Collection of `vncserver -list` is kept for
904e70
backwards compatibility.
904e70
904e70
Finally, add a short docstring for the plugin for --help output.
904e70
904e70
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
904e70
---
904e70
 sos/report/plugins/tigervnc.py | 28 +++++++++++++++++++++++-----
904e70
 1 file changed, 23 insertions(+), 5 deletions(-)
904e70
904e70
diff --git a/sos/report/plugins/tigervnc.py b/sos/report/plugins/tigervnc.py
904e70
index 1302f6d4..e31aee25 100644
904e70
--- a/sos/report/plugins/tigervnc.py
904e70
+++ b/sos/report/plugins/tigervnc.py
904e70
@@ -12,17 +12,35 @@ from sos.report.plugins import Plugin, RedHatPlugin
904e70
 
904e70
 
904e70
 class TigerVNC(Plugin, RedHatPlugin):
904e70
+    """
904e70
+    This plugin gathers information for VNC servers provided by the tigervnc
904e70
+    package. This is explicitly for server-side collections, not clients.
904e70
+
904e70
+    By default, this plugin will capture the contents of /etc/tigervnc, which
904e70
+    may include usernames. If usernames are sensitive information for end
904e70
+    users of sos, consider using the `--clean` option to obfuscate these
904e70
+    names.
904e70
+    """
904e70
 
904e70
     short_desc = 'TigerVNC server configuration'
904e70
     plugin_name = 'tigervnc'
904e70
     packages = ('tigervnc-server',)
904e70
 
904e70
     def setup(self):
904e70
-        self.add_copy_spec([
904e70
-            '/etc/tigervnc/vncserver-config-defaults',
904e70
-            '/etc/tigervnc/vncserver-config-mandatory',
904e70
-            '/etc/tigervnc/vncserver.users'
904e70
-        ])
904e70
+        self.add_copy_spec('/etc/tigervnc/')
904e70
+
904e70
+        # service names are 'vncserver@$port' where $port is :1,, :2, etc...
904e70
+        # however they are not reported via list-unit-files, only list-units
904e70
+        vncs = self.exec_cmd(
904e70
+            'systemctl list-units --type=service --no-legend vncserver*'
904e70
+        )
904e70
+        if vncs['status'] == 0:
904e70
+            for serv in vncs['output'].splitlines():
904e70
+                vnc = serv.split()
904e70
+                if not vnc:
904e70
+                    continue
904e70
+                self.add_service_status(vnc[0])
904e70
+                self.add_journal(vnc[0])
904e70
 
904e70
         self.add_cmd_output('vncserver -list')
904e70
 
904e70
-- 
904e70
2.34.3
904e70