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

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