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

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